From patchwork Wed Dec 19 09:26:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Rozman X-Patchwork-Id: 648 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id WBwwM76pGlzTIAAAIUCqbw for ; Wed, 19 Dec 2018 15:27:42 -0500 Received: from proxy18.mail.iad3b.rsapps.net ([172.31.255.6]) by director11.mail.ord1d.rsapps.net with LMTP id iFIOML6pGlwbYAAAvGGmqA ; Wed, 19 Dec 2018 15:27:42 -0500 Received: from smtp34.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.iad3b.rsapps.net with LMTP id ANFzKb6pGlzgFwAA3NpJmQ ; Wed, 19 Dec 2018 15:27:42 -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: smtp34.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; 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: 882f90d4-03cc-11e9-869a-5254005e8ddb-1-1 Received: from [216.105.38.7] ([216.105.38.7:19215] helo=lists.sourceforge.net) by smtp34.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 0D/7D-32053-CB9AA1C5; Wed, 19 Dec 2018 15:27:41 -0500 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1gZiQW-0002dE-6b; Wed, 19 Dec 2018 20:26:44 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gZiQU-0002co-8M for openvpn-devel@lists.sourceforge.net; Wed, 19 Dec 2018 20:26:42 +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=SfxUsFHcHkihLMo5VSl56Kq6J2yvWsTxpsXIVtxQGpA=; b=XPKVUcPIW2S+QSOBLXwdwHsYZ9 I6XGsRgLKf2oEihfv1y/C/eOL9VF7Dn4jIo86tIpNahk7cYNTCbr86+oItBTLQDqM70DuWZhUilaN aVMukXrURRfQ5lrV5uS/k5uDjG+ylbyqLb2glNVQ0KAg1Pi3hkBkk6sALw4j4x/zKAf4=; 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=SfxUsFHcHkihLMo5VSl56Kq6J2yvWsTxpsXIVtxQGpA=; b=i8CDfYEhfa9hOSKZNfRm4yfeJf fjwppSaPSHspzyiIfc7PhUq9bqFZKL95PVya79YZNahYVvBKJ3HzlL0u/K2tiiewSN0kRFWQNEAdn fwQfSSk6PwpDoR4g1HnoiE9RcPzKUQNCTaSxV5gN4yfbO7veUZ0ARCC9NocMhc6e0RIo=; 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.90_1) id 1gZiQS-009K3t-35 for openvpn-devel@lists.sourceforge.net; Wed, 19 Dec 2018 20:26:42 +0000 Received: by pub5.amebis.si (Postfix, from userid 115) id 1A8E22064B; Wed, 19 Dec 2018 21:26:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=rozman.si; s=default; t=1545251190; bh=Va5e/WN+ctZzggBkZJkMaKxckZLYVqfFSy0MJzk1Mj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dt/glSAeCBOrVt/ASEHrickoyTNozis7j9a5jHFQKl8I5ljs59B0Ra//dDEUOd+Yy 7Noe3Jisb6Hp1Z3U4EzG2OCM8SKE4NiHtXthhojWgoeHs5XF57dBSVsixW/SKaXrQZ Tz/Q8PaC3BLfKjcORfkJOzTWGtCnnfADNey2oG4E= X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on brana.amebis.doma X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,RDNS_NONE autolearn=no autolearn_force=no version=3.4.2 Received: from gw0.selo.doma (unknown [213.250.22.160]) by pub5.amebis.si (Postfix) with ESMTP id 8EC50205E9; Wed, 19 Dec 2018 21:26:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=rozman.si; s=default; t=1545251187; bh=Va5e/WN+ctZzggBkZJkMaKxckZLYVqfFSy0MJzk1Mj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PxxcqnIqE4qYGLh0Tkf/cD5O8wxE/dvjGFXjup28ZPrH7LGWELFxlABTP6wDxxSNp gYfEWU0aSDl1BCq+kFllUq79omukbCDFKk4hMjlDfzLESgbyc0ujO4xVvhvntxFcn6 U8wbln8g7DBaKDNRPSbIezphGfX0ZKDvfCjrmLSk= Received: from s0.selo.doma (s0.selo.doma [IPv6:2a00:ee2:1206:8101::d]) by gw0.selo.doma (Postfix) with ESMTP id 4C78821B9829; Wed, 19 Dec 2018 21:26:27 +0100 (CET) From: Simon Rozman To: openvpn-devel@lists.sourceforge.net Date: Wed, 19 Dec 2018 21:26:11 +0100 Message-Id: <20181219202611.2144-4-simon@rozman.si> X-Mailer: git-send-email 2.19.0.windows.1 In-Reply-To: <20181219202611.2144-1-simon@rozman.si> References: <20181219202611.2144-1-simon@rozman.si> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -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 X-Headers-End: 1gZiQS-009K3t-35 Subject: [Openvpn-devel] [PATCH 4/4] Detect missing TAP driver and bail out gracefully 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 When no TUN/TAP driver is installed a interface cannot be created. This patch detects this condition and bails out with an error message. This also fixes a typo in one of the error messages. Acked-by: Gert Doering --- src/tapctl/tap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tapctl/tap.c b/src/tapctl/tap.c index 790a4956..ed3c6e0b 100644 --- a/src/tapctl/tap.c +++ b/src/tapctl/tap.c @@ -460,7 +460,7 @@ tap_create_interface( &devinfo_data)) { dwResult = GetLastError(); - msg(M_NONFATAL, "%s: SetupDiClassNameFromGuid failed", __FUNCTION__); + msg(M_NONFATAL, "%s: SetupDiCreateDeviceInfo failed", __FUNCTION__); goto cleanup_hDevInfoList; } @@ -596,6 +596,13 @@ tap_create_interface( free(drvinfo_detail_data); } + if (dwlDriverVersion == 0) + { + dwResult = ERROR_NOT_FOUND; + msg(M_NONFATAL, "%s: No driver for device \"%" PRIsLPTSTR "\" installed.", __FUNCTION__, szzHardwareIDs); + goto cleanup_DriverInfoList; + } + /* Call appropriate class installer. */ if (!SetupDiCallClassInstaller( DIF_REGISTERDEVICE,