]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-domain.c
Allow tcpdump to work with earlier libpcaps.
[tcpdump] / print-domain.c
index 738224070a8b3cc6883aa280470f8d9f73c771cf..98eb3a5e313dc249133bcc4a30966b85faf49fbb 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-domain.c,v 1.48 2000-09-23 08:26:32 guy 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,16 +30,8 @@ static const char rcsid[] =
 
 #include <sys/param.h>
 #include <sys/time.h>
-#include <sys/socket.h>
-
-struct mbuf;
-struct rtentry;
-#include <net/if.h>
 
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/ip_var.h>
 
 #ifdef NOERROR
 #undef NOERROR                                 /* Solaris sucks */
@@ -195,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, "<LOOP>");
+                                       fn_printn(cp, 6, (u_char *)"<LOOP>");
                                        if (!compress)
                                                rp += i + 1;
                                        return (rp);
@@ -420,16 +412,16 @@ 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%s",
                        ntohs(np->id),
-                       ns_ops[np->opcode],
-                       ns_resp[np->rcode],
-                       np->aa? "*" : "",
-                       np->ra? "" : "-",
-                       np->tc? "|" : "",
-                       np->cd? "%" : "");
+                       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);
@@ -452,15 +444,15 @@ ns_print(register const u_char *bp, u_int length)
                /* this is a request */
                printf(" %d%s%s%s",
                        ntohs(np->id),
-                       ns_ops[np->opcode],
-                       np->rd? "+" : "",
-                       np->ad? "$" : "");
+                       ns_ops[DNS_OPCODE(np)],
+                       DNS_RD(np)? "+" : "",
+                       DNS_AD(np)? "$" : "");
 
                /* any weirdness? */
                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)