From patchwork Thu Jun 7 19:20:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 361 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net (Dovecot) with LMTP id m/wlLGoSGlu5YwAAIUCqbw for ; Fri, 08 Jun 2018 01:21:46 -0400 Received: from director3.mail.ord1c.rsapps.net ([172.28.255.1]) by director7.mail.ord1d.rsapps.net (Dovecot) with LMTP id K0LYK2oSGluXVAAAovjBpQ ; Fri, 08 Jun 2018 01:21:46 -0400 Received: from smtp14.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by director3.mail.ord1c.rsapps.net with LMTP id iM+pK2oSGltvJgAAdSFV8w ; Fri, 08 Jun 2018 01:21:46 -0400 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: smtp14.gate.ord1c.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=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: d5e71a66-6adb-11e8-a29e-bc305bf032e0-1-1 Received: from [216.105.38.7] ([216.105.38.7:26130] helo=lists.sourceforge.net) by smtp14.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id C2/0E-20626-9621A1B5; Fri, 08 Jun 2018 01:21:46 -0400 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 ) id 1fR9pe-0006sA-08; Fri, 08 Jun 2018 05:21:02 +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 ) id 1fR9pc-0006rd-Vj for openvpn-devel@lists.sourceforge.net; Fri, 08 Jun 2018 05:21:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=acAk3uJMNlLMqQYMSKzt9Ax6BTvWsEkABBp/MefVw4c=; b=cDecfPnEcXshbWlMXsj09Fixn1 zf4qSsgQWNET4h8HJHjHqlreC8p3sOErMP40ylo6TB9ayS0fhuZgrhv/UFkpMTwaHG1p4heAA88Xu 3+j64o3rO9yrAXXKc4kfZDTTCapdH6X+g14O2ggFEx9qHqUdh+a9T+y1+E9vw9pLqMyo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=acAk3uJMNlLMqQYMSKzt9Ax6BTvWsEkABBp/MefVw4c=; b=f+5/De2KVaznBUHSdYxjwA1QqJ /Lev9TTFXPuml2trCyXYDZvN1Uq7VVx3av+r2TJAtISFTmz4O/+AFOllvlnu0weKKTFf0MujpAzgE QJQwVhsLDyJEk9SFNyHlN7JwQWlOLIsVTgJyPFrwaiKbPTcKqu6d5hr217j8L+MsFvHA=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1fR9pb-00Gs1g-IZ for openvpn-devel@lists.sourceforge.net; Fri, 08 Jun 2018 05:21:00 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 8 Jun 2018 13:20:11 +0800 Message-Id: <20180608052017.6696-3-a@unstable.cc> In-Reply-To: <20180608052017.6696-1-a@unstable.cc> References: <20180608052017.6696-1-a@unstable.cc> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [5.148.176.60 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1fR9pb-00Gs1g-IZ Subject: [Openvpn-devel] [PATCH v2 2/8] windows: properly configure TAP driver when no IPv4 is configured 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: Antonio Quartulli MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Antonio Quartulli Signed-off-by: Antonio Quartulli --- src/openvpn/forward.c | 4 +++- src/openvpn/tun.c | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 7d9a338d..51e43c28 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -292,7 +292,9 @@ check_add_routes_action(struct context *c, const bool errors) void check_add_routes_dowork(struct context *c) { - if (test_routes(c->c1.route_list, c->c1.tuntap)) + /* skip route check if no IPv4 was configured */ + if (!c->c1.tuntap->did_ifconfig_setup + || test_routes(c->c1.route_list, c->c1.tuntap)) { check_add_routes_action(c, false); } diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 8509d489..d183aea7 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -5718,7 +5718,10 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun msg(M_FATAL, "ERROR: --dev tun also requires --ifconfig"); } - if (tt->topology == TOP_SUBNET) + /* send 0/0/0 to the TAP driver even if we have no IPv4 configured to + * ensure it is somehow initialized. + */ + if (!tt->did_ifconfig_setup || tt->topology == TOP_SUBNET) { in_addr_t ep[3]; BOOL status; @@ -5731,12 +5734,19 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun ep, sizeof(ep), ep, sizeof(ep), &len, NULL); - msg(status ? M_INFO : M_FATAL, "Set TAP-Windows TUN subnet mode network/local/netmask = %s/%s/%s [%s]", - print_in_addr_t(ep[1], IA_NET_ORDER, &gc), - print_in_addr_t(ep[0], IA_NET_ORDER, &gc), - print_in_addr_t(ep[2], IA_NET_ORDER, &gc), - status ? "SUCCEEDED" : "FAILED"); - + if (tt->did_ifconfig_setup) + { + msg(status ? M_INFO : M_FATAL, "Set TAP-Windows TUN subnet mode network/local/netmask = %s/%s/%s [%s]", + print_in_addr_t(ep[1], IA_NET_ORDER, &gc), + print_in_addr_t(ep[0], IA_NET_ORDER, &gc), + print_in_addr_t(ep[2], IA_NET_ORDER, &gc), + status ? "SUCCEEDED" : "FAILED"); + } + else + { + msg(status ? M_INFO : M_FATAL, "Set TAP-Windows TUN with fake IPv4 [%s]", + status ? "SUCCEEDED" : "FAILED"); + } } else {