$route_vpn_gateway enviro. variable and "route-gateway dhcp"
Posted: Thu May 12, 2011 3:24 pm
My OpenVPN server bridges with a DHCP-serving interface and pushes "route-gateway dhcp" to clients so that the gateway and IP address will be configured using DHCP. This works great on Windows, but as everyone knows it's not supported natively on *nix systems.
So, I have an UP script for the clients that calls "ipconfig set tap0 DHCP" to configure the tap interface for DHCP. However, I've started helping out on the Tunnelblick project and I'd like to make a generic do-everything script ... that is, an UP script that recognizes when it needs to use DHCP and uses it, and recognizes when it doesn't need to use DHCP and doesn't use it, without requiring user input.
I took a look at the environmental variables available to UP scripts on the man page and saw this one:
route_vpn_gateway: The default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified. Set prior to --up script execution.
This seemed like a no-brainer to me. I'd test if the $route_vpn_gateway value was "dhcp" to determine if I need to use DHCP. Unfortunately, it didn't work that way. $route_vpn_gateway only has a value when the pushed/configured "route-gateway" value is an IP address. When it's set to "dhcp," $route_vpn_gateway is unset. I thought maybe "foreign_option_{n}" or some other variable might have the information I needed, but a quick printenv reveals that there are NO environmental variables available to the script that indicate DHCP should be in use.
So, my question is, is there any way (I'm not seeing it) to get the actual value of "route-gateway" (whether pushed or in the client config) from within the UP script, even if that value is "dhcp?" If not, should I file a bug that $route_vpn_gateway doesn't correctly indicate DHCP, or request that some other environmental variable (a foreign option or something like $route_gateway_dhcp) be added?
Ideas? Thoughts?
Thanks!
Nick
So, I have an UP script for the clients that calls "ipconfig set tap0 DHCP" to configure the tap interface for DHCP. However, I've started helping out on the Tunnelblick project and I'd like to make a generic do-everything script ... that is, an UP script that recognizes when it needs to use DHCP and uses it, and recognizes when it doesn't need to use DHCP and doesn't use it, without requiring user input.
I took a look at the environmental variables available to UP scripts on the man page and saw this one:
route_vpn_gateway: The default gateway used by --route options, as specified in either the --route-gateway option or the second parameter to --ifconfig when --dev tun is specified. Set prior to --up script execution.
This seemed like a no-brainer to me. I'd test if the $route_vpn_gateway value was "dhcp" to determine if I need to use DHCP. Unfortunately, it didn't work that way. $route_vpn_gateway only has a value when the pushed/configured "route-gateway" value is an IP address. When it's set to "dhcp," $route_vpn_gateway is unset. I thought maybe "foreign_option_{n}" or some other variable might have the information I needed, but a quick printenv reveals that there are NO environmental variables available to the script that indicate DHCP should be in use.
So, my question is, is there any way (I'm not seeing it) to get the actual value of "route-gateway" (whether pushed or in the client config) from within the UP script, even if that value is "dhcp?" If not, should I file a bug that $route_vpn_gateway doesn't correctly indicate DHCP, or request that some other environmental variable (a foreign option or something like $route_gateway_dhcp) be added?
Ideas? Thoughts?
Thanks!
Nick