summaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-11-19 16:42:51 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-11-19 16:42:51 +0000
commit5c30df12ae98c0289cdfb2a24aefba2a9d2cc52e (patch)
treeb900adb66ca9a3c7d57fb89fe647f6772df027f9 /options.c
parentb9437c64ddd36c7c13508977e1a348d0e45d3187 (diff)
downloadopenvpn-5c30df12ae98c0289cdfb2a24aefba2a9d2cc52e.tar.gz
openvpn-5c30df12ae98c0289cdfb2a24aefba2a9d2cc52e.tar.xz
openvpn-5c30df12ae98c0289cdfb2a24aefba2a9d2cc52e.zip
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
Diffstat (limited to 'options.c')
-rw-r--r--options.c21
1 files changed, 21 insertions, 0 deletions
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);