Hi,

On Mon, May 30, 2022 at 05:49:15PM +0200, Max Fillinger wrote:
> When running with --ifconfig-noexec, OpenVPN does not execute ifconfig,
> but on exit, it still tries to "undo" the configuration it would have
> done. This patch fixes it by extracting an undo_ifconfig() function from
> close_tun(). The undo function is called before close_tun(), but only if
> --ifconfig-noexec isn't set. This is symmetric to how open_tun() and
> do_ifconfig() are used.
> 
> This change also allows us to drop the second argument from close_tun().
> 
> v2: Fix tabs-vs-spaces.
> v3: Fix another style mistake.

I like this approach much more than what we discussed previously.

Though, alas...

ld: error: undefined symbol: undo_ifconfig
>>> referenced by init.c:1863
>>>               init.o:(do_close_tun)
>>> referenced by init.c:1863
>>>               init.o:(do_close_tun)
cc: error: linker command failed with exit code 1 (use -v to see invocation)

... the current undo_ifconfig_*() functions are inside a TARGET_LINUX
block, so this change breaks all other platforms...

(Tried on FreeBSD, but my reading of the code suggest that all others
will fail too)

We could add undo_ifconfig_*() functions - or "do nothing" stubs - for
other platforms...

gert
-- 
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             g...@greenie.muc.de

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to