From 5c30df12ae98c0289cdfb2a24aefba2a9d2cc52e Mon Sep 17 00:00:00 2001 From: james Date: Thu, 19 Nov 2009 16:42:51 +0000 Subject: Fixed a client-side bug that occurred when the "dhcp-pre-release" or "dhcp-renew" options were combined with "route-gateway dhcp". The problem is that the IP Helper functions for DHCP release and renew are blocking, and so calling them from a single-threaded client stops tunnel traffic forwarding, and hence breaks "route-gateway dhcp" which requires an active tunnel. The fix is to call the IP Helper functions for DHCP release and renew from another process. Version 2.1_rc21b. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@5164 e7ae566f-a301-0410-adde-c780ea21d3b5 --- options.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'options.c') diff --git a/options.c b/options.c index 183c21a..ae4825c 100644 --- a/options.c +++ b/options.c @@ -2780,6 +2780,14 @@ positive_atoi (const char *str) return i < 0 ? 0 : i; } +static unsigned int +atou (const char *str) +{ + unsigned int val = 0; + sscanf (str, "%u", &val); + return val; +} + static inline bool space (unsigned char c) { @@ -5097,6 +5105,19 @@ add_option (struct options *options, VERIFY_PERMISSION (OPT_P_IPWIN32); options->tuntap_options.dhcp_release = true; } + else if (streq (p[0], "dhcp-rr") && p[1]) /* standalone method for internal use */ + { + unsigned int adapter_index; + VERIFY_PERMISSION (OPT_P_GENERAL); + set_debug_level (options->verbosity, SDL_CONSTRAIN); + adapter_index = atou (p[1]); + sleep (options->tuntap_options.tap_sleep); + if (options->tuntap_options.dhcp_pre_release) + dhcp_release_by_adapter_index (adapter_index); + if (options->tuntap_options.dhcp_renew) + dhcp_renew_by_adapter_index (adapter_index); + openvpn_exit (OPENVPN_EXIT_STATUS_USAGE); /* exit point */ + } else if (streq (p[0], "show-valid-subnets")) { VERIFY_PERMISSION (OPT_P_GENERAL); -- cgit