diff options
Diffstat (limited to 'usr.sbin/tcpdump/print-sl.c')
-rw-r--r-- | usr.sbin/tcpdump/print-sl.c | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/print-sl.c b/usr.sbin/tcpdump/print-sl.c index 0e23388aa70..536204120c6 100644 --- a/usr.sbin/tcpdump/print-sl.c +++ b/usr.sbin/tcpdump/print-sl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1989, 1990, 1991, 1993, 1994, 1995, 1996 + * Copyright (c) 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-sl.c,v 1.7 1997/07/25 20:12:27 mickey Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/print-sl.c,v 1.8 1999/09/16 20:58:47 brad Exp $ (LBL)"; #endif #ifdef HAVE_NET_SLIP_H @@ -75,6 +75,8 @@ static void compressed_sl_print(const u_char *, const struct ip *, u_int, int); #define CHDR_LEN (SLC_BPFHDR - SLC_BPFHDRLEN) #endif +/* XXX needs more hacking to work right */ + void sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) { @@ -111,6 +113,45 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) putchar('\n'); } + +void +sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) +{ + register u_int caplen = h->caplen; + register u_int length = h->len; + register const struct ip *ip; + + ts_print(&h->ts); + + if (caplen < SLIP_HDRLEN) { + printf("[|slip]"); + goto out; + } + /* + * Some printers want to get back at the link level addresses, + * and/or check that they're not walking off the end of the packet. + * Rather than pass them all the way down, we set these globals. + */ + packetp = p; + snapend = p + caplen; + + length -= SLIP_HDRLEN; + + ip = (struct ip *)(p + SLIP_HDRLEN); + +#ifdef notdef + if (eflag) + sliplink_print(p, ip, length); +#endif + + ip_print((u_char *)ip, length); + + if (xflag) + default_print((u_char *)ip, caplen - SLIP_HDRLEN); + out: + putchar('\n'); +} + static void sliplink_print(register const u_char *p, register const struct ip *ip, register u_int length) @@ -247,6 +288,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip, #include <stdio.h> #include "interface.h" + void sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) { @@ -254,4 +296,12 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) error("not configured for slip"); /* NOTREACHED */ } + +void +sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) +{ + + error("not configured for slip"); + /* NOTREACHED */ +} #endif |