From: guy Date: Tue, 13 Feb 2007 19:19:27 +0000 (+0000) Subject: Only print (QU) and (QM) for mDNS queries. X-Git-Tag: tcpdump-3.9.7~33 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/ab7a689dc377c7a20a18d7ef0992d118e86ac6db Only print (QU) and (QM) for mDNS queries. Make the code a little clearer about what's done for DNS vs. what's done for mDNS. --- diff --git a/print-domain.c b/print-domain.c index b05bd3b2..5f90af27 100644 --- a/print-domain.c +++ b/print-domain.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.7 2007-01-15 11:15:54 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.8 2007-02-13 19:19:27 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -320,7 +320,7 @@ static const u_char * ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns) { register const u_char *np = cp; - register u_int i, class, qu; + register u_int i, class; cp = ns_nskip(cp); @@ -334,19 +334,18 @@ ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns) /* print the qclass (if it's not IN) */ i = EXTRACT_16BITS(cp); cp += 2; - if (is_mdns) { + if (is_mdns) class = (i & ~C_QU); - qu = (i & C_QU); - } else { + else class = i; - qu = 0; - } if (class != C_IN) printf(" %s", tok2str(ns_class2str, "(Class %d)", class)); - if (qu) - printf(" (QU)"); - else - printf(" (QM)"); + if (is_mdns) { + if (i & C_QU) + printf(" (QU)"); + else + printf(" (QM)"); + } fputs("? ", stdout); cp = ns_nprint(np, bp); @@ -357,7 +356,7 @@ ns_qprint(register const u_char *cp, register const u_char *bp, int is_mdns) static const u_char * ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns) { - register u_int i, class, cache_flush, opt_flags = 0; + register u_int i, class, opt_flags = 0; register u_short typ, len; register const u_char *rp; @@ -377,17 +376,16 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns) /* print the class (if it's not IN and the type isn't OPT) */ i = EXTRACT_16BITS(cp); cp += 2; - if (is_mdns) { + if (is_mdns) class = (i & ~C_CACHE_FLUSH); - cache_flush = i & C_CACHE_FLUSH; - } else { + else class = i; - cache_flush = 0; - } if (class != C_IN && typ != T_OPT) printf(" %s", tok2str(ns_class2str, "(Class %d)", class)); - if (cache_flush) - printf(" (Cache flush)"); + if (is_mdns) { + if (i & C_CACHE_FLUSH) + printf(" (Cache flush)"); + } /* ignore ttl */ cp += 2;