diff options
author | guy <guy> | 2000-12-04 06:47:17 +0000 |
---|---|---|
committer | guy <guy> | 2000-12-04 06:47:17 +0000 |
commit | 4c76b828529c59ccb0eaf3d67e594f298b26900c (patch) | |
tree | b69b23b311134a409462a3113602e6d074a42bd6 /print-null.c | |
parent | f3e835f6becdf79b23e3b75f1e485d7daee25fcc (diff) | |
download | tcpdump-4c76b828529c59ccb0eaf3d67e594f298b26900c.tar.gz |
If "-n" is specified along with "-e", print the address family value as
"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).
Diffstat (limited to 'print-null.c')
-rw-r--r-- | print-null.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/print-null.c b/print-null.c index 8e43bb5d..a4b4085e 100644 --- a/print-null.c +++ b/print-null.c @@ -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 |