]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-lldp.c
CHANGES: Add a change backported to 4.99
[tcpdump] / print-lldp.c
index a04f054ed48372655a849df00b09e61eb3ab762b..c12e37d037275431478c438845beec293bcb4425 100644 (file)
@@ -19,9 +19,7 @@
 
 /* \summary: IEEE 802.1ab Link Layer Discovery Protocol (LLDP) printer */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -143,7 +141,7 @@ static const struct tok lldp_cap_values[] = {
 #define LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION      11
 #define LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY   12
 #define LLDP_PRIVATE_8021_SUBTYPE_EVB                    13
-#define LLDP_PRIVATE_8021_SUBTYPE_CDCP                          14
+#define LLDP_PRIVATE_8021_SUBTYPE_CDCP                  14
 
 static const struct tok lldp_8021_subtype_values[] = {
     { LLDP_PRIVATE_8021_SUBTYPE_PORT_VLAN_ID, "Port VLAN Id"},
@@ -511,10 +509,10 @@ static const struct tok lldp_pmd_capability_values[] = {
 #define LLDP_MDI_PAIR_CONTROL_ABILITY          (1 <<  3)
 
 static const struct tok lldp_mdi_values[] = {
-    { LLDP_MDI_PORT_CLASS,             "PSE"},
-    { LLDP_MDI_POWER_SUPPORT,          "supported"},
-    { LLDP_MDI_POWER_STATE,            "enabled"},
-    { LLDP_MDI_PAIR_CONTROL_ABILITY,   "can be controlled"},
+    { LLDP_MDI_PORT_CLASS,             "PSE"},
+    { LLDP_MDI_POWER_SUPPORT,          "supported"},
+    { LLDP_MDI_POWER_STATE,            "enabled"},
+    { LLDP_MDI_PAIR_CONTROL_ABILITY,   "can be controlled"},
     { 0, NULL}
 };
 
@@ -1088,7 +1086,7 @@ lldp_private_tia_print(netdissect_options *ndo,
             tptr = tptr + 9;
 
             /* Decode each civic address element */
-            while (lci_len > 0) {
+            while (lci_len != 0) {
                 if (lci_len < 2) {
                     return hexdump;
                 }
@@ -1098,7 +1096,7 @@ lldp_private_tia_print(netdissect_options *ndo,
                tptr += 2;
                 lci_len -= 2;
 
-                ND_PRINT("\n\t      CA type \'%s\' (%u), length %u: ",
+                ND_PRINT("\n\t      CA type '%s' (%u), length %u: ",
                        tok2str(lldp_tia_location_lci_catype_values, "unknown", ca_type),
                        ca_type, ca_len);
 
@@ -1349,20 +1347,20 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len)
     len--;
     af = GET_U_1(tptr);
     switch (af) {
-    case AFNUM_INET:
+    case AFNUM_IP:
         if (len < sizeof(nd_ipv4))
           return NULL;
         pfunc = ipaddr_string;
         break;
-    case AFNUM_INET6:
+    case AFNUM_IP6:
         if (len < sizeof(nd_ipv6))
           return NULL;
         pfunc = ip6addr_string;
         break;
     case AFNUM_802:
-        if (len < MAC_ADDR_LEN)
+        if (len < MAC48_LEN)
           return NULL;
-        pfunc = etheraddr_string;
+        pfunc = mac48_string;
         break;
     default:
         pfunc = NULL;
@@ -1505,7 +1503,7 @@ lldp_print(netdissect_options *ndo,
                     if (tlv_len < 1+6) {
                         goto trunc;
                     }
-                    ND_PRINT("%s", GET_ETHERADDR_STRING(tptr + 1));
+                    ND_PRINT("%s", GET_MAC48_STRING(tptr + 1));
                     break;
 
                 case LLDP_CHASSIS_INTF_NAME_SUBTYPE: /* fall through */
@@ -1546,7 +1544,7 @@ lldp_print(netdissect_options *ndo,
                     if (tlv_len < 1+6) {
                         goto trunc;
                     }
-                    ND_PRINT("%s", GET_ETHERADDR_STRING(tptr + 1));
+                    ND_PRINT("%s", GET_MAC48_STRING(tptr + 1));
                     break;
 
                 case LLDP_PORT_INTF_NAME_SUBTYPE: /* fall through */