From patchwork Tue Jan 9 07:16:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Openvpn-devel] Windows: Set interface IPv6 prefix length when configuring address X-Patchwork-Submitter: Eyal Birger X-Patchwork-Id: 173 Message-Id: <1515482173-29447-1-git-send-email-eyal.birger@gmail.com> To: openvpn-devel@lists.sourceforge.net Date: Tue, 9 Jan 2018 09:16:13 +0200 From: Eyal Birger List-Id: Address prefix length defaults to /64 on Windows. This change allows using Windows clients in setups that use a different prefix length. Note: the ability to set the prefix length is documented in the netsh 'add address' command, but works on the 'set address' command as well. Signed-off-by: Eyal Birger Acked-by: Selva Nair Acked-by: Selva Nair <selva.nair@gmail.com>

Though this works in my tests I want to retract this ACK.

Apart from possible issues due to the appearance of the onlink route in some cases, I think the correct approach going forward is to stop using netsh and use the IP helper API for such tasks. And do it in the same way as done using the service.

Un-Acked-by: Selva Nair <selva.nair@gmail.com> :)

Selva
--- src/openvpn/tun.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 25831ce..b2b4795 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1561,15 +1561,16 @@ do_ifconfig(struct tuntap *tt, } else { - /* example: netsh interface ipv6 set address interface=42 2001:608:8003::d store=active */ + /* example: netsh interface ipv6 set address interface=42 2001:608:8003::d/64 store=active */ char iface[64]; openvpn_snprintf(iface, sizeof(iface), "interface=%lu", tt->adapter_index ); argv_printf(&argv, - "%s%sc interface ipv6 set address %s %s store=active", + "%s%sc interface ipv6 set address %s %s/%d store=active", get_win_sys_path(), NETSH_PATH_SUFFIX, iface, - ifconfig_ipv6_local ); + ifconfig_ipv6_local, + tt->netbits_ipv6); netsh_command(&argv, 4, M_FATAL); /* set ipv6 dns servers if any are specified */ netsh_set_dns6_servers(tt->options.dns6, tt->options.dns6_len, actual);