diff options
author | Simon Rozman | 2018-12-19 21:26:11 +0100 |
---|---|---|
committer | Gert Doering | 2019-01-22 19:48:03 +0100 |
commit | 91bc1212b4b79ac9e2cbf6d345db5df716c42a5b (patch) | |
tree | 460c9b47a76f1162c5df79e3729651d441cc372e | |
parent | dcfc51457789d8a62ff8bd266dd3a3bf0a0c9763 (diff) | |
download | openvpn-91bc1212b4b79ac9e2cbf6d345db5df716c42a5b.zip openvpn-91bc1212b4b79ac9e2cbf6d345db5df716c42a5b.tar.gz |
Detect missing TAP driver and bail out gracefully
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 <gert@greenie.muc.de>
Message-Id: <20181219202611.2144-4-simon@rozman.si>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg18038.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
-rw-r--r-- | src/tapctl/tap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/tapctl/tap.c b/src/tapctl/tap.c index 790a495..ed3c6e0 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, |