]> The Tcpdump Group git mirrors - tcpdump/commitdiff
If "-n" is specified along with "-e", print the address family value as
authorguy <guy>
Mon, 4 Dec 2000 06:47:17 +0000 (06:47 +0000)
committerguy <guy>
Mon, 4 Dec 2000 06:47:17 +0000 (06:47 +0000)
"AF <n>" for DLT_NULL captures.

Print the packet length for DLT_NULL captures when "-e" is specified
(somebody complained on "freebsd-isp" about the lack of any packet
length from tcpdump when capturing traffic on a "tunX" device).

Make sure we always print the packet length on PPP when "-e" is
specified (the person in question also complained that the packet length
disappeared between FreeBSD 2.2.8 and FreeBSD 3.4, which was the result
of a new "print-ppp.c" that didn't print the length).

print-null.c
print-ppp.c

index 8e43bb5dcba8c566590ab97405047cd2eddac2fc..a4b4085e0b31c7589bd2832ba379be8eb95c8037 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.38 2000-10-07 05:53:13 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-null.c,v 1.39 2000-12-04 06:47:17 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -68,30 +68,31 @@ null_print(const u_char *p, const struct ip *ip, u_int length)
 
        memcpy((char *)&family, (char *)p, sizeof(family));
 
-       if (nflag) {
-               /* XXX just dump the header */
-               return;
-       }
-       switch (family) {
+       if (nflag)
+               printf("AF %d ", family);
+       else {
+               switch (family) {
 
-       case AF_INET:
-               printf("ip: ");
-               break;
+               case AF_INET:
+                       printf("ip ");
+                       break;
 
 #ifdef INET6
-       case AF_INET6:
-               printf("ip6: ");
-               break;
+               case AF_INET6:
+                       printf("ip6 ");
+                       break;
 #endif
 
-       case AF_NS:
-               printf("ns: ");
-               break;
+               case AF_NS:
+                       printf("ns ");
+                       break;
 
-       default:
-               printf("AF %d: ", family);
-               break;
+               default:
+                       printf("AF %d ", family);
+                       break;
+               }
        }
+       printf("%d: ", length);
 }
 
 void
index bd283fe10cd0a82686f87b36272da46dbd72534c..8ba6710bb7e55334d1ca3e95b41c059731e7b079 100644 (file)
@@ -31,7 +31,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.56 2000-11-08 09:41:39 itojun Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ppp.c,v 1.57 2000-12-04 06:47:18 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -988,6 +988,7 @@ void
 ppp_print(register const u_char *p, u_int length)
 {
        u_int proto;
+       u_int full_length = length;
 
        /*
         * Here, we assume that p points to the Address and Control
@@ -1012,7 +1013,7 @@ ppp_print(register const u_char *p, u_int length)
                length -= 2;
        }
 
-       printf("%s: ", ppp_protoname(proto));
+       printf("%s %d: ", ppp_protoname(proto), full_length);
 
        handle_ppp(proto, p, length);
        return;
@@ -1296,9 +1297,9 @@ ppp_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h,
                                printf("] ");
                        }
                }
-               if (eflag)
-                       printf("%d ", length);
        }
+       if (eflag)
+               printf("%d ", length);
        if (p[SLC_CHL]) {
                q = p + SLC_BPFHDRLEN + p[SLC_LLHL];