summaryrefslogtreecommitdiff
path: root/print-token.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-04-17 23:42:22 -0700
committerGuy Harris <guy@alum.mit.edu>2015-04-17 23:42:22 -0700
commitbd00116d80c18b782f4cb15dfc90cd5bf993d4f5 (patch)
treea16e9d9d3f76a4cb7ce31ed246d0e210ee6eef96 /print-token.c
parentcd81326386002beb5c4df6550350860568e2a682 (diff)
downloadtcpdump-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-token.c')
-rw-r--r--print-token.c9
1 files changed, 7 insertions, 2 deletions
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 */