capchild: Fix loading of extcap with no winpcap.dll
authorRoland Knall <rknall@gmail.com>
Fri, 21 Oct 2016 09:28:18 +0000 (11:28 +0200)
committerDario Lombardo <lomato@gmail.com>
Fri, 21 Oct 2016 11:55:26 +0000 (11:55 +0000)
If the loading of the physical interface list failed, no extcap
interfaces will be loaded as well. Fix that, so that we search for
the extcap interfaces, even when no other interfaces have been found

Change-Id: Ib8e86f1f8d2a1565724ef3532d41ecea3ceddb55
Reviewed-on: https://code.wireshark.org/review/18352
Reviewed-by: Roland Knall <rknall@gmail.com>
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
capchild/capture_ifinfo.c

index 8e4c59fa4ec650c44ce5ff1393d129cbe6d8f2f0..15991ac357fd2d09ca39ca1d19094280a6b1c5da 100644 (file)
@@ -111,16 +111,29 @@ capture_interface_list(int *err, char **err_str, void (*update_cb)(void))
     /* Try to get our interface list */
     ret = sync_interface_list_open(&data, &primary_msg, &secondary_msg, update_cb);
     if (ret != 0) {
-        g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List failed, error %d, %s (%s)!",
-              *err, primary_msg ? primary_msg : "no message",
-              secondary_msg ? secondary_msg : "no secondary message");
-        if (err_str) {
-            *err_str = primary_msg;
-        } else {
-            g_free(primary_msg);
+#ifdef HAVE_EXTCAP
+        /* Add the extcap interfaces that can exist, even if no native interfaces have been found */
+        g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Loading External Capture Interface List ...");
+        if_list = append_extcap_interface_list(if_list, err_str);
+        /* err_str is ignored, as the error for the interface loading list will take precedence */
+        if ( g_list_length(if_list) == 0 ) {
+#endif
+
+            g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_MESSAGE, "Capture Interface List failed, error %d, %s (%s)!",
+                  *err, primary_msg ? primary_msg : "no message",
+                  secondary_msg ? secondary_msg : "no secondary message");
+            if (err_str) {
+                *err_str = primary_msg;
+            } else {
+                g_free(primary_msg);
+            }
+            g_free(secondary_msg);
+            *err = CANT_GET_INTERFACE_LIST;
+
+#ifdef HAVE_EXTCAP
         }
-        g_free(secondary_msg);
-        *err = CANT_GET_INTERFACE_LIST;
+#endif
+
         return if_list;
     }