X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/2858e729edf1112bc075c8fb72a66726009b391b..9f957a5883cb4c5c99cefa71b42fc9d2d27d73e1:/print-lldp.c diff --git a/print-lldp.c b/print-lldp.c index e8394937..f4752d49 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -682,7 +682,7 @@ lldp_private_8021_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)", EXTRACT_BE_U_2(tptr + 5), - bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_U_1((tptr + 4))), + bittok2str(lldp_8021_port_protocol_id_values, "none", EXTRACT_U_1(tptr + 4)), EXTRACT_U_1(tptr + 4))); break; case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME: @@ -874,7 +874,7 @@ lldp_private_8023_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t autonegotiation [%s] (0x%02x)", - bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_U_1((tptr + 4))), + bittok2str(lldp_8023_autonegotiation_values, "none", EXTRACT_U_1(tptr + 4)), EXTRACT_U_1(tptr + 4))); ND_PRINT((ndo, "\n\t PMD autoneg capability [%s] (0x%04x)", bittok2str(lldp_pmd_capability_values,"unknown", EXTRACT_BE_U_2(tptr + 5)), @@ -997,7 +997,7 @@ lldp_private_tia_print(netdissect_options *ndo, bittok2str(lldp_tia_capabilities_values, "none", EXTRACT_BE_U_2(tptr + 4)), EXTRACT_BE_U_2(tptr + 4))); ND_PRINT((ndo, "\n\t Device type [%s] (0x%02x)", - tok2str(lldp_tia_device_type_values, "unknown", EXTRACT_U_1((tptr + 6))), + tok2str(lldp_tia_device_type_values, "unknown", EXTRACT_U_1(tptr + 6)), EXTRACT_U_1(tptr + 6))); break; @@ -1006,7 +1006,7 @@ lldp_private_tia_print(netdissect_options *ndo, return hexdump; } ND_PRINT((ndo, "\n\t Application type [%s] (0x%02x)", - tok2str(lldp_tia_application_type_values, "none", EXTRACT_U_1((tptr + 4))), + tok2str(lldp_tia_application_type_values, "none", EXTRACT_U_1(tptr + 4)), EXTRACT_U_1(tptr + 4))); ND_PRINT((ndo, ", Flags [%s]", bittok2str( lldp_tia_network_policy_bits_values, "none", EXTRACT_U_1((tptr + 5))))); @@ -1037,13 +1037,13 @@ lldp_private_tia_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Longitude resolution %u, longitude value %" PRIu64, (EXTRACT_U_1(tptr + 10) >> 2), lldp_extract_latlon(tptr + 10))); ND_PRINT((ndo, "\n\t Altitude type %s (%u)", - tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_U_1((tptr + 15)) >> 4), + tok2str(lldp_tia_location_altitude_type_values, "unknown",EXTRACT_U_1(tptr + 15) >> 4), (EXTRACT_U_1(tptr + 15) >> 4))); ND_PRINT((ndo, "\n\t Altitude resolution %u, altitude value 0x%x", (EXTRACT_BE_U_2(tptr + 15)>>6)&0x3f, ((EXTRACT_BE_U_4(tptr + 16) & 0x3fffffff)))); ND_PRINT((ndo, "\n\t Datum %s (0x%02x)", - tok2str(lldp_tia_location_datum_type_values, "unknown", EXTRACT_U_1((tptr + 20))), + tok2str(lldp_tia_location_datum_type_values, "unknown", EXTRACT_U_1(tptr + 20)), EXTRACT_U_1(tptr + 20))); break; @@ -1060,7 +1060,7 @@ lldp_private_tia_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t LCI length %u, LCI what %s (0x%02x), Country-code ", lci_len, - tok2str(lldp_tia_location_lci_what_values, "unknown", EXTRACT_U_1((tptr + 6))), + tok2str(lldp_tia_location_lci_what_values, "unknown", EXTRACT_U_1(tptr + 6)), EXTRACT_U_1(tptr + 6))); /* Country code */ @@ -1074,7 +1074,7 @@ lldp_private_tia_print(netdissect_options *ndo, if (lci_len < 2) { return hexdump; } - ca_type = *(tptr); + ca_type = EXTRACT_U_1(tptr); ca_len = EXTRACT_U_1(tptr + 1); tptr += 2; @@ -1118,8 +1118,8 @@ lldp_private_tia_print(netdissect_options *ndo, ND_PRINT((ndo, ", Power source [%s]", tok2str(lldp_tia_power_source_values, "none", (EXTRACT_U_1((tptr + 4)) & 0x30) >> 4))); ND_PRINT((ndo, "\n\t Power priority [%s] (0x%02x)", - tok2str(lldp_tia_power_priority_values, "none", EXTRACT_U_1((tptr + 4)) & 0x0f), - (EXTRACT_U_1(tptr + 4) & 0x0f))); + tok2str(lldp_tia_power_priority_values, "none", EXTRACT_U_1(tptr + 4) & 0x0f), + EXTRACT_U_1(tptr + 4) & 0x0f)); power_val = EXTRACT_BE_U_2(tptr + 5); if (power_val < LLDP_TIA_POWER_VAL_MAX) { ND_PRINT((ndo, ", Power %.1f Watts", ((float)power_val) / 10)); @@ -1180,7 +1180,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, while (tlen >= sizeof(tlv)) { - ND_TCHECK2(*tptr, sizeof(tlv)); + ND_TCHECK_LEN(tptr, sizeof(tlv)); tlv = EXTRACT_BE_U_2(tptr); @@ -1196,7 +1196,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, break; } - ND_TCHECK2(*tptr, tlv_len); + ND_TCHECK_LEN(tptr, tlv_len); if (tlen < tlv_len) { goto trunc; } @@ -1209,7 +1209,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Control - Protocol Control (type 0x%x, length %d)", LLDP_DCBX_CONTROL_TLV, tlv_len)); - ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); + ND_PRINT((ndo, "\n\t Oper_Version: %d", EXTRACT_U_1(tptr))); ND_PRINT((ndo, "\n\t Max_Version: %d", EXTRACT_U_1(tptr + 1))); ND_PRINT((ndo, "\n\t Sequence Number: %d", EXTRACT_BE_U_4(tptr + 2))); ND_PRINT((ndo, "\n\t Acknowledgement Number: %d", @@ -1221,7 +1221,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Feature - Priority Group (type 0x%x, length %d)", LLDP_DCBX_PRIORITY_GROUPS_TLV, tlv_len)); - ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); + ND_PRINT((ndo, "\n\t Oper_Version: %d", EXTRACT_U_1(tptr))); ND_PRINT((ndo, "\n\t Max_Version: %d", EXTRACT_U_1(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", EXTRACT_U_1(tptr + 2))); tval = EXTRACT_U_1(tptr + 2); @@ -1252,7 +1252,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Feature - Priority Flow Control")); ND_PRINT((ndo, " (type 0x%x, length %d)", LLDP_DCBX_PRIORITY_FLOW_CONTROL_TLV, tlv_len)); - ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); + ND_PRINT((ndo, "\n\t Oper_Version: %d", EXTRACT_U_1(tptr))); ND_PRINT((ndo, "\n\t Max_Version: %d", EXTRACT_U_1(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", EXTRACT_U_1(tptr + 2))); tval = EXTRACT_U_1(tptr + 2); @@ -1273,7 +1273,7 @@ lldp_private_dcbx_print(netdissect_options *ndo, } ND_PRINT((ndo, "\n\t Feature - Application (type 0x%x, length %d)", LLDP_DCBX_APPLICATION_TLV, tlv_len)); - ND_PRINT((ndo, "\n\t Oper_Version: %d", *tptr)); + ND_PRINT((ndo, "\n\t Oper_Version: %d", EXTRACT_U_1(tptr))); ND_PRINT((ndo, "\n\t Max_Version: %d", EXTRACT_U_1(tptr + 1))); ND_PRINT((ndo, "\n\t Info block(0x%02X): ", EXTRACT_U_1(tptr + 2))); tval = EXTRACT_U_1(tptr + 2); @@ -1325,7 +1325,7 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len) if (len < 1) return NULL; len--; - af = *tptr; + af = EXTRACT_U_1(tptr); switch (af) { case AFNUM_INET: if (len < 4) @@ -1396,7 +1396,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, return 0; } - intf_num_subtype = *tptr; + intf_num_subtype = EXTRACT_U_1(tptr); ND_PRINT((ndo, "\n\t %s Interface Numbering (%u): %u", tok2str(lldp_intf_numb_subtype_values, "Unknown", intf_num_subtype), intf_num_subtype, @@ -1409,7 +1409,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, * The OID is optional. */ if (tlen) { - oid_len = *tptr; + oid_len = EXTRACT_U_1(tptr); if (tlen < 1U + oid_len) { return 0; @@ -1425,7 +1425,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, void lldp_print(netdissect_options *ndo, - register const u_char *pptr, register u_int len) + const u_char *pptr, u_int len) { uint8_t subtype; uint16_t tlv, cap, ena_cap; @@ -1440,7 +1440,7 @@ lldp_print(netdissect_options *ndo, while (tlen >= sizeof(tlv)) { - ND_TCHECK2(*tptr, sizeof(tlv)); + ND_TCHECK_LEN(tptr, sizeof(tlv)); tlv = EXTRACT_BE_U_2(tptr); @@ -1462,7 +1462,7 @@ lldp_print(netdissect_options *ndo, break; } - ND_TCHECK2(*tptr, tlv_len); + ND_TCHECK_LEN(tptr, tlv_len); if (tlen < tlv_len) { goto trunc; } @@ -1474,7 +1474,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 2) { goto trunc; } - subtype = *tptr; + subtype = EXTRACT_U_1(tptr); ND_PRINT((ndo, "\n\t Subtype %s (%u): ", tok2str(lldp_chassis_subtype_values, "Unknown", subtype), subtype)); @@ -1515,7 +1515,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 2) { goto trunc; } - subtype = *tptr; + subtype = EXTRACT_U_1(tptr); ND_PRINT((ndo, "\n\t Subtype %s (%u): ", tok2str(lldp_port_subtype_values, "Unknown", subtype), subtype));