From bd00116d80c18b782f4cb15dfc90cd5bf993d4f5 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 17 Apr 2015 23:42:22 -0700 Subject: 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. --- print-token.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'print-token.c') diff --git a/print-token.c b/print-token.c index 9a0e9742..6565af9d 100644 --- a/print-token.c +++ b/print-token.c @@ -148,6 +148,7 @@ u_int token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) { const struct token_header *trp; + int llc_hdrlen; struct ether_header ehdr; u_int route_len = 0, hdr_len = TOKEN_HDRLEN; int seg; @@ -209,11 +210,15 @@ token_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen /* Frame Control field determines interpretation of packet */ if (FRAME_TYPE(trp) == TOKEN_FC_LLC) { /* Try to print the LLC-layer header & higher layers */ - if (llc_print(ndo, p, length, caplen, ESRC(&ehdr), EDST(&ehdr)) == 0) { - /* ether_type not known, print raw packet */ + llc_hdrlen = llc_print(ndo, p, length, caplen, ESRC(&ehdr), + EDST(&ehdr)); + if (llc_hdrlen < 0) { + /* packet type not known, print raw packet */ if (!ndo->ndo_suppress_default_print) ND_DEFAULTPRINT(p, caplen); + llc_hdrlen = -llc_hdrlen; } + hdr_len += llc_hdrlen; } else { /* Some kinds of TR packet we cannot handle intelligently */ /* XXX - dissect MAC packets if frame type is 0 */ -- cgit v1.2.1