diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-04-17 23:42:22 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-04-17 23:42:22 -0700 |
commit | bd00116d80c18b782f4cb15dfc90cd5bf993d4f5 (patch) | |
tree | a16e9d9d3f76a4cb7ce31ed246d0e210ee6eef96 /print-ipfc.c | |
parent | cd81326386002beb5c4df6550350860568e2a682 (diff) | |
download | tcpdump-bd00116d80c18b782f4cb15dfc90cd5bf993d4f5.tar.gz |
Skip the LLC and SNAP headers with -x.
Have llc_print() return the length of the LLC header, plus the length of
the SNAP header, if available - or, if it couldn't dissect the payload,
return the *negative* of that sum. Use that return value in link-layer
printers.
Diffstat (limited to 'print-ipfc.c')
-rw-r--r-- | print-ipfc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/print-ipfc.c b/print-ipfc.c index b2869eb8..6d07f80e 100644 --- a/print-ipfc.c +++ b/print-ipfc.c @@ -76,15 +76,16 @@ ipfc_hdr_print(netdissect_options *ndo, ND_PRINT((ndo, "%s %s %d: ", srcname, dstname, length)); } -static void +static u_int ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) { const struct ipfc_header *ipfcp = (const struct ipfc_header *)p; struct ether_header ehdr; + int llc_hdrlen; if (caplen < IPFC_HDRLEN) { ND_PRINT((ndo, "[|ipfc]")); - return; + return (caplen); } /* * Get the network addresses into a canonical form @@ -100,14 +101,17 @@ ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) caplen -= IPFC_HDRLEN; /* Try to print the LLC-layer header & higher layers */ - if (llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr)) == 0) { + llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr)); + if (llc_hdrlen < 0) { /* * Some kinds of LLC packet we cannot * handle intelligently */ if (!ndo->ndo_suppress_default_print) ND_DEFAULTPRINT(p, caplen); + llc_hdrlen = -llc_hdrlen; } + return (IPFC_HDRLEN + llc_hdrlen); } /* @@ -119,7 +123,5 @@ ipfc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) u_int ipfc_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { - ipfc_print(ndo, p, h->len, h->caplen); - - return (IPFC_HDRLEN); + return (ipfc_print(ndo, p, h->len, h->caplen)); } |