Page 1 of 1

--up-post type script?

Posted: Sun Aug 19, 2012 12:18 am
by Kasyx
Hiya,

I need to run a script that calls DHCP before the routes are applied. I have set a --route-delay for testing, and if I manually run the script during this period, everything works as intended.

However, when I attempt to use --up with the script, the interface doesn't seem to be 'up' enough to carry out the DHCP request. Does --up assume that the script or will actually deal with the initialization of the interface? Or does it continue with the initialization after the script has been called? Is there any way to call the script /after/ the interface is ready, but before the routes are set?

I have tried all of the possible script options listed in the man page, the closest two temporally are --ipchange (called too soon) and --route-up (called too late, and also still seems not to work).

Is there another hook that isn't documented or is well hidden that replicates the pause in --route-delay? Or is there another mechanism for calling scripts during this period? Something like --up-post in the way there is --down-pre perhaps?

-K

Re: --up-post type script?

Posted: Mon Aug 20, 2012 10:36 pm
by Kasyx
Thanks to the lovely Fecn on IRC, there is a workaround.

up.sh:

dhcpcd.sh &
exit 0


dhcpcd.sh:

sleep 1
dhcpcd tap0


OpenVPN waits for the up script to exit before continuing initializing the adapter. I'm not certain how long it takes, but it works with sleep 1. This way, the script can exit, and by the time tap0 is ready to do things, dhcpcd is called.

It would still be nice if there were an --up-post script though.