X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ee68aa36460d7efeca48747f33b7f2adc0900bfb..a63600a1fc28dbc7ae7ce9f996829c49a25fb33c:/print-cfm.c diff --git a/print-cfm.c b/print-cfm.c index 971c9600..2f9b89cf 100644 --- a/print-cfm.c +++ b/print-cfm.c @@ -23,8 +23,6 @@ #include "netdissect-stdinc.h" -#include - #include "netdissect.h" #include "extract.h" #include "addrtoname.h" @@ -223,7 +221,7 @@ cfm_network_addr_print(netdissect_options *ndo, u_int hexdump = FALSE; /* - * Although AFIs are typically 2 octects wide, + * Although AFIs are typically 2 octets wide, * 802.1ab specifies that this field width * is only one octet. */ @@ -241,22 +239,22 @@ cfm_network_addr_print(netdissect_options *ndo, * Resolve the passed in Address. */ switch(network_addr_type) { - case AFNUM_INET: + case AFNUM_IP: if (length != 1 + 4) { ND_PRINT("(invalid IPv4 address length %u)", length - 1); hexdump = TRUE; break; } - ND_PRINT(", %s", ipaddr_string(ndo, tptr + 1)); + ND_PRINT(", %s", GET_IPADDR_STRING(tptr + 1)); break; - case AFNUM_INET6: + case AFNUM_IP6: if (length != 1 + 16) { ND_PRINT("(invalid IPv6 address length %u)", length - 1); hexdump = TRUE; break; } - ND_PRINT(", %s", ip6addr_string(ndo, tptr + 1)); + ND_PRINT(", %s", GET_IP6ADDR_STRING(tptr + 1)); break; default: @@ -341,8 +339,8 @@ cfm_print(netdissect_options *ndo, case CFM_OPCODE_CCM: msg_ptr.cfm_ccm = (const struct cfm_ccm_t *)tptr; if (first_tlv_offset < sizeof(*msg_ptr.cfm_ccm)) { - ND_PRINT(" (too small 1, must be >= %lu)", - (unsigned long) sizeof(*msg_ptr.cfm_ccm)); + ND_PRINT(" (too small 1, must be >= %zu)", + sizeof(*msg_ptr.cfm_ccm)); return; } if (tlen < sizeof(*msg_ptr.cfm_ccm)) @@ -403,13 +401,12 @@ cfm_print(netdissect_options *ndo, switch (md_nameformat) { case CFM_CCM_MD_FORMAT_DNS: case CFM_CCM_MD_FORMAT_CHAR: - (void)nd_printzp(ndo, md_name, md_namelength, NULL); + nd_printjnp(ndo, md_name, md_namelength); break; case CFM_CCM_MD_FORMAT_MAC: - if (md_namelength == 6) { - ND_PRINT("\n\t MAC %s", etheraddr_string(ndo, - md_name)); + if (md_namelength == MAC_ADDR_LEN) { + ND_PRINT("\n\t MAC %s", GET_ETHERADDR_STRING(md_name)); } else { ND_PRINT("\n\t MAC (length invalid)"); } @@ -455,7 +452,7 @@ cfm_print(netdissect_options *ndo, ND_PRINT("\n\t MA Name: "); switch (ma_nameformat) { case CFM_CCM_MA_FORMAT_CHAR: - (void)nd_printzp(ndo, ma_name, ma_namelength, NULL); + nd_printjnp(ndo, ma_name, ma_namelength); break; /* FIXME add printers for those MA formats - hexdump for now */ @@ -471,8 +468,8 @@ cfm_print(netdissect_options *ndo, case CFM_OPCODE_LTM: msg_ptr.cfm_ltm = (const struct cfm_ltm_t *)tptr; if (first_tlv_offset < sizeof(*msg_ptr.cfm_ltm)) { - ND_PRINT(" (too small 4, must be >= %lu)", - (unsigned long) sizeof(*msg_ptr.cfm_ltm)); + ND_PRINT(" (too small 4, must be >= %zu)", + sizeof(*msg_ptr.cfm_ltm)); return; } if (tlen < sizeof(*msg_ptr.cfm_ltm)) @@ -487,15 +484,15 @@ cfm_print(netdissect_options *ndo, GET_U_1(msg_ptr.cfm_ltm->ttl)); ND_PRINT("\n\t Original-MAC %s, Target-MAC %s", - etheraddr_string(ndo, msg_ptr.cfm_ltm->original_mac), - etheraddr_string(ndo, msg_ptr.cfm_ltm->target_mac)); + GET_ETHERADDR_STRING(msg_ptr.cfm_ltm->original_mac), + GET_ETHERADDR_STRING(msg_ptr.cfm_ltm->target_mac)); break; case CFM_OPCODE_LTR: msg_ptr.cfm_ltr = (const struct cfm_ltr_t *)tptr; if (first_tlv_offset < sizeof(*msg_ptr.cfm_ltr)) { - ND_PRINT(" (too small 5, must be >= %lu)", - (unsigned long) sizeof(*msg_ptr.cfm_ltr)); + ND_PRINT(" (too small 5, must be >= %zu)", + sizeof(*msg_ptr.cfm_ltr)); return; } if (tlen < sizeof(*msg_ptr.cfm_ltr)) @@ -535,7 +532,6 @@ cfm_print(netdissect_options *ndo, cfm_tlv_header = (const struct cfm_tlv_header_t *)tptr; /* Enough to read the tlv type ? */ - ND_TCHECK_1(cfm_tlv_header->type); cfm_tlv_type = GET_U_1(cfm_tlv_header->type); ND_PRINT("\n\t%s TLV (0x%02x)", @@ -649,7 +645,7 @@ cfm_print(netdissect_options *ndo, hexdump = TRUE; break; } - ND_PRINT("\n\t MAC %s", etheraddr_string(ndo, tptr + 1)); + ND_PRINT("\n\t MAC %s", GET_ETHERADDR_STRING(tptr + 1)); break; case CFM_CHASSIS_ID_NETWORK_ADDRESS: @@ -661,7 +657,7 @@ cfm_print(netdissect_options *ndo, case CFM_CHASSIS_ID_LOCAL: case CFM_CHASSIS_ID_CHASSIS_COMPONENT: case CFM_CHASSIS_ID_PORT_COMPONENT: - (void)nd_printzp(ndo, tptr + 1, chassis_id_length, NULL); + nd_printjnp(ndo, tptr + 1, chassis_id_length); break; default: