diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-06-16 17:23:21 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2019-03-26 21:06:24 +0100 |
commit | ee68aa36460d7efeca48747f33b7f2adc0900bfb (patch) | |
tree | 72c1b65d29301835c0e064b433ea685fc856a68e /print-slow.c | |
parent | 1af20c3adc4dfef93de41d4fcd02f0aeb6bbfd4e (diff) | |
download | tcpdump-ee68aa36460d7efeca48747f33b7f2adc0900bfb.tar.gz |
Use the new GET_ macros instead of the EXTRACT_ ones
The exceptions are currently:
Some EXTRACT_ in print-juniper.c, not used on packet buffer pointer.
An EXTRACT_BE_U_3 in addrtoname.c, not always used on packet buffer
pointer.
Diffstat (limited to 'print-slow.c')
-rw-r--r-- | print-slow.c | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/print-slow.c b/print-slow.c index 4e0ab030..dc364cec 100644 --- a/print-slow.c +++ b/print-slow.c @@ -252,7 +252,7 @@ slow_print(netdissect_options *ndo, if (len < 1) goto tooshort; ND_TCHECK_1(pptr); - subtype = EXTRACT_U_1(pptr); + subtype = GET_U_1(pptr); /* * Sanity checking of the header. @@ -262,8 +262,9 @@ slow_print(netdissect_options *ndo, if (len < 2) goto tooshort; ND_TCHECK_1(pptr + 1); - if (EXTRACT_U_1(pptr + 1) != LACP_VERSION) { - ND_PRINT("LACP version %u packet not supported", EXTRACT_U_1(pptr + 1)); + if (GET_U_1(pptr + 1) != LACP_VERSION) { + ND_PRINT("LACP version %u packet not supported", + GET_U_1(pptr + 1)); return; } print_version = 1; @@ -273,8 +274,9 @@ slow_print(netdissect_options *ndo, if (len < 2) goto tooshort; ND_TCHECK_1(pptr + 1); - if (EXTRACT_U_1(pptr + 1) != MARKER_VERSION) { - ND_PRINT("MARKER version %u packet not supported", EXTRACT_U_1(pptr + 1)); + if (GET_U_1(pptr + 1) != MARKER_VERSION) { + ND_PRINT("MARKER version %u packet not supported", + GET_U_1(pptr + 1)); return; } print_version = 1; @@ -293,7 +295,7 @@ slow_print(netdissect_options *ndo, if (print_version == 1) { ND_PRINT("%sv%u, length %u", tok2str(slow_proto_values, "unknown (%u)", subtype), - EXTRACT_U_1((pptr + 1)), + GET_U_1((pptr + 1)), len); } else { /* some slow protos don't have a version number in the header */ @@ -366,8 +368,8 @@ slow_marker_lacp_print(netdissect_options *ndo, /* did we capture enough for fully decoding the tlv header ? */ ND_TCHECK_LEN(tptr, sizeof(struct tlv_header_t)); tlv_header = (const struct tlv_header_t *)tptr; - tlv_type = EXTRACT_U_1(tlv_header->type); - tlv_len = EXTRACT_U_1(tlv_header->length); + tlv_type = GET_U_1(tlv_header->type); + tlv_len = GET_U_1(tlv_header->length); ND_PRINT("\n\t%s TLV (0x%02x), length %u", tok2str(slow_tlv_values, @@ -417,13 +419,13 @@ slow_marker_lacp_print(netdissect_options *ndo, ND_PRINT("\n\t System %s, System Priority %u, Key %u" ", Port %u, Port Priority %u\n\t State Flags [%s]", etheraddr_string(ndo, tlv_ptr.lacp_tlv_actor_partner_info->sys), - EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri), - EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->key), - EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port), - EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port_pri), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->key), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port), + GET_BE_U_2(tlv_ptr.lacp_tlv_actor_partner_info->port_pri), bittok2str(lacp_tlv_actor_partner_info_state_values, "none", - EXTRACT_U_1(tlv_ptr.lacp_tlv_actor_partner_info->state))); + GET_U_1(tlv_ptr.lacp_tlv_actor_partner_info->state))); break; @@ -438,7 +440,7 @@ slow_marker_lacp_print(netdissect_options *ndo, tlv_ptr.lacp_tlv_collector_info = (const struct lacp_tlv_collector_info_t *)tlv_tptr; ND_PRINT("\n\t Max Delay %u", - EXTRACT_BE_U_2(tlv_ptr.lacp_tlv_collector_info->max_delay)); + GET_BE_U_2(tlv_ptr.lacp_tlv_collector_info->max_delay)); break; @@ -454,8 +456,8 @@ slow_marker_lacp_print(netdissect_options *ndo, ND_PRINT("\n\t Request System %s, Request Port %u, Request Transaction ID 0x%08x", etheraddr_string(ndo, tlv_ptr.marker_tlv_marker_info->req_sys), - EXTRACT_BE_U_2(tlv_ptr.marker_tlv_marker_info->req_port), - EXTRACT_BE_U_4(tlv_ptr.marker_tlv_marker_info->req_trans_id)); + GET_BE_U_2(tlv_ptr.marker_tlv_marker_info->req_port), + GET_BE_U_4(tlv_ptr.marker_tlv_marker_info->req_trans_id)); break; @@ -525,12 +527,12 @@ slow_oam_print(netdissect_options *ndo, tptr += sizeof(struct slow_oam_common_header_t); tlen -= sizeof(struct slow_oam_common_header_t); - code = EXTRACT_U_1(ptr.slow_oam_common_header->code); + code = GET_U_1(ptr.slow_oam_common_header->code); ND_PRINT("\n\tCode %s OAM PDU, Flags [%s]", tok2str(slow_oam_code_values, "Unknown (%u)", code), bittok2str(slow_oam_flag_values, "none", - EXTRACT_BE_U_2(ptr.slow_oam_common_header->flags))); + GET_BE_U_2(ptr.slow_oam_common_header->flags))); switch (code) { case SLOW_OAM_CODE_INFO: @@ -539,8 +541,8 @@ slow_oam_print(netdissect_options *ndo, if (tlen < sizeof(*ptr.slow_oam_tlv_header)) goto tooshort; ND_TCHECK_SIZE(ptr.slow_oam_tlv_header); - type = EXTRACT_U_1(ptr.slow_oam_tlv_header->type); - length = EXTRACT_U_1(ptr.slow_oam_tlv_header->length); + type = GET_U_1(ptr.slow_oam_tlv_header->type); + length = GET_U_1(ptr.slow_oam_tlv_header->length); ND_PRINT("\n\t %s Information Type (%u), length %u", tok2str(slow_oam_info_type_values, "Reserved", type), type, @@ -571,7 +573,7 @@ slow_oam_print(netdissect_options *ndo, case SLOW_OAM_INFO_TYPE_REMOTE: tlv.slow_oam_info = (const struct slow_oam_info_t *)tptr; - if (EXTRACT_U_1(tlv.slow_oam_info->info_length) != + if (GET_U_1(tlv.slow_oam_info->info_length) != sizeof(struct slow_oam_info_t)) { ND_PRINT("\n\t ERROR: illegal length - should be %lu", (unsigned long) sizeof(struct slow_oam_info_t)); @@ -580,10 +582,10 @@ slow_oam_print(netdissect_options *ndo, } ND_PRINT("\n\t OAM-Version %u, Revision %u", - EXTRACT_U_1(tlv.slow_oam_info->oam_version), - EXTRACT_BE_U_2(tlv.slow_oam_info->revision)); + GET_U_1(tlv.slow_oam_info->oam_version), + GET_BE_U_2(tlv.slow_oam_info->revision)); - state = EXTRACT_U_1(tlv.slow_oam_info->state); + state = GET_U_1(tlv.slow_oam_info->state); ND_PRINT("\n\t State-Parser-Action %s, State-MUX-Action %s", tok2str(slow_oam_info_type_state_parser_values, "Reserved", state & OAM_INFO_TYPE_PARSER_MASK), @@ -591,14 +593,14 @@ slow_oam_print(netdissect_options *ndo, state & OAM_INFO_TYPE_MUX_MASK)); ND_PRINT("\n\t OAM-Config Flags [%s], OAM-PDU-Config max-PDU size %u", bittok2str(slow_oam_info_type_oam_config_values, "none", - EXTRACT_U_1(tlv.slow_oam_info->oam_config)), - EXTRACT_BE_U_2(tlv.slow_oam_info->oam_pdu_config) & + GET_U_1(tlv.slow_oam_info->oam_config)), + GET_BE_U_2(tlv.slow_oam_info->oam_pdu_config) & OAM_INFO_TYPE_PDU_SIZE_MASK); ND_PRINT("\n\t OUI %s (0x%06x), Vendor-Private 0x%08x", tok2str(oui_values, "Unknown", - EXTRACT_BE_U_3(tlv.slow_oam_info->oui)), - EXTRACT_BE_U_3(tlv.slow_oam_info->oui), - EXTRACT_BE_U_4(tlv.slow_oam_info->vendor_private)); + GET_BE_U_3(tlv.slow_oam_info->oui)), + GET_BE_U_3(tlv.slow_oam_info->oui), + GET_BE_U_4(tlv.slow_oam_info->vendor_private)); break; case SLOW_OAM_INFO_TYPE_ORG_SPECIFIC: @@ -627,7 +629,7 @@ slow_oam_print(netdissect_options *ndo, if (tlen < 2) goto tooshort; ND_TCHECK_2(tptr); - ND_PRINT("\n\t Sequence Number %u", EXTRACT_BE_U_2(tptr)); + ND_PRINT("\n\t Sequence Number %u", GET_BE_U_2(tptr)); tlen -= 2; tptr += 2; @@ -637,8 +639,8 @@ slow_oam_print(netdissect_options *ndo, if (tlen < sizeof(*ptr.slow_oam_tlv_header)) goto tooshort; ND_TCHECK_SIZE(ptr.slow_oam_tlv_header); - type = EXTRACT_U_1(ptr.slow_oam_tlv_header->type); - length = EXTRACT_U_1(ptr.slow_oam_tlv_header->length); + type = GET_U_1(ptr.slow_oam_tlv_header->type); + length = GET_U_1(ptr.slow_oam_tlv_header->length); ND_PRINT("\n\t %s Link Event Type (%u), length %u", tok2str(slow_oam_link_event_values, "Reserved", type), @@ -672,7 +674,7 @@ slow_oam_print(netdissect_options *ndo, case SLOW_OAM_LINK_EVENT_ERR_FRM_SUMM: tlv.slow_oam_link_event = (const struct slow_oam_link_event_t *)tptr; - if (EXTRACT_U_1(tlv.slow_oam_link_event->event_length) != + if (GET_U_1(tlv.slow_oam_link_event->event_length) != sizeof(struct slow_oam_link_event_t)) { ND_PRINT("\n\t ERROR: illegal length - should be %lu", (unsigned long) sizeof(struct slow_oam_link_event_t)); @@ -685,12 +687,12 @@ slow_oam_print(netdissect_options *ndo, "\n\t Errors %" PRIu64 "\n\t Error Running Total %" PRIu64 "\n\t Event Running Total %u", - EXTRACT_BE_U_2(tlv.slow_oam_link_event->time_stamp)*100, - EXTRACT_BE_U_8(tlv.slow_oam_link_event->window), - EXTRACT_BE_U_8(tlv.slow_oam_link_event->threshold), - EXTRACT_BE_U_8(tlv.slow_oam_link_event->errors), - EXTRACT_BE_U_8(tlv.slow_oam_link_event->errors_running_total), - EXTRACT_BE_U_4(tlv.slow_oam_link_event->event_running_total)); + GET_BE_U_2(tlv.slow_oam_link_event->time_stamp)*100, + GET_BE_U_8(tlv.slow_oam_link_event->window), + GET_BE_U_8(tlv.slow_oam_link_event->threshold), + GET_BE_U_8(tlv.slow_oam_link_event->errors), + GET_BE_U_8(tlv.slow_oam_link_event->errors_running_total), + GET_BE_U_4(tlv.slow_oam_link_event->event_running_total)); break; case SLOW_OAM_LINK_EVENT_ORG_SPECIFIC: @@ -719,7 +721,7 @@ slow_oam_print(netdissect_options *ndo, if (tlen < sizeof(*tlv.slow_oam_loopbackctrl)) goto tooshort; ND_TCHECK_SIZE(tlv.slow_oam_loopbackctrl); - command = EXTRACT_U_1(tlv.slow_oam_loopbackctrl->command); + command = GET_U_1(tlv.slow_oam_loopbackctrl->command); ND_PRINT("\n\t Command %s (%u)", tok2str(slow_oam_loopbackctrl_cmd_values, "Unknown", |