diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2016-01-18 15:00:29 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2016-02-06 10:14:56 +0000 |
commit | 445d78282f436330954fbe1e93e753ec2336425c (patch) | |
tree | 424c0506067d804388782c5ec5536e744254832c | |
parent | 485af0aa41c70e95c274adc858e847d87a52dbfd (diff) |
Add ARP protocol preference to register MAC to IP bindings for name resolution
Applies to the resolve Physical Addresses to names preference.
Change-Id: Ib1f484afc940eb6a022e03a1766c18449b2dfed3
Reviewed-on: https://code.wireshark.org/review/13400
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
-rw-r--r-- | epan/dissectors/packet-arp.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c index 5253499e1b..242b85db1b 100644 --- a/epan/dissectors/packet-arp.c +++ b/epan/dissectors/packet-arp.c @@ -115,6 +115,7 @@ static guint32 global_arp_detect_request_storm_packets = 30; static guint32 global_arp_detect_request_storm_period = 100; static gboolean global_arp_detect_duplicate_ip_addresses = TRUE; +static gboolean global_arp_register_network_address_binding = TRUE; static guint32 arp_request_count = 0; static nstime_t time_at_start_of_count; @@ -1496,7 +1497,10 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) mac = tvb_get_ptr(tvb, sha_offset, 6); if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0) { - add_ether_byip(ip, mac); + if (global_arp_register_network_address_binding) + { + add_ether_byip(ip, mac); + } if (global_arp_detect_duplicate_ip_addresses) { duplicate_detected = @@ -1518,7 +1522,10 @@ dissect_arp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) if ((mac[0] & 0x01) == 0 && memcmp(mac, mac_allzero, 6) != 0 && ip != 0 && ar_op != ARPOP_REQUEST) { - add_ether_byip(ip, mac); + if (global_arp_register_network_address_binding) + { + add_ether_byip(ip, mac); + } /* If Gratuitous, don't report duplicate for same IP address twice */ if (global_arp_detect_duplicate_ip_addresses && (duplicate_ip!=ip)) { @@ -2007,6 +2014,11 @@ proto_register_arp(void) "Attempt to detect duplicate use of IP addresses", &global_arp_detect_duplicate_ip_addresses); + prefs_register_bool_preference(arp_module, "register_network_address_binding", + "Register network address mappings", + "Try to resolve physical addresses to host names from ARP requests/responses", + &global_arp_register_network_address_binding); + /* TODO: define a minimum time between sightings that is worth reporting? */ register_init_routine(&arp_init_protocol); |