X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/c0af6af3011d4c55bdadf3dd76cd5fc1115c50d0..5ef0bcb5edd748de9d9af13c40da0395dfdd94e8:/print-pptp.c diff --git a/print-pptp.c b/print-pptp.c index 7bdc7d82..c1e7644c 100644 --- a/print-pptp.c +++ b/print-pptp.c @@ -263,14 +263,14 @@ struct pptp_msg_sli { */ #define PRINT_RESERVED_IF_NOT_ZERO_1(reserved) \ - if (EXTRACT_U_1(reserved)) \ + if (GET_U_1(reserved)) \ ND_PRINT(" [ERROR: reserved=%u must be zero]", \ - EXTRACT_U_1(reserved)); + GET_U_1(reserved)); #define PRINT_RESERVED_IF_NOT_ZERO_2(reserved) \ - if (EXTRACT_BE_U_2(reserved)) \ + if (GET_BE_U_2(reserved)) \ ND_PRINT(" [ERROR: reserved=%u must be zero]", \ - EXTRACT_BE_U_2(reserved)); + GET_BE_U_2(reserved)); /******************************************/ /* Attribute-specific print out functions */ @@ -285,8 +285,8 @@ pptp_bearer_cap_print(netdissect_options *ndo, const nd_uint32_t *bearer_cap) { ND_PRINT(" BEARER_CAP(%s%s)", - EXTRACT_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", - EXTRACT_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""); + GET_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_DIGITAL_MASK ? "D" : "", + GET_BE_U_4(*bearer_cap) & PPTP_BEARER_CAP_ANALOG_MASK ? "A" : ""); } static const struct tok pptp_btype_str[] = { @@ -301,35 +301,35 @@ pptp_bearer_type_print(netdissect_options *ndo, const nd_uint32_t *bearer_type) { ND_PRINT(" BEARER_TYPE(%s)", - tok2str(pptp_btype_str, "?", EXTRACT_BE_U_4(*bearer_type))); + tok2str(pptp_btype_str, "?", GET_BE_U_4(*bearer_type))); } static void pptp_call_id_print(netdissect_options *ndo, const nd_uint16_t *call_id) { - ND_PRINT(" CALL_ID(%u)", EXTRACT_BE_U_2(*call_id)); + ND_PRINT(" CALL_ID(%u)", GET_BE_U_2(*call_id)); } static void pptp_call_ser_print(netdissect_options *ndo, const nd_uint16_t *call_ser) { - ND_PRINT(" CALL_SER_NUM(%u)", EXTRACT_BE_U_2(*call_ser)); + ND_PRINT(" CALL_SER_NUM(%u)", GET_BE_U_2(*call_ser)); } static void pptp_cause_code_print(netdissect_options *ndo, const nd_uint16_t *cause_code) { - ND_PRINT(" CAUSE_CODE(%u)", EXTRACT_BE_U_2(*cause_code)); + ND_PRINT(" CAUSE_CODE(%u)", GET_BE_U_2(*cause_code)); } static void pptp_conn_speed_print(netdissect_options *ndo, const nd_uint32_t *conn_speed) { - ND_PRINT(" CONN_SPEED(%u)", EXTRACT_BE_U_4(*conn_speed)); + ND_PRINT(" CONN_SPEED(%u)", GET_BE_U_4(*conn_speed)); } static const struct tok pptp_errcode_str[] = { @@ -347,9 +347,10 @@ static void pptp_err_code_print(netdissect_options *ndo, const nd_uint8_t *err_code) { - ND_PRINT(" ERR_CODE(%u", EXTRACT_U_1(*err_code)); + ND_PRINT(" ERR_CODE(%u", GET_U_1(*err_code)); if (ndo->ndo_vflag) { - ND_PRINT(":%s", tok2str(pptp_errcode_str, "?", EXTRACT_U_1(*err_code))); + ND_PRINT(":%s", + tok2str(pptp_errcode_str, "?", GET_U_1(*err_code))); } ND_PRINT(")"); } @@ -358,7 +359,7 @@ static void pptp_firm_rev_print(netdissect_options *ndo, const nd_uint16_t *firm_rev) { - ND_PRINT(" FIRM_REV(%u)", EXTRACT_BE_U_2(*firm_rev)); + ND_PRINT(" FIRM_REV(%u)", GET_BE_U_2(*firm_rev)); } static void @@ -366,10 +367,10 @@ pptp_framing_cap_print(netdissect_options *ndo, const nd_uint32_t *framing_cap) { ND_PRINT(" FRAME_CAP("); - if (EXTRACT_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { + if (GET_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_ASYNC_MASK) { ND_PRINT("A"); /* Async */ } - if (EXTRACT_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { + if (GET_BE_U_4(*framing_cap) & PPTP_FRAMING_CAP_SYNC_MASK) { ND_PRINT("S"); /* Sync */ } ND_PRINT(")"); @@ -387,7 +388,7 @@ pptp_framing_type_print(netdissect_options *ndo, const nd_uint32_t *framing_type) { ND_PRINT(" FRAME_TYPE(%s)", - tok2str(pptp_ftype_str, "?", EXTRACT_BE_U_4(*framing_type))); + tok2str(pptp_ftype_str, "?", GET_BE_U_4(*framing_type))); } static void @@ -401,35 +402,35 @@ static void pptp_id_print(netdissect_options *ndo, const nd_uint32_t *id) { - ND_PRINT(" ID(%u)", EXTRACT_BE_U_4(*id)); + ND_PRINT(" ID(%u)", GET_BE_U_4(*id)); } static void pptp_max_channel_print(netdissect_options *ndo, const nd_uint16_t *max_channel) { - ND_PRINT(" MAX_CHAN(%u)", EXTRACT_BE_U_2(*max_channel)); + ND_PRINT(" MAX_CHAN(%u)", GET_BE_U_2(*max_channel)); } static void pptp_peer_call_id_print(netdissect_options *ndo, const nd_uint16_t *peer_call_id) { - ND_PRINT(" PEER_CALL_ID(%u)", EXTRACT_BE_U_2(*peer_call_id)); + ND_PRINT(" PEER_CALL_ID(%u)", GET_BE_U_2(*peer_call_id)); } static void pptp_phy_chan_id_print(netdissect_options *ndo, const nd_uint32_t *phy_chan_id) { - ND_PRINT(" PHY_CHAN_ID(%u)", EXTRACT_BE_U_4(*phy_chan_id)); + ND_PRINT(" PHY_CHAN_ID(%u)", GET_BE_U_4(*phy_chan_id)); } static void pptp_pkt_proc_delay_print(netdissect_options *ndo, const nd_uint16_t *pkt_proc_delay) { - ND_PRINT(" PROC_DELAY(%u)", EXTRACT_BE_U_2(*pkt_proc_delay)); + ND_PRINT(" PROC_DELAY(%u)", GET_BE_U_2(*pkt_proc_delay)); } static void @@ -437,15 +438,15 @@ pptp_proto_ver_print(netdissect_options *ndo, const nd_uint16_t *proto_ver) { ND_PRINT(" PROTO_VER(%u.%u)", /* Version.Revision */ - EXTRACT_BE_U_2(*proto_ver) >> 8, - EXTRACT_BE_U_2(*proto_ver) & 0xff); + GET_BE_U_2(*proto_ver) >> 8, + GET_BE_U_2(*proto_ver) & 0xff); } static void pptp_recv_winsiz_print(netdissect_options *ndo, const nd_uint16_t *recv_winsiz) { - ND_PRINT(" RECV_WIN(%u)", EXTRACT_BE_U_2(*recv_winsiz)); + ND_PRINT(" RECV_WIN(%u)", GET_BE_U_2(*recv_winsiz)); } static const struct tok pptp_scrrp_str[] = { @@ -493,7 +494,7 @@ static void pptp_result_code_print(netdissect_options *ndo, const nd_uint8_t *result_code, int ctrl_msg_type) { - ND_PRINT(" RESULT_CODE(%u", EXTRACT_U_1(*result_code)); + ND_PRINT(" RESULT_CODE(%u", GET_U_1(*result_code)); if (ndo->ndo_vflag) { const struct tok *dict = ctrl_msg_type == PPTP_CTRL_MSG_TYPE_SCCRP ? pptp_scrrp_str : @@ -504,7 +505,8 @@ pptp_result_code_print(netdissect_options *ndo, ctrl_msg_type == PPTP_CTRL_MSG_TYPE_CDN ? pptp_cdn_str : NULL; /* assertion error */ if (dict != NULL) - ND_PRINT(":%s", tok2str(dict, "?", EXTRACT_U_1(*result_code))); + ND_PRINT(":%s", + tok2str(dict, "?", GET_U_1(*result_code))); } ND_PRINT(")"); } @@ -592,10 +594,9 @@ pptp_stopccrq_print(netdissect_options *ndo, { const struct pptp_msg_stopccrq *ptr = (const struct pptp_msg_stopccrq *)dat; - ND_TCHECK_1(ptr->reason); - ND_PRINT(" REASON(%u", EXTRACT_U_1(ptr->reason)); + ND_PRINT(" REASON(%u", GET_U_1(ptr->reason)); if (ndo->ndo_vflag) { - switch (EXTRACT_U_1(ptr->reason)) { + switch (GET_U_1(ptr->reason)) { case 1: ND_PRINT(":None"); break; @@ -687,10 +688,8 @@ pptp_ocrq_print(netdissect_options *ndo, pptp_call_id_print(ndo, &ptr->call_id); ND_TCHECK_2(ptr->call_ser); pptp_call_ser_print(ndo, &ptr->call_ser); - ND_TCHECK_4(ptr->min_bps); - ND_PRINT(" MIN_BPS(%u)", EXTRACT_BE_U_4(ptr->min_bps)); - ND_TCHECK_4(ptr->max_bps); - ND_PRINT(" MAX_BPS(%u)", EXTRACT_BE_U_4(ptr->max_bps)); + ND_PRINT(" MIN_BPS(%u)", GET_BE_U_4(ptr->min_bps)); + ND_PRINT(" MAX_BPS(%u)", GET_BE_U_4(ptr->max_bps)); ND_TCHECK_4(ptr->bearer_type); pptp_bearer_type_print(ndo, &ptr->bearer_type); ND_TCHECK_4(ptr->framing_type); @@ -699,8 +698,7 @@ pptp_ocrq_print(netdissect_options *ndo, pptp_recv_winsiz_print(ndo, &ptr->recv_winsiz); ND_TCHECK_2(ptr->pkt_proc_delay); pptp_pkt_proc_delay_print(ndo, &ptr->pkt_proc_delay); - ND_TCHECK_2(ptr->phone_no_len); - ND_PRINT(" PHONE_NO_LEN(%u)", EXTRACT_BE_U_2(ptr->phone_no_len)); + ND_PRINT(" PHONE_NO_LEN(%u)", GET_BE_U_2(ptr->phone_no_len)); ND_TCHECK_2(ptr->reserved1); PRINT_RESERVED_IF_NOT_ZERO_2(ptr->reserved1); ND_TCHECK_SIZE(&ptr->phone_no); @@ -759,10 +757,8 @@ pptp_icrq_print(netdissect_options *ndo, pptp_bearer_type_print(ndo, &ptr->bearer_type); ND_TCHECK_4(ptr->phy_chan_id); pptp_phy_chan_id_print(ndo, &ptr->phy_chan_id); - ND_TCHECK_2(ptr->dialed_no_len); - ND_PRINT(" DIALED_NO_LEN(%u)", EXTRACT_BE_U_2(ptr->dialed_no_len)); - ND_TCHECK_2(ptr->dialing_no_len); - ND_PRINT(" DIALING_NO_LEN(%u)", EXTRACT_BE_U_2(ptr->dialing_no_len)); + ND_PRINT(" DIALED_NO_LEN(%u)", GET_BE_U_2(ptr->dialed_no_len)); + ND_PRINT(" DIALING_NO_LEN(%u)", GET_BE_U_2(ptr->dialing_no_len)); ND_TCHECK_SIZE(&ptr->dialed_no); ND_PRINT(" DIALED_NO(%.64s)", ptr->dialed_no); ND_TCHECK_SIZE(&ptr->dialing_no); @@ -880,18 +876,12 @@ pptp_wen_print(netdissect_options *ndo, pptp_peer_call_id_print(ndo, &ptr->peer_call_id); ND_TCHECK_2(ptr->reserved1); PRINT_RESERVED_IF_NOT_ZERO_2(ptr->reserved1); - ND_TCHECK_4(ptr->crc_err); - ND_PRINT(" CRC_ERR(%u)", EXTRACT_BE_U_4(ptr->crc_err)); - ND_TCHECK_4(ptr->framing_err); - ND_PRINT(" FRAMING_ERR(%u)", EXTRACT_BE_U_4(ptr->framing_err)); - ND_TCHECK_4(ptr->hardware_overrun); - ND_PRINT(" HARDWARE_OVERRUN(%u)", EXTRACT_BE_U_4(ptr->hardware_overrun)); - ND_TCHECK_4(ptr->buffer_overrun); - ND_PRINT(" BUFFER_OVERRUN(%u)", EXTRACT_BE_U_4(ptr->buffer_overrun)); - ND_TCHECK_4(ptr->timeout_err); - ND_PRINT(" TIMEOUT_ERR(%u)", EXTRACT_BE_U_4(ptr->timeout_err)); - ND_TCHECK_4(ptr->align_err); - ND_PRINT(" ALIGN_ERR(%u)", EXTRACT_BE_U_4(ptr->align_err)); + ND_PRINT(" CRC_ERR(%u)", GET_BE_U_4(ptr->crc_err)); + ND_PRINT(" FRAMING_ERR(%u)", GET_BE_U_4(ptr->framing_err)); + ND_PRINT(" HARDWARE_OVERRUN(%u)", GET_BE_U_4(ptr->hardware_overrun)); + ND_PRINT(" BUFFER_OVERRUN(%u)", GET_BE_U_4(ptr->buffer_overrun)); + ND_PRINT(" TIMEOUT_ERR(%u)", GET_BE_U_4(ptr->timeout_err)); + ND_PRINT(" ALIGN_ERR(%u)", GET_BE_U_4(ptr->align_err)); return; @@ -909,10 +899,8 @@ pptp_sli_print(netdissect_options *ndo, pptp_peer_call_id_print(ndo, &ptr->peer_call_id); ND_TCHECK_2(ptr->reserved1); PRINT_RESERVED_IF_NOT_ZERO_2(ptr->reserved1); - ND_TCHECK_4(ptr->send_accm); - ND_PRINT(" SEND_ACCM(0x%08x)", EXTRACT_BE_U_4(ptr->send_accm)); - ND_TCHECK_4(ptr->recv_accm); - ND_PRINT(" RECV_ACCM(0x%08x)", EXTRACT_BE_U_4(ptr->recv_accm)); + ND_PRINT(" SEND_ACCM(0x%08x)", GET_BE_U_4(ptr->send_accm)); + ND_PRINT(" RECV_ACCM(0x%08x)", GET_BE_U_4(ptr->recv_accm)); return; @@ -933,13 +921,11 @@ pptp_print(netdissect_options *ndo, hdr = (const struct pptp_hdr *)dat; - ND_TCHECK_2(hdr->length); if (ndo->ndo_vflag) { - ND_PRINT(" Length=%u", EXTRACT_BE_U_2(hdr->length)); + ND_PRINT(" Length=%u", GET_BE_U_2(hdr->length)); } - ND_TCHECK_2(hdr->msg_type); if (ndo->ndo_vflag) { - switch(EXTRACT_BE_U_2(hdr->msg_type)) { + switch(GET_BE_U_2(hdr->msg_type)) { case PPTP_MSG_TYPE_CTRL: ND_PRINT(" CTRL-MSG"); break; @@ -952,16 +938,14 @@ pptp_print(netdissect_options *ndo, } } - ND_TCHECK_4(hdr->magic_cookie); - mc = EXTRACT_BE_U_4(hdr->magic_cookie); + mc = GET_BE_U_4(hdr->magic_cookie); if (mc != PPTP_MAGIC_COOKIE) { ND_PRINT(" UNEXPECTED Magic-Cookie!!(%08x)", mc); } if (ndo->ndo_vflag || mc != PPTP_MAGIC_COOKIE) { ND_PRINT(" Magic-Cookie=%08x", mc); } - ND_TCHECK_2(hdr->ctrl_msg_type); - ctrl_msg_type = EXTRACT_BE_U_2(hdr->ctrl_msg_type); + ctrl_msg_type = GET_BE_U_2(hdr->ctrl_msg_type); if (ctrl_msg_type < PPTP_MAX_MSGTYPE_INDEX) { ND_PRINT(" CTRL_MSGTYPE=%s", pptp_message_type_string[ctrl_msg_type]);