diff options
author | mlaier <mlaier@FreeBSD.org> | 2007-10-16 02:31:48 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2007-10-16 02:31:48 +0000 |
commit | 7407d685ab0d1977958bae143bdcc3b53dacea31 (patch) | |
tree | 8c8221dcf086879544da49d1342bacd303933fa6 /contrib/tcpdump/print-domain.c | |
parent | f0e5d335e38c264eb2fca7e15e417b70c8908f54 (diff) | |
download | FreeBSD-src-7407d685ab0d1977958bae143bdcc3b53dacea31.zip FreeBSD-src-7407d685ab0d1977958bae143bdcc3b53dacea31.tar.gz |
Resolve merge conflicts
Approved by: re (kensmith)
Obtained from: tcpdump.org
Diffstat (limited to 'contrib/tcpdump/print-domain.c')
-rw-r--r-- | contrib/tcpdump/print-domain.c | 66 |
1 files changed, 50 insertions, 16 deletions
diff --git a/contrib/tcpdump/print-domain.c b/contrib/tcpdump/print-domain.c index 08b5cea..827d1be 100644 --- a/contrib/tcpdump/print-domain.c +++ b/contrib/tcpdump/print-domain.c @@ -23,7 +23,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.89.2.1 2005/04/20 20:59:00 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 @@ -280,9 +280,20 @@ struct tok ns_type2str[] = { { T_SRV, "SRV" }, /* RFC 2782 */ { T_ATMA, "ATMA" }, /* ATM Forum */ { T_NAPTR, "NAPTR" }, /* RFC 2168, RFC 2915 */ + { T_KX, "KX" }, /* RFC 2230 */ + { T_CERT, "CERT" }, /* RFC 2538 */ { T_A6, "A6" }, /* RFC 2874 */ { T_DNAME, "DNAME" }, /* RFC 2672 */ + { T_SINK, "SINK" }, { T_OPT, "OPT" }, /* RFC 2671 */ + { T_APL, "APL" }, /* RFC 3123 */ + { T_DS, "DS" }, /* RFC 4034 */ + { T_SSHFP, "SSHFP" }, /* RFC 4255 */ + { T_IPSECKEY, "IPSECKEY" }, /* RFC 4025 */ + { T_RRSIG, "RRSIG" }, /* RFC 4034 */ + { T_NSEC, "NSEC" }, /* RFC 4034 */ + { T_DNSKEY, "DNSKEY" }, /* RFC 4034 */ + { T_SPF, "SPF" }, /* RFC-schlitt-spf-classic-02.txt */ { T_UINFO, "UINFO" }, { T_UID, "UID" }, { T_GID, "GID" }, @@ -311,23 +322,32 @@ 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; + register u_int i, class; cp = ns_nskip(cp); if (cp == NULL || !TTEST2(*cp, 4)) return(NULL); - /* print the qtype and qclass (if it's not IN) */ + /* print the qtype */ i = EXTRACT_16BITS(cp); cp += 2; printf(" %s", tok2str(ns_type2str, "Type%d", i)); + /* print the qclass (if it's not IN) */ i = EXTRACT_16BITS(cp); cp += 2; - if (is_mdns && i == (C_IN|C_CACHE_FLUSH)) - printf(" (Cache flush)"); - else if (i != C_IN) - printf(" %s", tok2str(ns_class2str, "(Class %d)", i)); + if (is_mdns) + class = (i & ~C_QU); + else + class = i; + if (class != C_IN) + printf(" %s", tok2str(ns_class2str, "(Class %d)", class)); + if (is_mdns) { + if (i & C_QU) + printf(" (QU)"); + else + printf(" (QM)"); + } fputs("? ", stdout); cp = ns_nprint(np, bp); @@ -338,7 +358,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 class; + register u_int i, class, opt_flags = 0; register u_short typ, len; register const u_char *rp; @@ -352,18 +372,30 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns) if (cp == NULL || !TTEST2(*cp, 10)) return (snapend); - /* print the type/qtype and class (if it's not IN) */ + /* print the type/qtype */ typ = EXTRACT_16BITS(cp); cp += 2; - class = EXTRACT_16BITS(cp); + /* print the class (if it's not IN and the type isn't OPT) */ + i = EXTRACT_16BITS(cp); cp += 2; - if (is_mdns && class == (C_IN|C_CACHE_FLUSH)) - printf(" (Cache flush)"); - else if (class != C_IN && typ != T_OPT) + if (is_mdns) + class = (i & ~C_CACHE_FLUSH); + else + class = i; + if (class != C_IN && typ != T_OPT) printf(" %s", tok2str(ns_class2str, "(Class %d)", class)); + if (is_mdns) { + if (i & C_CACHE_FLUSH) + printf(" (Cache flush)"); + } /* ignore ttl */ - cp += 4; + cp += 2; + /* if T_OPT, save opt_flags */ + if (typ == T_OPT) + opt_flags = EXTRACT_16BITS(cp); + /* ignore rest of ttl */ + cp += 2; len = EXTRACT_16BITS(cp); cp += 2; @@ -480,6 +512,8 @@ ns_rprint(register const u_char *cp, register const u_char *bp, int is_mdns) case T_OPT: printf(" UDPsize=%u", class); + if (opt_flags & 0x8000) + printf(" OK"); break; case T_UNSPECA: /* One long string */ @@ -542,7 +576,7 @@ ns_print(register const u_char *bp, u_int length, int is_mdns) if (DNS_QR(np)) { /* this is a response */ - printf(" %d%s%s%s%s%s%s", + printf("%d%s%s%s%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)], ns_resp[DNS_RCODE(np)], @@ -610,7 +644,7 @@ ns_print(register const u_char *bp, u_int length, int is_mdns) } else { /* this is a request */ - printf(" %d%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)], + printf("%d%s%s%s", EXTRACT_16BITS(&np->id), ns_ops[DNS_OPCODE(np)], DNS_RD(np) ? "+" : "", DNS_CD(np) ? "%" : ""); |