From 67bfdf28714a5945a78aef9d745d88fd69972578 Mon Sep 17 00:00:00 2001 From: Roland Knall Date: Fri, 21 Oct 2016 11:28:18 +0200 Subject: capchild: Fix loading of extcap with no winpcap.dll 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 Petri-Dish: Anders Broman Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo --- capchild/capture_ifinfo.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'capchild/capture_ifinfo.c') diff --git a/capchild/capture_ifinfo.c b/capchild/capture_ifinfo.c index 8e4c59fa4e..15991ac357 100644 --- a/capchild/capture_ifinfo.c +++ b/capchild/capture_ifinfo.c @@ -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; } -- cgit v1.2.1