]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Ethernet: Print the Length/Type field as length when needed
authorFrancois-Xavier Le Bail <[email protected]>
Wed, 16 Dec 2015 14:48:14 +0000 (15:48 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 16 Dec 2015 14:59:39 +0000 (15:59 +0100)
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.

print-ether.c
tests/lldp_cdp-ev.out

index 1e3cbfbc301c285b77313dc20f9afab1c18a0a80..342da54e41fcea2a63f7c1ed5155699e7793df21 100644 (file)
@@ -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));
index 5743b46670465adf7f6f74538abd29b7c913804e..0029a75f9d93577d0568c56c2d184a9a6977059b 100644 (file)
@@ -1,4 +1,4 @@
-00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 388: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 366: CDPv2, ttl: 180s, checksum: 0x0bea (unverified), length 366
+00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 374: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 366: CDPv2, ttl: 180s, checksum: 0x0bea (unverified), length 366
        Device-ID (0x01), value length: 2 bytes: 'S1'
        Version String (0x05), value length: 190 bytes: 
          Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)
@@ -17,7 +17,7 @@
        Management Addresses (0x16), value length: 13 bytes: IPv4 (1) 0.0.0.0
        unknown field type (0x1a), value length: 12 bytes: 
          0x0000:  0000 0001 0000 0000 ffff ffff
-00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 392: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 370: CDPv2, ttl: 180s, checksum: 0x971d (unverified), length 370
+00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 378: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 370: CDPv2, ttl: 180s, checksum: 0x971d (unverified), length 370
        Device-ID (0x01), value length: 2 bytes: 'S2'
        Version String (0x05), value length: 190 bytes: 
          Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)
            PMD autoneg capability [Sym PAUSE for fdx, Asym and Sym PAUSE for fdx, 1000BASE-{X LX SX CX} fdx, 1000BASE-T hdx] (0x0036)
            MAU type 100BASETX fdx (0x0010)
        End TLV (0), length 0
-00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 388: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 366: CDPv2, ttl: 180s, checksum: 0x0be9 (unverified), length 366
+00:18:ba:98:68:8f > 01:00:0c:cc:cc:cc, 802.3, length 374: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 366: CDPv2, ttl: 180s, checksum: 0x0be9 (unverified), length 366
        Device-ID (0x01), value length: 2 bytes: 'S1'
        Version String (0x05), value length: 190 bytes: 
          Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)
        Management Addresses (0x16), value length: 13 bytes: IPv4 (1) 0.0.0.0
        unknown field type (0x1a), value length: 12 bytes: 
          0x0000:  0000 0001 0000 0000 ffff ffff
-00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 392: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 370: CDPv2, ttl: 180s, checksum: 0x971c (unverified), length 370
+00:19:2f:a7:b2:8d > 01:00:0c:cc:cc:cc, 802.3, length 378: LLC, dsap SNAP (0xaa) Individual, ssap SNAP (0xaa) Command, ctrl 0x03: oui Cisco (0x00000c), pid CDP (0x2000), length 370: CDPv2, ttl: 180s, checksum: 0x971c (unverified), length 370
        Device-ID (0x01), value length: 2 bytes: 'S2'
        Version String (0x05), value length: 190 bytes: 
          Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(44)SE, RELEASE SOFTWARE (fc1)