From patchwork Wed Jan 8 00:52:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Rozman X-Patchwork-Id: 963 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id UOsKGdrCFV7HLQAAIUCqbw for ; Wed, 08 Jan 2020 06:54:02 -0500 Received: from proxy3.mail.iad3b.rsapps.net ([172.31.255.6]) by director8.mail.ord1d.rsapps.net with LMTP id MEQWFtrCFV5aQQAAfY0hYg ; Wed, 08 Jan 2020 06:54:02 -0500 Received: from smtp20.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.iad3b.rsapps.net with LMTP id 0BdKD9rCFV6WfQAAM8Wetg ; Wed, 08 Jan 2020 06:54:02 -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: smtp20.gate.iad3b.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=rozman.si; dmarc=fail (p=none; dis=none) header.from=rozman.si X-Suspicious-Flag: YES X-Classification-ID: 8f44d06c-320d-11ea-afd7-525400497f28-1-1 Received: from [216.105.38.7] ([216.105.38.7:52166] helo=lists.sourceforge.net) by smtp20.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 3C/93-30218-9D2C51E5; Wed, 08 Jan 2020 06:54:01 -0500 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1ip9tO-0001vS-Ju; Wed, 08 Jan 2020 11:52:54 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ip9tN-0001vK-9e for openvpn-devel@lists.sourceforge.net; Wed, 08 Jan 2020 11:52:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: 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=Ch7qNSHRXemr7kBUvTgnvzJ/Zp8UGV/cMWp7wwkM9eE=; b=NMcCPuZYkPvzzGJZ+d5Szn5hDN 9DXTaTBgdfBzrglW5n2iGYRxsMfI5TeQdWesLwYLuYerE4istm1loSKigWeD+NPpIQxaLsN7T642A ZydCVn54rU3pddLQcjiX+Qa1LjmOl4+LXen9uYd47Y2eVyef+RKa3p3WfP2G1TPUDfqo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=Ch7qNSHRXemr7kBUvTgnvzJ/Zp8UGV/cMWp7wwkM9eE=; b=Ar4eEAA1hfXaCalezPlNhaFNiL cnLcsiy7wuMdzuziPu6V6gfetXlN0jPaNZnxV51kIU7B53bY/QR/3gDCmXj9XBpitODCU5mOYJzEx fntLnUOyub5+9GtzHx1mtEhZuIq3nDuSQpIYtME3xyjh57EuKY/wmrkiCpc0Pp4Y1LVA=; Received: from pub5.amebis.si ([213.250.55.21]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1ip9tD-00DFqw-Ev for openvpn-devel@lists.sourceforge.net; Wed, 08 Jan 2020 11:52:53 +0000 Received: by pub5.amebis.si (Postfix, from userid 1000) id C892A1002FB9; Wed, 8 Jan 2020 12:52:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rozman.si; s=default; t=1578484349; bh=Ch7qNSHRXemr7kBUvTgnvzJ/Zp8UGV/cMWp7wwkM9eE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BafjYxnk9ftblyZPIg6ogjwwoO8uEoq/er71DE86KZYWNUOfjAu58awdh33Hi+dxw fHHGHcBjM1yOjCGGRvNUOhw2TeI7MwjzqTpQfOH5+4XjcPYK1LwRMCIf+o300R/vXh 3eKEmKpJ4G04jh0eRK8nO7m61UvJ9BHfaFJTJc/A= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on brana.amebis.doma X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from SR6.amebis.doma (unknown [IPv6:2a00:ee2:209:164:6498:a1b6:dbd5:6200]) by pub5.amebis.si (Postfix) with ESMTP id B2F431002FB8; Wed, 8 Jan 2020 12:52:26 +0100 (CET) From: Simon Rozman To: openvpn-devel@lists.sourceforge.net Date: Wed, 8 Jan 2020 12:52:24 +0100 Message-Id: <20200108115224.38-1-simon@rozman.si> X-Mailer: git-send-email 2.24.1.windows.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rozman.si] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an 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 X-Headers-End: 1ip9tD-00DFqw-Ev Subject: [Openvpn-devel] [PATCH v3 6/7] wintun: stop sending TAP-Windows6 ioctls to NDIS device 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Wintun doesn't have its own I/O device. Rather, it taps on existing Windows-provided NDIS device. Sending TAP-Windows6 IOCTL requests to it is risky, as TAP-Windows6 is using one of the well-known device types (FILE_DEVICE_UNKNOWN) with function IDs as 1, 2, 3 etc. raising a chance of collision as NDIS might react to one of these IOCTLs. Signed-off-by: Simon Rozman Acked-by: Lev Stipakov --- src/openvpn/error.c | 5 ++++- src/openvpn/sig.c | 7 +++++-- src/openvpn/tun.c | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/openvpn/error.c b/src/openvpn/error.c index b2492f2b..ad4f0ef4 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -688,7 +688,10 @@ x_check_status(int status, } #elif defined(_WIN32) /* get possible driver error from TAP-Windows driver */ - extended_msg = tap_win_getinfo(tt, &gc); + if (tuntap_defined(tt)) + { + extended_msg = tap_win_getinfo(tt, &gc); + } #endif if (!ignore_sys_error(my_errno)) { diff --git a/src/openvpn/sig.c b/src/openvpn/sig.c index d7f2abb8..6e3379fe 100644 --- a/src/openvpn/sig.c +++ b/src/openvpn/sig.c @@ -317,8 +317,11 @@ print_status(const struct context *c, struct status_output *so) #ifdef _WIN32 if (tuntap_defined(c->c1.tuntap)) { - status_printf(so, "TAP-WIN32 driver status,\"%s\"", - tap_win_getinfo(c->c1.tuntap, &gc)); + const char *extended_msg = tap_win_getinfo(c->c1.tuntap, &gc); + if (extended_msg) + { + status_printf(so, "TAP-WIN32 driver status,\"%s\"", extended_msg); + } } #endif diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 30fb78b2..e36c49b1 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -6411,7 +6411,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun const char * tap_win_getinfo(const struct tuntap *tt, struct gc_arena *gc) { - if (tt && tt->hand != NULL) + if (!tt->wintun) { struct buffer out = alloc_buf_gc(256, gc); DWORD len; @@ -6429,7 +6429,7 @@ tap_win_getinfo(const struct tuntap *tt, struct gc_arena *gc) void tun_show_debug(struct tuntap *tt) { - if (tt && tt->hand != NULL) + if (!tt->wintun) { struct buffer out = alloc_buf(1024); DWORD len;