tap-win32: skip unexpected nodes during registry enumeration
authorAndrew Baumann <Andrew.Baumann@microsoft.com>
Wed, 18 Nov 2015 19:45:08 +0000 (11:45 -0800)
committerMunkyu Im <munkyu.im@samsung.com>
Tue, 22 Dec 2015 09:40:19 +0000 (18:40 +0900)
In order to find a named tap device, get_device_guid() enumerates children of
HKLM\SYSTEM\CCS\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}
(aka NETWORK_CONNECTIONS_KEY). For each child, it then looks for a
"Connection" subkey, but if this key doesn't exist, it aborts the
entire search. This was observed to fail on at least one Windows 10
machine, where there is an additional child of NETWORK_CONNECTIONS_KEY
(named "Descriptions"). Since registry enumeration doesn't guarantee
any particular sort order, we should continue to search for matching
children rather than aborting the search.

Change-Id: Ia8c77511da99abaf43e6f6ac079facf8110bce2e
Signed-off-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 3d4dc08a64939e60be5cb72dc5e35c2790975167)

net/tap-win32.c

index 5dc76008c7cd571c67bfe2fcd23dd6c8e7c83cb3..68200f8f2a1230f2fe81ca59ab064abb17332604 100644 (file)
@@ -356,7 +356,8 @@ static int get_device_guid(
                 &len);
 
             if (status != ERROR_SUCCESS || name_type != REG_SZ) {
-                    return -1;
+                ++i;
+                continue;
             }
             else {
                 if (is_tap_win32_dev(enum_name)) {