summaryrefslogtreecommitdiff
path: root/print-ether.c
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-12-16 15:48:14 +0100
committerFrancois-Xavier Le Bail <fx.lebail@yahoo.com>2015-12-16 15:59:39 +0100
commitb713410ff2fc96e181987be1556a8198f6ceabb7 (patch)
treebb41fbf9125ff11d1a4251edd9e1ac692c48ef6d /print-ether.c
parent2b37556bfac8011bd6d0cefbca7343638738f616 (diff)
downloadtcpdump-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.c18
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));