X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/e521675238439368061c88834321998abc253815..309ca62193772fd8ba532fd413b51a61be0c741e:/print-sl.c?ds=inline diff --git a/print-sl.c b/print-sl.c index d4f7edd7..91dbaadc 100644 --- a/print-sl.c +++ b/print-sl.c @@ -20,21 +20,16 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.56 2000-10-10 05:06:10 guy Exp $ (LBL)"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-sl.c,v 1.65 2005-04-06 21:32:42 mcr Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include -#include +#include -#include - -#include -#include #include #include @@ -53,26 +48,17 @@ static u_int lastconn = 255; static void sliplink_print(const u_char *, const struct ip *, u_int); static void compressed_sl_print(const u_char *, const struct ip *, u_int, int); -void -sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) +u_int +sl_if_print(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; + return (caplen); } - /* - * 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; @@ -83,44 +69,31 @@ sl_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) switch (IP_V(ip)) { case 4: - ip_print((u_char *)ip, length); + ip_print(gndo, (u_char *)ip, length); break; #ifdef INET6 case 6: - ip6_print((u_char *)ip, length); + ip6_print(gndo, (u_char *)ip, length); break; #endif default: printf ("ip v%d", IP_V(ip)); } - if (xflag) - default_print((u_char *)ip, caplen - SLIP_HDRLEN); - out: - putchar('\n'); + return (SLIP_HDRLEN); } - -void -sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) +u_int +sl_bsdos_if_print(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; + return (caplen); } - /* - * 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; @@ -131,12 +104,9 @@ sl_bsdos_if_print(u_char *user, const struct pcap_pkthdr *h, const u_char *p) sliplink_print(p, ip, length); #endif - ip_print((u_char *)ip, length); + ip_print(gndo, (u_char *)ip, length); - if (xflag) - default_print((u_char *)ip, caplen - SLIP_HDRLEN); - out: - putchar('\n'); + return (SLIP_HDRLEN); } static void