mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 18:14:29 +08:00
Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (2/n)
This commit is contained in:
parent
d526e47658
commit
4a28df231d
@ -496,7 +496,7 @@ oam_print (netdissect_options *ndo,
|
||||
switch (cell_type << 4 | func_type) {
|
||||
case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_LOOPBACK):
|
||||
oam_ptr.oam_fm_loopback = (const struct oam_fm_loopback_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
|
||||
ND_TCHECK(*oam_ptr.oam_fm_loopback);
|
||||
ND_TCHECK_SIZE(oam_ptr.oam_fm_loopback);
|
||||
ND_PRINT((ndo, "\n\tLoopback-Indicator %s, Correlation-Tag 0x%08x",
|
||||
tok2str(oam_fm_loopback_indicator_values,
|
||||
"Unknown",
|
||||
@ -519,7 +519,7 @@ oam_print (netdissect_options *ndo,
|
||||
case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_AIS):
|
||||
case (OAM_CELLTYPE_FM << 4 | OAM_FM_FUNCTYPE_RDI):
|
||||
oam_ptr.oam_fm_ais_rdi = (const struct oam_fm_ais_rdi_t *)(p + OAM_CELLTYPE_FUNCTYPE_LEN);
|
||||
ND_TCHECK(*oam_ptr.oam_fm_ais_rdi);
|
||||
ND_TCHECK_SIZE(oam_ptr.oam_fm_ais_rdi);
|
||||
ND_PRINT((ndo, "\n\tFailure-type 0x%02x", EXTRACT_U_1(oam_ptr.oam_fm_ais_rdi->failure_type)));
|
||||
ND_PRINT((ndo, "\n\tLocation-ID "));
|
||||
for (idx = 0; idx < sizeof(oam_ptr.oam_fm_ais_rdi->failure_location); idx++) {
|
||||
|
@ -345,7 +345,7 @@ cfm_print(netdissect_options *ndo,
|
||||
}
|
||||
if (tlen < sizeof(*msg_ptr.cfm_ccm))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*msg_ptr.cfm_ccm);
|
||||
ND_TCHECK_SIZE(msg_ptr.cfm_ccm);
|
||||
|
||||
ccm_interval = CFM_EXTRACT_CCM_INTERVAL(flags);
|
||||
ND_PRINT((ndo, ", Flags [CCM Interval %u%s]",
|
||||
@ -475,7 +475,7 @@ cfm_print(netdissect_options *ndo,
|
||||
}
|
||||
if (tlen < sizeof(*msg_ptr.cfm_ltm))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*msg_ptr.cfm_ltm);
|
||||
ND_TCHECK_SIZE(msg_ptr.cfm_ltm);
|
||||
|
||||
ND_PRINT((ndo, ", Flags [%s]",
|
||||
bittok2str(cfm_ltm_flag_values, "none", flags)));
|
||||
@ -498,7 +498,7 @@ cfm_print(netdissect_options *ndo,
|
||||
}
|
||||
if (tlen < sizeof(*msg_ptr.cfm_ltr))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*msg_ptr.cfm_ltr);
|
||||
ND_TCHECK_SIZE(msg_ptr.cfm_ltr);
|
||||
|
||||
ND_PRINT((ndo, ", Flags [%s]",
|
||||
bittok2str(cfm_ltr_flag_values, "none", flags)));
|
||||
|
@ -556,7 +556,7 @@ ip_print(netdissect_options *ndo,
|
||||
if (!ndo->ndo_eflag)
|
||||
ND_PRINT((ndo, "IP "));
|
||||
|
||||
ND_TCHECK(*ipds->ip);
|
||||
ND_TCHECK_SIZE(ipds->ip);
|
||||
if (length < sizeof (struct ip)) {
|
||||
ND_PRINT((ndo, "truncated-ip %u", length));
|
||||
return;
|
||||
|
@ -522,7 +522,7 @@ slow_oam_print(netdissect_options *ndo,
|
||||
ptr.slow_oam_common_header = (const struct slow_oam_common_header_t *)tptr;
|
||||
if (tlen < sizeof(*ptr.slow_oam_common_header))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*ptr.slow_oam_common_header);
|
||||
ND_TCHECK_SIZE(ptr.slow_oam_common_header);
|
||||
tptr += sizeof(struct slow_oam_common_header_t);
|
||||
tlen -= sizeof(struct slow_oam_common_header_t);
|
||||
|
||||
@ -539,7 +539,7 @@ slow_oam_print(netdissect_options *ndo,
|
||||
ptr.slow_oam_tlv_header = (const struct slow_oam_tlv_header_t *)tptr;
|
||||
if (tlen < sizeof(*ptr.slow_oam_tlv_header))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*ptr.slow_oam_tlv_header);
|
||||
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);
|
||||
ND_PRINT((ndo, "\n\t %s Information Type (%u), length %u",
|
||||
@ -637,7 +637,7 @@ slow_oam_print(netdissect_options *ndo,
|
||||
ptr.slow_oam_tlv_header = (const struct slow_oam_tlv_header_t *)tptr;
|
||||
if (tlen < sizeof(*ptr.slow_oam_tlv_header))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*ptr.slow_oam_tlv_header);
|
||||
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);
|
||||
ND_PRINT((ndo, "\n\t %s Link Event Type (%u), length %u",
|
||||
@ -719,7 +719,7 @@ slow_oam_print(netdissect_options *ndo,
|
||||
tlv.slow_oam_loopbackctrl = (const struct slow_oam_loopbackctrl_t *)tptr;
|
||||
if (tlen < sizeof(*tlv.slow_oam_loopbackctrl))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*tlv.slow_oam_loopbackctrl);
|
||||
ND_TCHECK_SIZE(tlv.slow_oam_loopbackctrl);
|
||||
command = EXTRACT_U_1(tlv.slow_oam_loopbackctrl->command);
|
||||
ND_PRINT((ndo, "\n\t Command %s (%u)",
|
||||
tok2str(slow_oam_loopbackctrl_cmd_values,
|
||||
|
@ -95,7 +95,7 @@ parse_field(netdissect_options *ndo, const char **pptr, int *len, int *truncated
|
||||
/* Ran out of packet data without finding it */
|
||||
return NULL;
|
||||
}
|
||||
if (!ND_TTEST(**pptr)) {
|
||||
if (!ND_TTEST_SIZE(*pptr)) {
|
||||
/* Ran out of captured data without finding it */
|
||||
*truncated = 1;
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user