X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ff4af2069a7d1f56cbcd4292e3d25ddb41a19b0b..HEAD:/print-isoclns.c diff --git a/print-isoclns.c b/print-isoclns.c index f506d4d9..89598b2d 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -34,9 +34,7 @@ * IS-IS: ISO 10589 */ -#ifdef HAVE_CONFIG_H #include -#endif #include "netdissect-stdinc.h" @@ -56,7 +54,7 @@ * IS-IS is defined in ISO 10589. Look there for protocol definitions. */ -#define SYSTEM_ID_LEN MAC_ADDR_LEN +#define SYSTEM_ID_LEN MAC48_LEN #define NODE_ID_LEN (SYSTEM_ID_LEN+1) #define LSP_ID_LEN (SYSTEM_ID_LEN+2) @@ -208,7 +206,7 @@ static const struct tok esis_option_values[] = { { ESIS_OPTION_SECURITY, "Security" }, { ESIS_OPTION_ES_CONF_TIME, "ES Configuration Time" }, { ESIS_OPTION_PRIORITY, "Priority" }, - { ESIS_OPTION_ADDRESS_MASK, "Addressk Mask" }, + { ESIS_OPTION_ADDRESS_MASK, "Address Mask" }, { ESIS_OPTION_SNPA_MASK, "SNPA Mask" }, { 0, NULL } }; @@ -613,7 +611,7 @@ static const struct tok isis_lsp_istype_values[] = { #define ISIS_PTP_ADJ_INIT 1 #define ISIS_PTP_ADJ_DOWN 2 -static const struct tok isis_ptp_adjancey_values[] = { +static const struct tok isis_ptp_adjacency_values[] = { { ISIS_PTP_ADJ_UP, "Up" }, { ISIS_PTP_ADJ_INIT, "Initializing" }, { ISIS_PTP_ADJ_DOWN, "Down" }, @@ -1015,7 +1013,7 @@ clnp_print(netdissect_options *ndo, } tptr+=nsap_offset; tlen-=nsap_offset; - while (tlen > 0) { + while (tlen != 0) { source_address_length=GET_U_1(tptr); if (tlen < source_address_length+1) { ND_PRINT("\n\t NSAP address goes past end of option"); @@ -1126,9 +1124,10 @@ clnp_print(netdissect_options *ndo, default: /* dump the PDU specific data */ - if (length > ND_BYTES_BETWEEN(pptr, optr)) { + if (length > ND_BYTES_BETWEEN(optr, pptr)) { ND_PRINT("\n\t undecoded non-header data, length %u", length-li); - print_unknown_data(ndo, pptr, "\n\t ", length - ND_BYTES_BETWEEN(pptr, optr)); + print_unknown_data(ndo, pptr, "\n\t ", + length - ND_BYTES_BETWEEN(optr, pptr)); } } @@ -1299,10 +1298,10 @@ esis_print(netdissect_options *ndo, pptr += netal; li -= netal; - if (snpal == MAC_ADDR_LEN) + if (snpal == MAC48_LEN) ND_PRINT("\n\t SNPA (length: %u): %s", snpal, - GET_ETHERADDR_STRING(snpa)); + GET_MAC48_STRING(snpa)); else ND_PRINT("\n\t SNPA (length: %u): %s", snpal, @@ -1326,7 +1325,7 @@ esis_print(netdissect_options *ndo, ND_PRINT("\n\t Number of Source Addresses: %u", source_address_number); - while (source_address_number > 0) { + while (source_address_number != 0) { ND_TCHECK_1(pptr); if (li < 1) { ND_PRINT(", bad esh/li"); @@ -1419,7 +1418,7 @@ esis_print(netdissect_options *ndo, break; case ESIS_OPTION_PROTOCOLS: - while (opli>0) { + while (opli != 0) { ND_PRINT("%s (0x%02x)", tok2str(nlpid_values, "unknown", @@ -1803,7 +1802,7 @@ isis_print_tlv_ip_reach(netdissect_options *ndo, tlv_ip_reach = (const struct isis_tlv_ip_reach *)cp; - while (length > 0) { + while (length != 0) { if ((size_t)length < sizeof(*tlv_ip_reach)) { ND_PRINT("short IPv4 Reachability (%u vs %zu)", length, @@ -1949,10 +1948,6 @@ isis_print_ext_is_reach(netdissect_options *ndo, u_int subtlv_type,subtlv_len,subtlv_sum_len; int proc_bytes = 0; /* how many bytes did we process ? */ u_int te_class,priority_level,gmpls_switch_cap; - union { /* int to float conversion buffer for several subTLVs */ - float f; - uint32_t i; - } bw; ND_TCHECK_LEN(tptr, NODE_ID_LEN); if (tlv_remaining < NODE_ID_LEN) @@ -2039,19 +2034,16 @@ isis_print_ext_is_reach(netdissect_options *ndo, break; case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW : case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW: - if (subtlv_len >= 4) { - bw.i = GET_BE_U_4(tptr); - ND_PRINT(", %.3f Mbps", bw.f * 8 / 1000000); - } + if (subtlv_len >= 4) + ND_PRINT(", %.3f Mbps", GET_BE_F_4(tptr) * 8 / 1000000); break; case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW : if (subtlv_len >= 32) { for (te_class = 0; te_class < 8; te_class++) { - bw.i = GET_BE_U_4(tptr); ND_PRINT("%s TE-Class %u: %.3f Mbps", indent, te_class, - bw.f * 8 / 1000000); + GET_BE_F_4(tptr) * 8 / 1000000); tptr += 4; subtlv_len -= 4; subtlv_sum_len -= 4; @@ -2075,11 +2067,10 @@ isis_print_ext_is_reach(netdissect_options *ndo, for (te_class = 0; subtlv_len != 0; te_class++) { if (subtlv_len < 4) break; - bw.i = GET_BE_U_4(tptr); ND_PRINT("%s Bandwidth constraint CT%u: %.3f Mbps", indent, te_class, - bw.f * 8 / 1000000); + GET_BE_F_4(tptr) * 8 / 1000000); tptr += 4; subtlv_len -= 4; subtlv_sum_len -= 4; @@ -2135,11 +2126,10 @@ isis_print_ext_is_reach(netdissect_options *ndo, proc_bytes += 4; ND_PRINT("%s Max LSP Bandwidth:", indent); for (priority_level = 0; priority_level < 8; priority_level++) { - bw.i = GET_BE_U_4(tptr); ND_PRINT("%s priority level %u: %.3f Mbps", indent, priority_level, - bw.f * 8 / 1000000); + GET_BE_F_4(tptr) * 8 / 1000000); tptr += 4; subtlv_len -= 4; subtlv_sum_len -= 4; @@ -2152,16 +2142,17 @@ isis_print_ext_is_reach(netdissect_options *ndo, case GMPLS_PSC4: if (subtlv_len < 6) break; - bw.i = GET_BE_U_4(tptr); - ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", indent, bw.f * 8 / 1000000); + ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", + indent, + GET_BE_F_4(tptr) * 8 / 1000000); ND_PRINT("%s Interface MTU: %u", indent, GET_BE_U_2(tptr + 4)); break; case GMPLS_TSC: if (subtlv_len < 8) break; - bw.i = GET_BE_U_4(tptr); - ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", indent, bw.f * 8 / 1000000); + ND_PRINT("%s Min LSP Bandwidth: %.3f Mbps", indent, + GET_BE_F_4(tptr) * 8 / 1000000); ND_PRINT("%s Indication %s", indent, tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", GET_U_1((tptr + 4)))); break; @@ -2340,7 +2331,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo, processed+=sublen+1; ND_PRINT(" (%u)", sublen); /* print out subTLV length */ - while (sublen>0) { + while (sublen != 0) { subtlvtype=GET_U_1(tptr); subtlvlen=GET_U_1(tptr + 1); tptr+=2; @@ -2848,7 +2839,7 @@ isis_print(netdissect_options *ndo, * Now print the TLV's. */ - while (packet_len > 0) { + while (packet_len != 0) { ND_TCHECK_2(pptr); if (packet_len < 2) goto trunc; @@ -2888,12 +2879,12 @@ isis_print(netdissect_options *ndo, break; case ISIS_TLV_ISNEIGH: while (tlen != 0) { - if (tlen < MAC_ADDR_LEN) + if (tlen < MAC48_LEN) goto tlv_trunc; - ND_TCHECK_LEN(tptr, MAC_ADDR_LEN); - ND_PRINT("\n\t SNPA: %s", isis_print_id(ndo, tptr, MAC_ADDR_LEN)); - tlen -= MAC_ADDR_LEN; - tptr += MAC_ADDR_LEN; + ND_TCHECK_LEN(tptr, MAC48_LEN); + ND_PRINT("\n\t SNPA: %s", isis_print_id(ndo, tptr, MAC48_LEN)); + tlen -= MAC48_LEN; + tptr += MAC48_LEN; } break; @@ -3148,7 +3139,7 @@ isis_print(netdissect_options *ndo, tlv_ptp_adj = (const struct isis_tlv_ptp_adj *)tptr; if(tlen>=1) { ND_PRINT("\n\t Adjacency State: %s (%u)", - tok2str(isis_ptp_adjancey_values, "unknown", GET_U_1(tptr)), + tok2str(isis_ptp_adjacency_values, "unknown", GET_U_1(tptr)), GET_U_1(tptr)); tlen--; }