]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-null.c
remove non-STDC code
[tcpdump] / print-null.c
index 13035720b1316f06ff6a103df7ec9d882c0c05c7..5c312e1594a53936bb403c33792987e583cfba00 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.25 1999-10-17 21:37:14 mcr Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.31 2000-07-01 03:39:07 assar Exp $ (LBL)";
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
 #endif
 
 #include <sys/param.h>
@@ -30,23 +34,27 @@ static const char rcsid[] =
 #include <sys/file.h>
 #include <sys/ioctl.h>
 
-#if __STDC__
 struct mbuf;
 struct rtentry;
-#endif
 #include <net/if.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>
 
+#ifdef INET6
+#include <netinet/ip6.h>
+#endif
+
 #include "interface.h"
 #include "addrtoname.h"
 
@@ -77,6 +85,12 @@ null_print(const u_char *p, const struct ip *ip, u_int length)
                printf("ip: ");
                break;
 
+#ifdef INET6
+       case AF_INET6:
+               printf("ip6: ");
+               break;
+#endif
+
        case AF_NS:
                printf("ns: ");
                break;
@@ -111,7 +125,19 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p)
        if (eflag)
                null_print(p, ip, length);
 
-       ip_print((const u_char *)ip, length);
+       switch (ip->ip_v) {
+       case 4:
+               ip_print((const u_char *)ip, length);
+               break;
+#ifdef INET6
+       case 6:
+               ip6_print((const u_char *)ip, length);
+               break;
+#endif /* INET6 */
+       default:
+               printf("ip v%d", ip->ip_v);
+               break;
+       }
 
        if (xflag)
                default_print((const u_char *)ip, caplen - NULL_HDRLEN);