X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/d438b56d99f7c1169df3f99dd58ce65f6a23795f..ffa1470e5c7ff0e50028d085a481dc797b0b51ed:/print-ipfc.c?ds=sidebyside diff --git a/print-ipfc.c b/print-ipfc.c index bcad6c39..7e1e8d81 100644 --- a/print-ipfc.c +++ b/print-ipfc.c @@ -20,8 +20,8 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.1 2002-10-18 09:17:48 guy Exp $ (LBL)"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-ipfc.c,v 1.7.2.2 2005-11-13 12:12:59 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -92,19 +92,6 @@ ipfc_print(const u_char *p, u_int length, u_int caplen) * Get the network addresses into a canonical form */ extract_ipfc_addrs(ipfcp, (char *)ESRC(&ehdr), (char *)EDST(&ehdr)); - /* - * 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. - */ - snapend = p + caplen; - /* - * Actually, the only printers that use packetp are print-arp.c - * and print-bootp.c, and they assume that packetp points to an - * Ethernet header. The right thing to do is to fix them to know - * which link type is in use when they excavate. XXX - */ - packetp = (u_char *)&ehdr; if (eflag) ipfc_hdr_print(ipfcp, length, ESRC(&ehdr), EDST(&ehdr)); @@ -114,8 +101,6 @@ ipfc_print(const u_char *p, u_int length, u_int caplen) p += IPFC_HDRLEN; caplen -= IPFC_HDRLEN; - /* Frame Control field determines interpretation of packet */ - extracted_ethertype = 0; /* Try to print the LLC-layer header & higher layers */ if (llc_print(p, length, caplen, ESRC(&ehdr), EDST(&ehdr), &extracted_ethertype) == 0) { @@ -130,39 +115,21 @@ ipfc_print(const u_char *p, u_int length, u_int caplen) printf("(LLC %s) ", etherproto_string(htons(extracted_ethertype))); } - if (!xflag && !qflag) + if (!suppress_default_print) default_print(p, caplen); } } /* - * This is the top level routine of the printer. 'sp' is the points - * to the Network_Header of the packet, 'tvp' is the timestamp, - * 'length' is the length of the packet off the wire, and 'caplen' + * This is the top level routine of the printer. 'p' points + * to the Network_Header of the packet, 'h->ts' is the timestamp, + * 'h->len' is the length of the packet off the wire, and 'h->caplen' * is the number of bytes actually captured. */ -void -ipfc_if_print(u_char *pcap _U_, const struct pcap_pkthdr *h, - register const u_char *p) +u_int +ipfc_if_print(const struct pcap_pkthdr *h, register const u_char *p) { - u_int caplen = h->caplen; - u_int length = h->len; - - ++infodelay; - ts_print(&h->ts); - - ipfc_print(p, length, caplen); - - /* - * If "-x" was specified, print stuff past the Network_Header, - * if there's anything to print. - */ - if (xflag && caplen > IPFC_HDRLEN) - default_print(p + IPFC_HDRLEN, caplen - IPFC_HDRLEN); - - putchar('\n'); + ipfc_print(p, h->len, h->caplen); - --infodelay; - if (infoprint) - info(0); + return (IPFC_HDRLEN); }