]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-null.c
We should no longer need to use our own versions of system header files
[tcpdump] / print-null.c
index f5b032273a6e0e10e4ea08de26ff3c30c27077b8..8e43bb5dcba8c566590ab97405047cd2eddac2fc 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.26 1999-10-30 05:11:18 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.38 2000-10-07 05:53:13 itojun Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
 #endif
 
 #include <sys/param.h>
 #endif
 
 #include <sys/param.h>
@@ -30,32 +34,23 @@ static const char rcsid[] =
 #include <sys/file.h>
 #include <sys/ioctl.h>
 
 #include <sys/file.h>
 #include <sys/ioctl.h>
 
-#if __STDC__
 struct mbuf;
 struct rtentry;
 struct mbuf;
 struct rtentry;
-#endif
-#include <net/if.h>
 
 #include <netinet/in.h>
 
 #include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/if_ether.h>
-#include <netinet/ip_var.h>
-#include <netinet/udp.h>
-#include <netinet/udp_var.h>
-#include <netinet/tcp.h>
 
 #include <pcap.h>
 #include <stdio.h>
 #include <string.h>
 
 
 #include <pcap.h>
 #include <stdio.h>
 #include <string.h>
 
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
 #include "interface.h"
 #include "addrtoname.h"
 
 #include "interface.h"
 #include "addrtoname.h"
 
+#include "ip.h"
+#ifdef INET6
+#include "ip6.h"
+#endif
+
 #ifndef AF_NS
 #define AF_NS          6               /* XEROX NS protocols */
 #endif
 #ifndef AF_NS
 #define AF_NS          6               /* XEROX NS protocols */
 #endif
@@ -123,14 +118,19 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        if (eflag)
                null_print(p, ip, length);
 
        if (eflag)
                null_print(p, ip, length);
 
-#ifndef INET6
-       ip_print((const u_char *)ip, length);
-#else
-       if (ip->ip_v == IPVERSION)
+       switch (IP_V(ip)) {
+       case 4:
                ip_print((const u_char *)ip, length);
                ip_print((const u_char *)ip, length);
-       else if (ip->ip_v == 6)
+               break;
+#ifdef INET6
+       case 6:
                ip6_print((const u_char *)ip, length);
                ip6_print((const u_char *)ip, length);
-#endif /*INET6*/
+               break;
+#endif /* INET6 */
+       default:
+               printf("ip v%d", IP_V(ip));
+               break;
+       }
 
        if (xflag)
                default_print((const u_char *)ip, caplen - NULL_HDRLEN);
 
        if (xflag)
                default_print((const u_char *)ip, caplen - NULL_HDRLEN);