From 4df75d7eaef4fbae1e481ec5f87d01e97d15f19b Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Tue, 24 Nov 2015 10:20:10 +0100 Subject: sshdump: add default filter even when interfaces are not listed. Change-Id: I7fc6157a4ef0fff9b94f2ee222379f8d6d2962a9 Reviewed-on: https://code.wireshark.org/review/12090 Petri-Dish: Pascal Quantin Reviewed-by: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin --- extcap/sshdump.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'extcap/sshdump.c') diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 012366114c..2a954358b6 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -458,16 +458,16 @@ static int list_dlts(const char *interface) static char* local_interfaces_to_filter(unsigned int remote_port) { + char* filter = NULL; #ifdef USE_GETIFADDRS struct ifaddrs* ifap; struct ifaddrs* ifa; GString* interfaces; - char* filter = NULL; int family; char ip[INET6_ADDRSTRLEN]; if (getifaddrs(&ifap)) { - return NULL; + goto end; } interfaces = g_string_new(NULL); @@ -513,12 +513,13 @@ static char* local_interfaces_to_filter(unsigned int remote_port) if (interfaces->len) filter = g_strdup_printf("not ((%s) and port %u)", interfaces->str, remote_port); - g_string_free(interfaces, TRUE); - return filter; -#else - return NULL; + g_string_free(interfaces, TRUE); +end: #endif + if (!filter) + filter = g_strdup_printf("not port %u", remote_port); + return filter; } static int list_config(char *interface, unsigned int remote_port) @@ -537,8 +538,6 @@ static int list_config(char *interface, unsigned int remote_port) } ipfilter = local_interfaces_to_filter(remote_port); - if (!ipfilter) - return EXIT_FAILURE; g_print("arg {number=%u}{call=--remote-host}{display=Remote SSH server address}" "{type=string}{tooltip=The remote SSH host. It can be both " -- cgit v1.2.3