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 <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2018-05-11 12:14:27 +02:00 committed by Anders Broman
parent 03a8e01cfc
commit b217c8fea1
1 changed files with 12 additions and 8 deletions

View File

@ -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);
}
}
}