Also make sure --dhcp-pre-release results in not just dhcp_release()
in open_tun() but a subsequent dhcp_renew() as well. Else dhcp transaction
gets aborted as this call to release() happens after the adapter status
is changed to connected.
Fixes Trac #807 (but can't say the same for Trac #665 without knowing
how to reproduce it)
v2: Mark --dhcp-release as obsolete in manpage and option parser, and
remove the unused dhcp_release variable.
Enforce dhcp-renew with dhcp-pre-release while parsing the option
instead of in open_tun().
Trac: #807
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1483475883-17450-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13814.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit db5b9b45508ea8f66ea80565279af3edd9300499)
... | ... |
@@ -5819,9 +5819,7 @@ flag. |
5819 | 5819 |
.TP |
5820 | 5820 |
.B \-\-dhcp\-release |
5821 | 5821 |
Ask Windows to release the TAP adapter lease on shutdown. |
5822 |
-This option has the same caveats as |
|
5823 |
-.B \-\-dhcp\-renew |
|
5824 |
-above. |
|
5822 |
+This option has no effect now, as it is enabled by default starting with version 2.4.1. |
|
5825 | 5823 |
.\"********************************************************* |
5826 | 5824 |
.TP |
5827 | 5825 |
.B \-\-register\-dns |
... | ... |
@@ -716,7 +716,6 @@ static const char usage_message[] = |
716 | 716 |
"--dhcp-renew : Ask Windows to renew the TAP adapter lease on startup.\n" |
717 | 717 |
"--dhcp-pre-release : Ask Windows to release the previous TAP adapter lease on\n" |
718 | 718 |
" startup.\n" |
719 |
- "--dhcp-release : Ask Windows to release the TAP adapter lease on shutdown.\n" |
|
720 | 719 |
"--register-dns : Run ipconfig /flushdns and ipconfig /registerdns\n" |
721 | 720 |
" on connection initiation.\n" |
722 | 721 |
"--tap-sleep n : Sleep for n seconds after TAP adapter open before\n" |
... | ... |
@@ -1214,7 +1213,6 @@ show_tuntap_options(const struct tuntap_options *o) |
1214 | 1214 |
SHOW_BOOL(dhcp_options); |
1215 | 1215 |
SHOW_BOOL(dhcp_renew); |
1216 | 1216 |
SHOW_BOOL(dhcp_pre_release); |
1217 |
- SHOW_BOOL(dhcp_release); |
|
1218 | 1217 |
SHOW_STR(domain); |
1219 | 1218 |
SHOW_STR(netbios_scope); |
1220 | 1219 |
SHOW_INT(netbios_node_type); |
... | ... |
@@ -7201,11 +7199,11 @@ add_option(struct options *options, |
7201 | 7201 |
{ |
7202 | 7202 |
VERIFY_PERMISSION(OPT_P_IPWIN32); |
7203 | 7203 |
options->tuntap_options.dhcp_pre_release = true; |
7204 |
+ options->tuntap_options.dhcp_renew = true; |
|
7204 | 7205 |
} |
7205 | 7206 |
else if (streq(p[0], "dhcp-release") && !p[1]) |
7206 | 7207 |
{ |
7207 |
- VERIFY_PERMISSION(OPT_P_IPWIN32); |
|
7208 |
- options->tuntap_options.dhcp_release = true; |
|
7208 |
+ msg(M_WARN, "Obsolete option --dhcp-release detected. This is now on by default"); |
|
7209 | 7209 |
} |
7210 | 7210 |
else if (streq(p[0], "dhcp-internal") && p[1] && !p[2]) /* standalone method for internal use */ |
7211 | 7211 |
{ |