diff options
author | denny <denny@cvs.openbsd.org> | 1997-07-23 02:59:03 +0000 |
---|---|---|
committer | denny <denny@cvs.openbsd.org> | 1997-07-23 02:59:03 +0000 |
commit | 47bc1a39c8cd804b6ceb8356dcfbd54e55d5f65d (patch) | |
tree | 141498fed41f459c754682ece773b3ab0d62e8cf /usr.sbin/tcpdump/print-null.c | |
parent | 3bee95fea8a62e43f33a07f5aad7bc3a854d1410 (diff) |
Better handling for AppleTalk, and netatalk in particular.
Handle native Ethertalk phase 1 & 2 as well as the localtalk encapsulation a la Kinetics FastPath previously handled.
Diffstat (limited to 'usr.sbin/tcpdump/print-null.c')
-rw-r--r-- | usr.sbin/tcpdump/print-null.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/usr.sbin/tcpdump/print-null.c b/usr.sbin/tcpdump/print-null.c index 86d2f6f9a6a..f8abf41172c 100644 --- a/usr.sbin/tcpdump/print-null.c +++ b/usr.sbin/tcpdump/print-null.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-null.c,v 1.5 1996/12/12 16:22:30 bitblt Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-null.c,v 1.6 1997/07/23 02:59:02 denny Exp $ (LBL)"; #endif #include <sys/param.h> @@ -60,11 +60,8 @@ struct rtentry; #endif static void -null_print(const u_char *p, const struct ip *ip, u_int length) +null_print(const u_char *p, u_int length, u_int family) { - u_int family; - - memcpy((char *)&family, (char *)p, sizeof(family)); if (nflag) { /* XXX just dump the header */ @@ -91,7 +88,8 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) { u_int length = h->len; u_int caplen = h->caplen; - const struct ip *ip; + u_int family; + const u_char *pkt; ts_print(&h->ts); @@ -103,17 +101,25 @@ null_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) packetp = p; snapend = p + caplen; + pkt = p + NULL_HDRLEN; length -= NULL_HDRLEN; - ip = (struct ip *)(p + NULL_HDRLEN); + memcpy((char *)&family, (char *)p, sizeof(family)); if (eflag) - null_print(p, ip, length); + null_print(p, length, family); - ip_print((const u_char *)ip, length); + switch (family) { + case AF_INET: + ip_print(pkt, length); + break; + case AF_APPLETALK: + atalk_print(pkt, length); + break; + } if (xflag) - default_print((const u_char *)ip, caplen - NULL_HDRLEN); + default_print(pkt, caplen - NULL_HDRLEN); putchar('\n'); } |