X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/9489d3564732e279398e98500ab77d9cd3ab7f18..f5c79aedbe9c52dad10a196d805718f55a2be17a:/print-domain.c diff --git a/print-domain.c b/print-domain.c index 404ee479..98eb3a5e 100644 --- a/print-domain.c +++ b/print-domain.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.43 2000-04-17 06:49:27 itojun Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.55 2000-10-10 05:05:07 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -30,22 +30,8 @@ static const char rcsid[] = #include #include -#include - -#if __STDC__ -struct mbuf; -struct rtentry; -#endif -#include #include -#include -#include -#include -#include -#include -#include -#include #ifdef NOERROR #undef NOERROR /* Solaris sucks */ @@ -53,7 +39,7 @@ struct rtentry; #ifdef NOERROR #undef T_UNSPEC /* SINIX does too */ #endif -#include +#include "nameser.h" #include #include @@ -201,7 +187,7 @@ ns_nprint(register const u_char *cp, register const u_char *bp) * which means we're looping. */ if (chars_processed >= data_size) { - fn_printn(cp, 6, ""); + fn_printn(cp, 6, (u_char *)""); if (!compress) rp += i + 1; return (rp); @@ -426,15 +412,17 @@ ns_print(register const u_char *bp, u_int length) nscount = ntohs(np->nscount); arcount = ntohs(np->arcount); - if (np->qr) { + if (DNS_QR(np)) { /* this is a response */ - printf(" %d%s%s%s%s%s", + printf(" %d%s%s%s%s%s%s", ntohs(np->id), - ns_ops[np->opcode], - ns_resp[np->rcode], - np->aa? "*" : "", - np->ra? "" : "-", - np->tc? "|" : ""); + ns_ops[DNS_OPCODE(np)], + ns_resp[DNS_RCODE(np)], + DNS_AA(np)? "*" : "", + DNS_RA(np)? "" : "-", + DNS_TC(np)? "|" : "", + DNS_CD(np)? "%" : ""); + if (qdcount != 1) printf(" [%dq]", qdcount); /* Print QUESTION section on -vv */ @@ -454,16 +442,17 @@ ns_print(register const u_char *bp, u_int length) } else { /* this is a request */ - printf(" %d%s%s", + printf(" %d%s%s%s", ntohs(np->id), - ns_ops[np->opcode], - np->rd? "+" : ""); + ns_ops[DNS_OPCODE(np)], + DNS_RD(np)? "+" : "", + DNS_AD(np)? "$" : ""); /* any weirdness? */ - if (*(((u_short *)np)+1) & htons(0x6ff)) + if (*(((u_short *)np)+1) & htons(0x6cf)) printf(" [b2&3=0x%x]", ntohs(*(((u_short *)np)+1))); - if (np->opcode == IQUERY) { + if (DNS_OPCODE(np) == IQUERY) { if (qdcount) printf(" [%dq]", qdcount); if (ancount != 1)