X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/fb2479d733dbe8a991d11909b319341f7db62ab1..a8abce5c5e2dce2ba6dbccd5d3829da104b80f9c:/print-cfm.c diff --git a/print-cfm.c b/print-cfm.c index 6b34d7b9..45608256 100644 --- a/print-cfm.c +++ b/print-cfm.c @@ -31,6 +31,7 @@ #include "oui.h" #include "af.h" + struct cfm_common_header_t { nd_uint8_t mdlevel_version; nd_uint8_t opcode; @@ -39,7 +40,7 @@ struct cfm_common_header_t { }; #define CFM_VERSION 0 -#define CFM_EXTRACT_VERSION(x) (((x)&0x1f)) +#define CFM_EXTRACT_VERSION(x) ((x)&0x1f) #define CFM_EXTRACT_MD_LEVEL(x) (((x)&0xe0)>>5) #define CFM_OPCODE_CCM 1 @@ -71,12 +72,12 @@ struct cfm_ccm_t { * Timer Bases for the CCM Interval field. * Expressed in units of seconds. */ -static const float ccm_interval_base[8] = {0, 0.003333, 0.01, 0.1, 1, 10, 60, 600}; +static const float ccm_interval_base[8] = {0.0f, 0.003333f, 0.01f, 0.1f, 1.0f, 10.0f, 60.0f, 600.0f}; #define CCM_INTERVAL_MIN_MULTIPLIER 3.25 #define CCM_INTERVAL_MAX_MULTIPLIER 3.5 #define CFM_CCM_RDI_FLAG 0x80 -#define CFM_EXTRACT_CCM_INTERVAL(x) (((x)&0x07)) +#define CFM_EXTRACT_CCM_INTERVAL(x) ((x)&0x07) #define CFM_CCM_MD_FORMAT_8021 0 #define CFM_CCM_MD_FORMAT_NONE 1 @@ -290,6 +291,7 @@ cfm_print(netdissect_options *ndo, const struct cfm_ltr_t *cfm_ltr; } msg_ptr; + ndo->ndo_protocol = "cfm"; tptr=pptr; cfm_common_header = (const struct cfm_common_header_t *)pptr; if (length < sizeof(*cfm_common_header)) @@ -401,7 +403,7 @@ cfm_print(netdissect_options *ndo, switch (md_nameformat) { case CFM_CCM_MD_FORMAT_DNS: case CFM_CCM_MD_FORMAT_CHAR: - safeputs(ndo, md_name, md_namelength); + (void)nd_printzp(ndo, md_name, md_namelength, NULL); break; case CFM_CCM_MD_FORMAT_MAC: @@ -453,7 +455,7 @@ cfm_print(netdissect_options *ndo, ND_PRINT("\n\t MA Name: "); switch (ma_nameformat) { case CFM_CCM_MA_FORMAT_CHAR: - safeputs(ndo, ma_name, ma_namelength); + (void)nd_printzp(ndo, ma_name, ma_namelength, NULL); break; /* FIXME add printers for those MA formats - hexdump for now */ @@ -659,7 +661,7 @@ cfm_print(netdissect_options *ndo, case CFM_CHASSIS_ID_LOCAL: case CFM_CHASSIS_ID_CHASSIS_COMPONENT: case CFM_CHASSIS_ID_PORT_COMPONENT: - safeputs(ndo, tptr + 1, chassis_id_length); + (void)nd_printzp(ndo, tptr + 1, chassis_id_length, NULL); break; default: @@ -764,5 +766,5 @@ tooshort: return; trunc: - ND_PRINT("\n\t\t packet exceeded snapshot"); + nd_print_trunc(ndo); }