diff --git a/packet-dns.c b/packet-dns.c index ef78dce462..0e03e204b3 100644 --- a/packet-dns.c +++ b/packet-dns.c @@ -1,7 +1,7 @@ /* packet-dns.c * Routines for DNS packet disassembly * - * $Id: packet-dns.c,v 1.49 2000/08/07 03:20:28 guy Exp $ + * $Id: packet-dns.c,v 1.50 2000/08/08 16:21:23 deniel Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -737,6 +737,11 @@ dissect_dns_answer(const u_char *pd, int offset, int dns_data_offset, proto_tree_add_text(rr_tree, NullTVB, cur_offset, 4, "Addr: %s", ip_to_str((guint8 *)dptr)); } + if (class == 1) { + guint32 addr; + memcpy(&addr, dptr, sizeof(addr)); + add_host_name(addr, name); + } break; case T_NS: diff --git a/resolv.c b/resolv.c index 97798b5196..f17327bdda 100644 --- a/resolv.c +++ b/resolv.c @@ -1,7 +1,7 @@ /* resolv.c * Routines for network object lookup * - * $Id: resolv.c,v 1.24 2000/07/14 07:11:53 guy Exp $ + * $Id: resolv.c,v 1.25 2000/08/08 16:21:24 deniel Exp $ * * Laurent Deniel * @@ -1038,6 +1038,10 @@ extern void add_host_name(u_int addr, u_char *name) (hashname_t *)g_malloc(sizeof(hashname_t)); } else { while(1) { + if (tp->addr == addr && strcmp(tp->name, name) == 0) { + /* address already known */ + return; + } if (tp->next == NULL) { tp->next = (hashname_t *)g_malloc(sizeof(hashname_t)); tp = tp->next;