diff options
| author | Guy Harris <guy@alum.mit.edu> | 2015-04-17 18:38:46 -0700 |
|---|---|---|
| committer | Guy Harris <guy@alum.mit.edu> | 2015-04-17 18:38:46 -0700 |
| commit | 59864b113d8f2310a38d916e11a27c6f7e979ad9 (patch) | |
| tree | 1ffb8db59e76d121389ec416fdca8dfff1c25764 /print-ether.c | |
| parent | ce0f6c9687a93d3959276de95f9b656d014a050e (diff) | |
| download | tcpdump-59864b113d8f2310a38d916e11a27c6f7e979ad9.tar.gz | |
Clean up printing of LLC packets.
Don't print LLC header information for SNAP packets; if we have a SNAP
header, just call snap_print() and return its return value, regardless
of whether it's 1 or 0, don't fall into the code to print raw LLC header
information - and don't print it with -e, either.
If llc_print() returns 0, just call the default packet printer, don't
print the MAC-layer header or the extracted ethertype - llc_print() will
print the source and destination MAC addresses and whatever type
information is in the LLC or SNAP headers.
If we don't know the DSAP/LSAP, and it's an information frame (numbered
or not) and not an XID frame, return 0, so that we give a hex dump of
the raw payload.
In addition, print the length when printing SNAP header information with
-e.
Diffstat (limited to 'print-ether.c')
| -rw-r--r-- | print-ether.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/print-ether.c b/print-ether.c index e491515c..26c5c97c 100644 --- a/print-ether.c +++ b/print-ether.c @@ -130,7 +130,6 @@ ether_print(netdissect_options *ndo, struct ether_header *ep; u_int orig_length; u_short ether_type; - u_short extracted_ether_type; if (caplen < ETHER_HDRLEN || length < ETHER_HDRLEN) { ND_PRINT((ndo, "[|ether]")); @@ -157,15 +156,8 @@ recurse: */ if (ether_type <= ETHERMTU) { /* Try to print the LLC-layer header & higher layers */ - if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep), - &extracted_ether_type) == 0) { + if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep)) == 0) { /* ether_type not known, print raw packet */ - if (!ndo->ndo_eflag) { - if (print_encap_header != NULL) - (*print_encap_header)(ndo, encap_header_arg); - ether_hdr_print(ndo, (u_char *)ep, orig_length); - } - if (!ndo->ndo_suppress_default_print) ND_DEFAULTPRINT(p, caplen); } @@ -205,15 +197,8 @@ recurse: * there's an LLC header and payload. */ /* Try to print the LLC-layer header & higher layers */ - if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep), - &extracted_ether_type) == 0) { + if (llc_print(ndo, p, length, caplen, ESRC(ep), EDST(ep)) == 0) { /* ether_type not known, print raw packet */ - if (!ndo->ndo_eflag) { - if (print_encap_header != NULL) - (*print_encap_header)(ndo, encap_header_arg); - ether_hdr_print(ndo, (u_char *)ep, orig_length); - } - if (!ndo->ndo_suppress_default_print) ND_DEFAULTPRINT(p, caplen); } |
