| Message ID | 20191127134258.9162-1-l@libres.ch |
|---|---|
| State | Changes Requested |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id UFfhHBOC3l0rdAAAIUCqbw for <patchwork@openvpn.net>; Wed, 27 Nov 2019 09:02:59 -0500 Received: from proxy17.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net with LMTP id wBvaHBOC3l1hPgAAalYnBA ; Wed, 27 Nov 2019 09:02:59 -0500 Received: from smtp30.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy17.mail.ord1d.rsapps.net with LMTP id WMJXGhOC3l32PwAAWC7mWg ; Wed, 27 Nov 2019 09:02:59 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp30.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dkim=fail (signature verification failed) header.d=libres.ch; dmarc=fail (p=none; dis=none) header.from=libres.ch X-Suspicious-Flag: YES X-Classification-ID: 9db16a1c-111e-11ea-b81d-5254001e8e38-1-1 Received: from [216.105.38.7] ([216.105.38.7:55804] helo=lists.sourceforge.net) by smtp30.gate.ord1d.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 57/35-24598-2128EDD5; Wed, 27 Nov 2019 09:02:58 -0500 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1iZxsv-00023h-CR; Wed, 27 Nov 2019 14:01:37 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from <l@libres.ch>) id 1iZxss-00022v-A1 for openvpn-devel@lists.sourceforge.net; Wed, 27 Nov 2019 14:01:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:Message-ID:Subject: Reply-To:Cc:From:To:Date:Sender:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nbxikVusyVrTCmIR3IKi0cHX8gHic/tPjQWma0gPtTs=; b=OBUYD9q/w/nonpv4pcK8AVzRdN OgSDMf4v0Vler0qGrTPoMDKuR+3IeXT/9vpGZXi3EEXStL7+L/TSLUfkfGxgvaCJf07yQuGCvRocF pW5V6dje2JAVYOMYpPm0vZ4LyFY241o2VtcvbrsbmjA2f1RR977onMeovwSA0E123D74=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:MIME-Version:Message-ID:Subject:Reply-To:Cc:From:To:Date: Sender:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=nbxikVusyVrTCmIR3IKi0cHX8gHic/tPjQWma0gPtTs=; b=d U3XA345KomGoBReTPHOyyodkcPcc63lALgk/ajt5tvZz0ZjHor0nrIZkTtQORWNQf2obuS8KorE1+ bC/9Zpaq4/wQXWIVRr1KL4dentW6VXqGv4eWDUeNKSh1MYc6TDIn3xiHbciHNgulF/3qKoUrhxA25 D2QIN0eQyPKW6aw8=; Received: from mail4.protonmail.ch ([185.70.40.27]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1iZxsm-00F4ox-V9 for openvpn-devel@lists.sourceforge.net; Wed, 27 Nov 2019 14:01:34 +0000 Date: Wed, 27 Nov 2019 13:43:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=libres.ch; s=protonmail; t=1574862220; bh=nbxikVusyVrTCmIR3IKi0cHX8gHic/tPjQWma0gPtTs=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=RB44Ix+sVZtn4I/TaysNAp4ErOUyyYsw36a5QpZ0LAX8AWUG6SJgUO0QsDtmRzK8U 6Q072DvrWfi5c5LZfaNBA3mo+FFkuZqCMhoQ9JOe4eyuaszBokpnxPRtA5hvlLOo2v 9uMUmnKtHc/E0OuNr3lX9+VM+XaEHQtG6C7aHJrw= To: openvpn-devel@lists.sourceforge.net From: Laurent Fasnacht <l@libres.ch> Message-ID: <20191127134258.9162-1-l@libres.ch> Feedback-ID: 57pQRvny2FQmWgLHJJAbxKAKqQBFnNNx81A6cwIljfp_GXmFnS-7GQgfTdz7uWKbCUkx1vWr55f9BuhCrwWL9w==:Ext:ProtonMail MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 1.0 MIME_NO_TEXT No (properly identified) text body parts X-Headers-End: 1iZxsm-00F4ox-V9 Subject: [Openvpn-devel] [PATCH] Fix IPv6 configuration on Windows using netsh X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> Reply-To: Laurent Fasnacht <l@libres.ch> Content-Type: multipart/mixed; boundary="===============8951622352841049149==" Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel] Fix IPv6 configuration on Windows using netsh
|
|
Commit Message
Laurent Fasnacht
Nov. 27, 2019, 2:43 a.m. UTC
Apparently, `netsh interface ipv6 set address ...` defaults to using a subnet of /64, and therefore adds an onlink route of that size. When using a tun tunnel, the tap adapter only replies to neighbor discovery packets for fe80::8. This leads to the unfortunate situation where all the hosts in the /64 are not reachable. This patch fixes that situation by specifying a /128 netmask, as the real route is added afterwards, via the gateway. --- src/openvpn/tun.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
Am 27.11.19 um 14:43 schrieb Laurent Fasnacht: > Apparently, `netsh interface ipv6 set address ...` defaults to using > a subnet of /64, and therefore adds an onlink route of that size. > > When using a tun tunnel, the tap adapter only replies to neighbor > discovery packets for fe80::8. This leads to the unfortunate situation > where all the hosts in the /64 are not reachable. > > This patch fixes that situation by specifying a /128 netmask, as the real > route is added afterwards, via the gateway. > --- > src/openvpn/tun.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c > index 599fd817..8b054c80 100644 > --- a/src/openvpn/tun.c > +++ b/src/openvpn/tun.c > @@ -982,15 +982,15 @@ do_ifconfig_ipv6(struct tuntap *tt, const char *ifname, int tun_mtu, > else > { > /* example: netsh interface ipv6 set address interface=42 > - * 2001:608:8003::d store=active > + * 2001:608:8003::d/128 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", > + argv_printf(&argv, "%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, 128); > 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, ifname); Instead changing the implicit /64 to an explicit /128, wouldn't it be better to use the correct tt->netbits_ipv6 like on other platforms? Arne
Hi, On Mon, Apr 20, 2020 at 02:28:28PM +0200, Arne Schwabe wrote: > Am 27.11.19 um 14:43 schrieb Laurent Fasnacht: > > Apparently, `netsh interface ipv6 set address ...` defaults to using > > a subnet of /64, and therefore adds an onlink route of that size. Ah, there the patch is. I was looking for it recently and could not find it... > Instead changing the implicit /64 to an explicit /128, wouldn't it be > better to use the correct tt->netbits_ipv6 like on other platforms? No, due to the way we hacked ND in tun mode. For Windows, this is still a multiaccess network, but the TAP driver will only reply to ND queries for his gateway address (fe80::8). So if you use the correct netmask, Windows will send NDs for all hosts in the /64 or /80 or whatnot, which will fail - no ND on the tun interface, and nothing in the driver to translate. (Now, my "tap-to-tun adapter inside OpenVPN" would do this, because AIX only has tap - but that's still unfinished). Laurent: I'll see that I can get this fully understood, tested and merged. Sorry for the delay. gert
Hi, On Wed, Nov 27, 2019 at 01:43:38PM +0000, Laurent Fasnacht wrote: > Apparently, `netsh interface ipv6 set address ...` defaults to using > a subnet of /64, and therefore adds an onlink route of that size. > > When using a tun tunnel, the tap adapter only replies to neighbor > discovery packets for fe80::8. This leads to the unfortunate situation > where all the hosts in the /64 are not reachable. > > This patch fixes that situation by specifying a /128 netmask, as the real > route is added afterwards, via the gateway. So, coming back to this. I tried to reproduce this in the context of https://community.openvpn.net/openvpn/ticket/1054 and actually couldn't. I tested on Win10, and both on tun and tap mode, the existing code always configured a "/128" on-link (and then added the /64 route to what it thought was the right gateway - fe80::8 for tun, its own address for tap). I will need to touch the code now anyway, as the behaviour for tap is *wrong* (for tap, it really needs to have a /64 on-link, and do ND inside the network) - but if I could reproduce the issue you saw for tun, it would make my life easier :-) Arne: in "dev tun" mode on windows, we can only reach a single gateway IP (fe80::8) which is the "spoof ND replies!" thing in the tun/tap driver - everything else only works if sent via fe80::8 -> strip ethernet header -> send as "tun" packets. So, /128 is correct for tun. gert
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 599fd817..8b054c80 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -982,15 +982,15 @@ do_ifconfig_ipv6(struct tuntap *tt, const char *ifname, int tun_mtu, else { /* example: netsh interface ipv6 set address interface=42 - * 2001:608:8003::d store=active + * 2001:608:8003::d/128 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", + argv_printf(&argv, "%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, 128); 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, ifname);