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>
... | ... |
@@ -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 |
... | ... |
@@ -715,7 +715,6 @@ static const char usage_message[] = |
715 | 715 |
"--dhcp-renew : Ask Windows to renew the TAP adapter lease on startup.\n" |
716 | 716 |
"--dhcp-pre-release : Ask Windows to release the previous TAP adapter lease on\n" |
717 | 717 |
" startup.\n" |
718 |
- "--dhcp-release : Ask Windows to release the TAP adapter lease on shutdown.\n" |
|
719 | 718 |
"--register-dns : Run ipconfig /flushdns and ipconfig /registerdns\n" |
720 | 719 |
" on connection initiation.\n" |
721 | 720 |
"--tap-sleep n : Sleep for n seconds after TAP adapter open before\n" |
... | ... |
@@ -1212,7 +1211,6 @@ show_tuntap_options(const struct tuntap_options *o) |
1212 | 1212 |
SHOW_BOOL(dhcp_options); |
1213 | 1213 |
SHOW_BOOL(dhcp_renew); |
1214 | 1214 |
SHOW_BOOL(dhcp_pre_release); |
1215 |
- SHOW_BOOL(dhcp_release); |
|
1216 | 1215 |
SHOW_STR(domain); |
1217 | 1216 |
SHOW_STR(netbios_scope); |
1218 | 1217 |
SHOW_INT(netbios_node_type); |
... | ... |
@@ -7185,11 +7183,11 @@ add_option(struct options *options, |
7185 | 7185 |
{ |
7186 | 7186 |
VERIFY_PERMISSION(OPT_P_IPWIN32); |
7187 | 7187 |
options->tuntap_options.dhcp_pre_release = true; |
7188 |
+ options->tuntap_options.dhcp_renew = true; |
|
7188 | 7189 |
} |
7189 | 7190 |
else if (streq(p[0], "dhcp-release") && !p[1]) |
7190 | 7191 |
{ |
7191 |
- VERIFY_PERMISSION(OPT_P_IPWIN32); |
|
7192 |
- options->tuntap_options.dhcp_release = true; |
|
7192 |
+ msg(M_WARN, "Obsolete option --dhcp-release detected. This is now on by default"); |
|
7193 | 7193 |
} |
7194 | 7194 |
else if (streq(p[0], "dhcp-internal") && p[1] && !p[2]) /* standalone method for internal use */ |
7195 | 7195 |
{ |