diff options
author | Francois-Xavier Le Bail <fx.lebail@yahoo.com> | 2015-12-16 15:48:14 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <fx.lebail@yahoo.com> | 2015-12-16 15:59:39 +0100 |
commit | b713410ff2fc96e181987be1556a8198f6ceabb7 (patch) | |
tree | bb41fbf9125ff11d1a4251edd9e1ac692c48ef6d /print-ether.c | |
parent | 2b37556bfac8011bd6d0cefbca7343638738f616 (diff) | |
download | tcpdump-b713410ff2fc96e181987be1556a8198f6ceabb7.tar.gz |
Ethernet: Print the Length/Type field as length when needed
Reference: IEEE Std 802.3-2012
"If the value of this field is less than or equal to 1500 decimal
(05DC hexadecimal), then the Length/Type field indicates the number
of MAC client data octets contained in the subsequent MAC Client Data
field of the basic frame (Length interpretation)."
Update the output of a test accordingly.
Diffstat (limited to 'print-ether.c')
-rw-r--r-- | print-ether.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/print-ether.c b/print-ether.c index 1e3cbfbc..342da54e 100644 --- a/print-ether.c +++ b/print-ether.c @@ -101,17 +101,19 @@ ether_hdr_print(netdissect_options *ndo, ether_type = EXTRACT_16BITS(&ep->ether_type); if (!ndo->ndo_qflag) { - if (ether_type <= ETHERMTU) - ND_PRINT((ndo, ", 802.3")); - else - ND_PRINT((ndo, ", ethertype %s (0x%04x)", + if (ether_type <= ETHERMTU) { + ND_PRINT((ndo, ", 802.3")); + length = ether_type; + } else + ND_PRINT((ndo, ", ethertype %s (0x%04x)", tok2str(ethertype_values,"Unknown", ether_type), ether_type)); } else { - if (ether_type <= ETHERMTU) - ND_PRINT((ndo, ", 802.3")); - else - ND_PRINT((ndo, ", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ether_type))); + if (ether_type <= ETHERMTU) { + ND_PRINT((ndo, ", 802.3")); + length = ether_type; + } else + ND_PRINT((ndo, ", %s", tok2str(ethertype_values,"Unknown Ethertype (0x%04x)", ether_type))); } ND_PRINT((ndo, ", length %u: ", length)); |