Skip to content

Commit

Permalink
dns: prevent repeatedly overwriting resolved entries
Browse files Browse the repository at this point in the history
When a packet contains multiple conflicting names for the same address,
it would result in modification of the resolved name every time this DNS
packet is selected. In Qt, this causes a periodic (one second)
redissection of the current (DNS!) packet which interferes with user
interaction. To avoid this, only add the address on the first visit.

Bug: 13533
Change-Id: Ic71515131da4d666bfd589df9ff90a866a30778c
Reviewed-on: https://code.wireshark.org/review/20800
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
  • Loading branch information
Lekensteyn authored and AndersBroman committed Mar 31, 2017
1 parent fb97e82 commit 93cf590
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions epan/dissectors/packet-dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -1826,7 +1826,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
proto_item_append_text(trr, ", addr %s", addr);
proto_tree_add_item(rr_tree, hf_dns_a, tvb, cur_offset, 4, ENC_BIG_ENDIAN);

if (gbl_resolv_flags.dns_pkt_addr_resolution && (dns_class & 0x7f) == C_IN) {
if (gbl_resolv_flags.dns_pkt_addr_resolution && (dns_class & 0x7f) == C_IN &&
!PINFO_FD_VISITED(pinfo)) {
guint32 addr_int;
tvb_memcpy(tvb, &addr_int, cur_offset, sizeof(addr_int));
add_ipv4_name(addr_int, name);
Expand Down Expand Up @@ -2399,7 +2400,8 @@ dissect_dns_answer(tvbuff_t *tvb, int offsetx, int dns_data_offset,
proto_tree_add_item(rr_tree, hf_dns_aaaa, tvb, cur_offset, 16, ENC_NA);


if (gbl_resolv_flags.dns_pkt_addr_resolution && (dns_class & 0x7f) == C_IN) {
if (gbl_resolv_flags.dns_pkt_addr_resolution && (dns_class & 0x7f) == C_IN &&
!PINFO_FD_VISITED(pinfo)) {
struct e_in6_addr addr_in6;
tvb_memcpy(tvb, &addr_in6, cur_offset, sizeof(addr_in6));
add_ipv6_name(&addr_in6, name);
Expand Down

0 comments on commit 93cf590

Please sign in to comment.