From patchwork Tue Feb 20 05:00:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 237 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id zpKDAXGhjVpqSwAAIUCqbw for ; Wed, 21 Feb 2018 11:42:25 -0500 Received: from director8.mail.ord1c.rsapps.net ([172.28.255.1]) by director8.mail.ord1d.rsapps.net (Dovecot) with LMTP id ldFHBnGhjVqpCQAAfY0hYg ; Wed, 21 Feb 2018 11:42:25 -0500 Received: from smtp26.gate.ord1a ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by director8.mail.ord1c.rsapps.net (Dovecot) with LMTP id TvwhCHGhjVpKZgAAPBwpBw ; Wed, 21 Feb 2018 11:42:25 -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: smtp26.gate.ord1a.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; dmarc=none (p=nil; dis=none) header.from=greenie.muc.de X-Classification-ID: 31800f72-1726-11e8-bc47-00221925465a-1-1 Received: from [216.105.38.7] ([216.105.38.7:22153] helo=lists.sourceforge.net) by smtp26.gate.ord1a.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id DC/04-29314-071AD8A5; Wed, 21 Feb 2018 11:42:25 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eoXSI-0009bu-7I; Wed, 21 Feb 2018 16:41:18 +0000 Received: from siteops-lb-1.v20.lw.sourceforge.com ([172.30.20.11] helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eoAL5-0003Pb-9C for openvpn-devel@lists.sourceforge.net; Tue, 20 Feb 2018 16:00:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type: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=at+C/6Wt6nc7FNWSJEc2qHGtrmuf1yB8J3ZxLRimrHc=; b=Wkj8HIxJeJVg/LsW6QSMtPwDUO 2PuVRWfwRLLXRcC9rSxiarI92tejk3CMvlX+iKTo6soIRb/CDQwpRmkU3ZkyWTI2rnn1CftZwlqMe QhHxNNpM2WO1bmW5HfBlSFbqNYPceHbsBBwuzsg66E7miOegY5+bnvSwYtDWPirjQAsk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type: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=at+C/6Wt6nc7FNWSJEc2qHGtrmuf1yB8J3ZxLRimrHc=; b=TZQ5VhSTkIYlsjXU6K93UhdAmb z6awqs1TUWyyf5+HODs7IXE4ILaVNiR6yiulrsnZQPA2Cs4VFe4P2YuR77iDp+yrS+1OeqGvu8Krl BnCku453Ra0CjBKKZK1CzFEO/Gnob2DCK+EeXGDx7csB0yjWTY4gHpN2tDFXcYe/9ots=; Received: from [172.30.20.11] (helo=chekov.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) id 1eoAL4-0003WN-N6 for openvpn-devel@lists.sourceforge.net; Tue, 20 Feb 2018 16:00:19 +0000 Received: from chekov.greenie.muc.de (localhost [127.0.0.1]) by chekov.greenie.muc.de (8.15.2/8.15.2) with ESMTPS id w1KG0GUN069829 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 20 Feb 2018 17:00:16 +0100 (CET) (envelope-from gert@chekov.greenie.muc.de) Received: (from gert@localhost) by chekov.greenie.muc.de (8.15.2/8.15.2/Submit) id w1KG0G5D069828; Tue, 20 Feb 2018 17:00:16 +0100 (CET) (envelope-from gert) From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 20 Feb 2018 17:00:16 +0100 Message-Id: <20180220160016.69786-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.16.1 Subject: [Openvpn-devel] [PATCH] Fix removal of on-link prefix on windows with netsh X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gert@space.net MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox When adding / removing IPv6 routes, the host bits need to be zeroed or netsh.exe will refuse to handle the route. Commit a24dd2e31 changed the way this is done, breaking removal of the on-link IPv6 prefix for windows + netsh.exe. Fix by adding explicitly calling route_ipv6_clear_host_bits() from delete_route_connected_v6_net(). Signed-off-by: Gert Doering Acked-by: Selva Nair --- src/openvpn/route.c | 2 +- src/openvpn/route.h | 2 ++ src/openvpn/tun.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openvpn/route.c b/src/openvpn/route.c index ca8b182b..27b39c41 100644 --- a/src/openvpn/route.c +++ b/src/openvpn/route.c @@ -1820,7 +1820,7 @@ done: } -static void +void route_ipv6_clear_host_bits( struct route_ipv6 *r6 ) { /* clear host bit parts of route diff --git a/src/openvpn/route.h b/src/openvpn/route.h index 2c6f9f16..69420228 100644 --- a/src/openvpn/route.h +++ b/src/openvpn/route.h @@ -254,6 +254,8 @@ void copy_route_ipv6_option_list(struct route_ipv6_option_list *dest, const struct route_ipv6_option_list *src, struct gc_arena *a); +void route_ipv6_clear_host_bits( struct route_ipv6 *r6 ); + void add_route_ipv6(struct route_ipv6 *r, const struct tuntap *tt, unsigned int flags, const struct env_set *es); void delete_route_ipv6(const struct route_ipv6 *r, const struct tuntap *tt, unsigned int flags, const struct env_set *es); diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 253d884b..1399aa83 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -839,6 +839,7 @@ delete_route_connected_v6_net(struct tuntap *tt, r6.gateway = tt->local_ipv6; r6.metric = 0; /* connected route */ r6.flags = RT_DEFINED | RT_ADDED | RT_METRIC_DEFINED; + route_ipv6_clear_host_bits(&r6); delete_route_ipv6(&r6, tt, 0, es); } #endif /* if defined(_WIN32) || defined(TARGET_DARWIN) || defined(TARGET_NETBSD) || defined(TARGET_OPENBSD) */