From b217c8fea14731ea638e8312c78d02d7900752fa Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 11 May 2018 12:14:27 +0200 Subject: cli: make "-z host,ipv4" filter actually work Respect the "ipv4" and "ipv6" filters and actually restrict the output. Change-Id: I06ee62ee2c85cb45fb33a52e86ce3698452d175f Fixes: v1.11.0-rc1-2592-ge3cccd17f4 ("Get rid of some users the addrinfo_list.") Reviewed-on: https://code.wireshark.org/review/27452 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- ui/cli/tap-hosts.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'ui') diff --git a/ui/cli/tap-hosts.c b/ui/cli/tap-hosts.c index e3a1bc548c..398ecf9029 100644 --- a/ui/cli/tap-hosts.c +++ b/ui/cli/tap-hosts.c @@ -23,8 +23,8 @@ void register_tap_listener_hosts(void); -gboolean dump_v4 = FALSE; -gboolean dump_v6 = FALSE; +static gboolean dump_v4 = FALSE; +static gboolean dump_v6 = FALSE; #define TAP_NAME "hosts" @@ -64,14 +64,18 @@ hosts_draw(void *dummy _U_) printf("# Host data gathered from %s\n", cfile.filename); printf("\n"); - ipv4_hash_table = get_ipv4_hash_table(); - if (ipv4_hash_table) { - wmem_map_foreach( ipv4_hash_table, ipv4_hash_table_print_resolved, NULL); + if (dump_v4) { + ipv4_hash_table = get_ipv4_hash_table(); + if (ipv4_hash_table) { + wmem_map_foreach( ipv4_hash_table, ipv4_hash_table_print_resolved, NULL); + } } - ipv6_hash_table = get_ipv6_hash_table(); - if (ipv6_hash_table) { - wmem_map_foreach( ipv6_hash_table, ipv6_hash_table_print_resolved, NULL); + if (dump_v6) { + ipv6_hash_table = get_ipv6_hash_table(); + if (ipv6_hash_table) { + wmem_map_foreach( ipv6_hash_table, ipv6_hash_table_print_resolved, NULL); + } } } -- cgit v1.2.3