From 03014afd0377fb8957d9c87572c96a6096b14d45 Mon Sep 17 00:00:00 2001 From: fenner Date: Tue, 15 Sep 1998 19:46:59 +0000 Subject: Merge tcpdump 3.4 PR: bin/7877 --- contrib/tcpdump/print-sl.c | 55 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) (limited to 'contrib/tcpdump/print-sl.c') diff --git a/contrib/tcpdump/print-sl.c b/contrib/tcpdump/print-sl.c index 0c6cd8d..7e52352 100644 --- a/contrib/tcpdump/print-sl.c +++ b/contrib/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: print-sl.c,v 1.41 96/12/10 23:19:42 leres Exp $ (LBL)"; + "@(#) $Header: print-sl.c,v 1.42 97/06/12 14:21:35 leres Exp $ (LBL)"; #endif #ifdef HAVE_NET_SLIP_H @@ -54,7 +54,6 @@ struct rtentry; #include #include #include -#include #include #include "interface.h" @@ -75,6 +74,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 +112,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 +287,7 @@ compressed_sl_print(const u_char *chdr, const struct ip *ip, #include #include "interface.h" + void sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) { @@ -254,4 +295,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 -- cgit v1.1