diff options
author | Dario Lombardo <lomato@gmail.com> | 2015-11-24 10:20:10 +0100 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-11-24 13:06:20 +0000 |
commit | 4df75d7eaef4fbae1e481ec5f87d01e97d15f19b (patch) | |
tree | c46088bcd3b3131232ad288254b27b4a1136c041 | |
parent | 46f3fe48a3bf1b5ea341544e2abd49910cacaa6e (diff) |
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 <pascal.quantin@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r-- | extcap/sshdump.c | 15 |
1 files changed, 7 insertions, 8 deletions
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 " |