mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2025-01-21 07:08:41 +08:00
Use ND_TTEST_SIZE()/ND_TCHECK_SIZE() macros (1/n)
This commit is contained in:
parent
6e8e14d7fa
commit
d526e47658
@ -42,7 +42,7 @@ ah_print(netdissect_options *ndo, const u_char *bp)
|
||||
|
||||
ah = (const struct ah *)bp;
|
||||
|
||||
ND_TCHECK(*ah);
|
||||
ND_TCHECK_SIZE(ah);
|
||||
|
||||
sumlen = EXTRACT_U_1(ah->ah_len) << 2;
|
||||
|
||||
|
28
print-aodv.c
28
print-aodv.c
@ -180,11 +180,11 @@ aodv_extension(netdissect_options *ndo,
|
||||
{
|
||||
const struct aodv_hello *ah;
|
||||
|
||||
ND_TCHECK(*ep);
|
||||
ND_TCHECK_SIZE(ep);
|
||||
switch (EXTRACT_U_1(ep->type)) {
|
||||
case AODV_EXT_HELLO:
|
||||
ah = (const struct aodv_hello *)(const void *)ep;
|
||||
ND_TCHECK(*ah);
|
||||
ND_TCHECK_SIZE(ah);
|
||||
if (length < sizeof(struct aodv_hello))
|
||||
goto trunc;
|
||||
if (EXTRACT_U_1(ep->length) < 4) {
|
||||
@ -211,7 +211,7 @@ aodv_rreq(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
u_int i;
|
||||
const struct aodv_rreq *ap = (const struct aodv_rreq *)dat;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rreq %u %s%s%s%s%shops %u id 0x%08x\n"
|
||||
@ -242,7 +242,7 @@ aodv_rrep(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
u_int i;
|
||||
const struct aodv_rrep *ap = (const struct aodv_rrep *)dat;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rrep %u %s%sprefix %u hops %u\n"
|
||||
@ -271,7 +271,7 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
const struct aodv_rerr *ap = (const struct aodv_rerr *)dat;
|
||||
const struct rerr_unreach *dp;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
|
||||
@ -280,7 +280,7 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
dp = (const struct rerr_unreach *)(dat + sizeof(*ap));
|
||||
i = length - sizeof(*ap);
|
||||
for (dc = EXTRACT_U_1(ap->rerr_dc); dc != 0; dc--) {
|
||||
ND_TCHECK(*dp);
|
||||
ND_TCHECK_SIZE(dp);
|
||||
if (i < sizeof(*dp))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " {%s}(%u)", ipaddr_string(ndo, &dp->u_da),
|
||||
@ -300,7 +300,7 @@ aodv_v6_rreq(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
u_int i;
|
||||
const struct aodv_rreq6 *ap = (const struct aodv_rreq6 *)dat;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " v6 rreq %u %s%s%s%s%shops %u id 0x%08x\n"
|
||||
@ -331,7 +331,7 @@ aodv_v6_rrep(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
u_int i;
|
||||
const struct aodv_rrep6 *ap = (const struct aodv_rrep6 *)dat;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rrep %u %s%sprefix %u hops %u\n"
|
||||
@ -360,7 +360,7 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
const struct aodv_rerr *ap = (const struct aodv_rerr *)dat;
|
||||
const struct rerr_unreach6 *dp6;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
|
||||
@ -369,7 +369,7 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
dp6 = (const struct rerr_unreach6 *)(const void *)(ap + 1);
|
||||
i = length - sizeof(*ap);
|
||||
for (dc = EXTRACT_U_1(ap->rerr_dc); dc != 0; dc--) {
|
||||
ND_TCHECK(*dp6);
|
||||
ND_TCHECK_SIZE(dp6);
|
||||
if (i < sizeof(*dp6))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " {%s}(%u)", ip6addr_string(ndo, &dp6->u_da),
|
||||
@ -389,7 +389,7 @@ aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
u_int i;
|
||||
const struct aodv_rreq6_draft_01 *ap = (const struct aodv_rreq6_draft_01 *)dat;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rreq %u %s%s%s%s%shops %u id 0x%08x\n"
|
||||
@ -420,7 +420,7 @@ aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
u_int i;
|
||||
const struct aodv_rrep6_draft_01 *ap = (const struct aodv_rrep6_draft_01 *)dat;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rrep %u %s%sprefix %u hops %u\n"
|
||||
@ -449,7 +449,7 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
const struct aodv_rerr *ap = (const struct aodv_rerr *)dat;
|
||||
const struct rerr_unreach6_draft_01 *dp6;
|
||||
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
if (length < sizeof(*ap))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " rerr %s [items %u] [%u]:",
|
||||
@ -458,7 +458,7 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
dp6 = (const struct rerr_unreach6_draft_01 *)(const void *)(ap + 1);
|
||||
i = length - sizeof(*ap);
|
||||
for (dc = EXTRACT_U_1(ap->rerr_dc); dc != 0; dc--) {
|
||||
ND_TCHECK(*dp6);
|
||||
ND_TCHECK_SIZE(dp6);
|
||||
if (i < sizeof(*dp6))
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, " {%s}(%u)", ip6addr_string(ndo, &dp6->u_da),
|
||||
|
@ -259,7 +259,7 @@ atmarp_print(netdissect_options *ndo,
|
||||
u_short pro, hrd, op;
|
||||
|
||||
ap = (const struct atmarp_pkthdr *)bp;
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
|
||||
hrd = ATMHRD(ap);
|
||||
pro = ATMPRO(ap);
|
||||
@ -360,7 +360,7 @@ arp_print(netdissect_options *ndo,
|
||||
u_short pro, hrd, op, linkaddr;
|
||||
|
||||
ap = (const struct arp_pkthdr *)bp;
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
|
||||
hrd = HRD(ap);
|
||||
pro = PRO(ap);
|
||||
|
@ -216,7 +216,7 @@ aarp_print(netdissect_options *ndo,
|
||||
|
||||
ND_PRINT((ndo, "aarp "));
|
||||
ap = (const struct aarp *)bp;
|
||||
if (!ND_TTEST(*ap)) {
|
||||
if (!ND_TTEST_SIZE(ap)) {
|
||||
/* Just bail if we don't have the whole chunk. */
|
||||
ND_PRINT((ndo, " [|aarp]"));
|
||||
return;
|
||||
|
@ -186,7 +186,7 @@ auth_print(netdissect_options *ndo, const u_char *pptr)
|
||||
|
||||
pptr += sizeof (struct bfd_header_t);
|
||||
bfd_auth_header = (const struct bfd_auth_header_t *)pptr;
|
||||
ND_TCHECK(*bfd_auth_header);
|
||||
ND_TCHECK_SIZE(bfd_auth_header);
|
||||
auth_type = EXTRACT_U_1(bfd_auth_header->auth_type);
|
||||
auth_len = EXTRACT_U_1(bfd_auth_header->auth_len);
|
||||
ND_PRINT((ndo, "\n\tAuthentication: %s (%u), length: %u",
|
||||
@ -302,7 +302,7 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
|
||||
bfd_header = (const struct bfd_header_t *)pptr;
|
||||
version_diag = EXTRACT_U_1(bfd_header->version_diag);
|
||||
if (port == BFD_CONTROL_PORT) {
|
||||
ND_TCHECK(*bfd_header);
|
||||
ND_TCHECK_SIZE(bfd_header);
|
||||
version = BFD_EXTRACT_VERSION(version_diag);
|
||||
} else if (port == BFD_ECHO_PORT) {
|
||||
/* Echo is BFD v1 only */
|
||||
|
@ -294,7 +294,7 @@ cfm_print(netdissect_options *ndo,
|
||||
cfm_common_header = (const struct cfm_common_header_t *)pptr;
|
||||
if (length < sizeof(*cfm_common_header))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*cfm_common_header);
|
||||
ND_TCHECK_SIZE(cfm_common_header);
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
|
12
print-cnfp.c
12
print-cnfp.c
@ -167,7 +167,7 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp)
|
||||
#endif
|
||||
|
||||
nh = (const struct nfhdr_v1 *)cp;
|
||||
ND_TCHECK(*nh);
|
||||
ND_TCHECK_SIZE(nh);
|
||||
|
||||
ver = EXTRACT_BE_U_2(nh->version);
|
||||
nrecs = EXTRACT_BE_U_4(nh->count);
|
||||
@ -196,7 +196,7 @@ cnfp_v1_print(netdissect_options *ndo, const u_char *cp)
|
||||
/*
|
||||
* Make sure we have the entire record.
|
||||
*/
|
||||
ND_TCHECK(*nr);
|
||||
ND_TCHECK_SIZE(nr);
|
||||
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
|
||||
EXTRACT_BE_U_4(nr->start_time)/1000,
|
||||
EXTRACT_BE_U_4(nr->start_time)%1000,
|
||||
@ -258,7 +258,7 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp)
|
||||
#endif
|
||||
|
||||
nh = (const struct nfhdr_v5 *)cp;
|
||||
ND_TCHECK(*nh);
|
||||
ND_TCHECK_SIZE(nh);
|
||||
|
||||
ver = EXTRACT_BE_U_2(nh->version);
|
||||
nrecs = EXTRACT_BE_U_4(nh->count);
|
||||
@ -288,7 +288,7 @@ cnfp_v5_print(netdissect_options *ndo, const u_char *cp)
|
||||
/*
|
||||
* Make sure we have the entire record.
|
||||
*/
|
||||
ND_TCHECK(*nr);
|
||||
ND_TCHECK_SIZE(nr);
|
||||
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
|
||||
EXTRACT_BE_U_4(nr->start_time)/1000,
|
||||
EXTRACT_BE_U_4(nr->start_time)%1000,
|
||||
@ -356,7 +356,7 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp)
|
||||
#endif
|
||||
|
||||
nh = (const struct nfhdr_v6 *)cp;
|
||||
ND_TCHECK(*nh);
|
||||
ND_TCHECK_SIZE(nh);
|
||||
|
||||
ver = EXTRACT_BE_U_2(nh->version);
|
||||
nrecs = EXTRACT_BE_U_4(nh->count);
|
||||
@ -386,7 +386,7 @@ cnfp_v6_print(netdissect_options *ndo, const u_char *cp)
|
||||
/*
|
||||
* Make sure we have the entire record.
|
||||
*/
|
||||
ND_TCHECK(*nr);
|
||||
ND_TCHECK_SIZE(nr);
|
||||
ND_PRINT((ndo, "\n started %u.%03u, last %u.%03u",
|
||||
EXTRACT_BE_U_4(nr->start_time)/1000,
|
||||
EXTRACT_BE_U_4(nr->start_time)%1000,
|
||||
|
@ -373,7 +373,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
|
||||
len - fixed_hdrlen));
|
||||
return;
|
||||
}
|
||||
ND_TCHECK(*dhr);
|
||||
ND_TCHECK_SIZE(dhr);
|
||||
ND_PRINT((ndo, "%s (service=%d) ",
|
||||
tok2str(dccp_pkt_type_str, "", dccph_type),
|
||||
EXTRACT_BE_U_4(dhr->dccph_req_service)));
|
||||
@ -389,7 +389,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
|
||||
len - fixed_hdrlen));
|
||||
return;
|
||||
}
|
||||
ND_TCHECK(*dhr);
|
||||
ND_TCHECK_SIZE(dhr);
|
||||
ND_PRINT((ndo, "%s (service=%d) ",
|
||||
tok2str(dccp_pkt_type_str, "", dccph_type),
|
||||
EXTRACT_BE_U_4(dhr->dccph_resp_service)));
|
||||
@ -450,7 +450,7 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2,
|
||||
len - fixed_hdrlen));
|
||||
return;
|
||||
}
|
||||
ND_TCHECK(*dhr);
|
||||
ND_TCHECK_SIZE(dhr);
|
||||
ND_PRINT((ndo, "%s (code=%s) ",
|
||||
tok2str(dccp_pkt_type_str, "", dccph_type),
|
||||
dccp_reset_code(EXTRACT_U_1(dhr->dccph_reset_code))));
|
||||
|
@ -862,7 +862,7 @@ print_nsp(netdissect_options *ndo,
|
||||
|
||||
if (nsplen < sizeof(struct nsphdr))
|
||||
goto trunc;
|
||||
ND_TCHECK(*nsphp);
|
||||
ND_TCHECK_SIZE(nsphp);
|
||||
flags = EXTRACT_U_1(nsphp->nh_flags);
|
||||
dst = EXTRACT_LE_U_2(nsphp->nh_dst);
|
||||
src = EXTRACT_LE_U_2(nsphp->nh_src);
|
||||
@ -975,7 +975,7 @@ print_nsp(netdissect_options *ndo,
|
||||
}
|
||||
}
|
||||
ND_PRINT((ndo, "seg %u ", ack & SGQ_MASK));
|
||||
ND_TCHECK(*lsmp);
|
||||
ND_TCHECK_SIZE(lsmp);
|
||||
lsflags = EXTRACT_U_1(lsmp->ls_lsflags);
|
||||
fcval = EXTRACT_U_1(lsmp->ls_fcval);
|
||||
switch (lsflags & LSI_MASK) {
|
||||
@ -1019,7 +1019,7 @@ print_nsp(netdissect_options *ndo,
|
||||
|
||||
if (nsplen < sizeof(struct ackmsg))
|
||||
goto trunc;
|
||||
ND_TCHECK(*amp);
|
||||
ND_TCHECK_SIZE(amp);
|
||||
ack = EXTRACT_LE_U_2(amp->ak_acknum[0]);
|
||||
if (ack & SGQ_ACK) { /* acknum field */
|
||||
if ((ack & SGQ_NAK) == SGQ_NAK)
|
||||
@ -1044,7 +1044,7 @@ print_nsp(netdissect_options *ndo,
|
||||
|
||||
if (nsplen < sizeof(struct ackmsg))
|
||||
goto trunc;
|
||||
ND_TCHECK(*amp);
|
||||
ND_TCHECK_SIZE(amp);
|
||||
ack = EXTRACT_LE_U_2(amp->ak_acknum[0]);
|
||||
if (ack & SGQ_ACK) { /* acknum field */
|
||||
if ((ack & SGQ_NAK) == SGQ_NAK)
|
||||
@ -1085,7 +1085,7 @@ print_nsp(netdissect_options *ndo,
|
||||
|
||||
if (nsplen < sizeof(struct cimsg))
|
||||
goto trunc;
|
||||
ND_TCHECK(*cimp);
|
||||
ND_TCHECK_SIZE(cimp);
|
||||
services = EXTRACT_U_1(cimp->ci_services);
|
||||
info = EXTRACT_U_1(cimp->ci_info);
|
||||
segsize = EXTRACT_LE_U_2(cimp->ci_segsize);
|
||||
@ -1126,7 +1126,7 @@ print_nsp(netdissect_options *ndo,
|
||||
|
||||
if (nsplen < sizeof(struct ccmsg))
|
||||
goto trunc;
|
||||
ND_TCHECK(*ccmp);
|
||||
ND_TCHECK_SIZE(ccmp);
|
||||
services = EXTRACT_U_1(ccmp->cc_services);
|
||||
info = EXTRACT_U_1(ccmp->cc_info);
|
||||
segsize = EXTRACT_LE_U_2(ccmp->cc_segsize);
|
||||
@ -1171,7 +1171,7 @@ print_nsp(netdissect_options *ndo,
|
||||
|
||||
if (nsplen < sizeof(struct dimsg))
|
||||
goto trunc;
|
||||
ND_TCHECK(*dimp);
|
||||
ND_TCHECK_SIZE(dimp);
|
||||
reason = EXTRACT_LE_U_2(dimp->di_reason);
|
||||
optlen = EXTRACT_U_1(dimp->di_optlen);
|
||||
|
||||
@ -1187,7 +1187,7 @@ print_nsp(netdissect_options *ndo,
|
||||
const struct dcmsg *dcmp = (const struct dcmsg *)nspp;
|
||||
u_int reason;
|
||||
|
||||
ND_TCHECK(*dcmp);
|
||||
ND_TCHECK_SIZE(dcmp);
|
||||
reason = EXTRACT_LE_U_2(dcmp->dc_reason);
|
||||
|
||||
print_reason(ndo, reason);
|
||||
|
@ -302,7 +302,7 @@ dhcp6opt_print(netdissect_options *ndo,
|
||||
if (ep < cp + sizeof(*dh6o))
|
||||
goto trunc;
|
||||
dh6o = (const struct dhcp6opt *)cp;
|
||||
ND_TCHECK(*dh6o);
|
||||
ND_TCHECK_SIZE(dh6o);
|
||||
optlen = EXTRACT_BE_U_2(&dh6o->dh6opt_len);
|
||||
if (ep < cp + sizeof(*dh6o) + optlen)
|
||||
goto trunc;
|
||||
|
@ -599,7 +599,7 @@ domain_print(netdissect_options *ndo,
|
||||
uint16_t b2;
|
||||
|
||||
np = (const dns_header_t *)bp;
|
||||
ND_TCHECK(*np);
|
||||
ND_TCHECK_SIZE(np);
|
||||
flags = EXTRACT_BE_U_2(np->flags);
|
||||
/* get the byte-order right */
|
||||
qdcount = EXTRACT_BE_U_2(np->qdcount);
|
||||
|
@ -159,7 +159,7 @@ eap_print(netdissect_options *ndo,
|
||||
tptr = cp;
|
||||
tlen = length;
|
||||
eap = (const struct eap_frame_t *)cp;
|
||||
ND_TCHECK(*eap);
|
||||
ND_TCHECK_SIZE(eap);
|
||||
eap_type = EXTRACT_U_1(eap->type);
|
||||
|
||||
/* in non-verbose mode just lets print the basic info */
|
||||
|
@ -256,7 +256,7 @@ egp_print(netdissect_options *ndo,
|
||||
u_int status;
|
||||
|
||||
egp = (const struct egp_packet *)bp;
|
||||
if (length < sizeof(*egp) || !ND_TTEST(*egp)) {
|
||||
if (length < sizeof(*egp) || !ND_TTEST_SIZE(egp)) {
|
||||
ND_PRINT((ndo, "[|egp]"));
|
||||
return;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
|
||||
|
||||
tptr=pptr;
|
||||
eigrp_com_header = (const struct eigrp_common_header *)pptr;
|
||||
ND_TCHECK(*eigrp_com_header);
|
||||
ND_TCHECK_SIZE(eigrp_com_header);
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
|
@ -660,7 +660,7 @@ prestlv_print(netdissect_options *ndo,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ND_TCHECK(*r);
|
||||
ND_TCHECK_SIZE(r);
|
||||
result = EXTRACT_U_1(r->result);
|
||||
if (result >= 0x18 && result <= 0xFE) {
|
||||
ND_PRINT((ndo, "illegal reserved result code: 0x%x!\n", result));
|
||||
@ -694,7 +694,7 @@ fdatatlv_print(netdissect_options *ndo,
|
||||
* (the TLV length) >= TLV_HDRL.
|
||||
*/
|
||||
rlen = len - TLV_HDRL;
|
||||
ND_TCHECK(*tlv);
|
||||
ND_TCHECK_SIZE(tlv);
|
||||
type = EXTRACT_BE_U_2(&tlv->type);
|
||||
if (type != F_TLV_FULD) {
|
||||
ND_PRINT((ndo, "Error: expecting FULLDATA!\n"));
|
||||
@ -735,7 +735,7 @@ sdatailv_print(netdissect_options *ndo,
|
||||
#endif
|
||||
char *ib = indent_pr(indent, 1);
|
||||
const u_char *tdp = (const u_char *) ILV_DATA(ilv);
|
||||
ND_TCHECK(*ilv);
|
||||
ND_TCHECK_SIZE(ilv);
|
||||
invilv = ilv_valid(ilv, rlen);
|
||||
if (invilv) {
|
||||
ND_PRINT((ndo, "%s[", ib + 1));
|
||||
@ -775,7 +775,7 @@ sdatatlv_print(netdissect_options *ndo,
|
||||
* >= TLV_HDRL.
|
||||
*/
|
||||
rlen = len - TLV_HDRL;
|
||||
ND_TCHECK(*tlv);
|
||||
ND_TCHECK_SIZE(tlv);
|
||||
type = EXTRACT_BE_U_2(&tlv->type);
|
||||
if (type != F_TLV_SPAD) {
|
||||
ND_PRINT((ndo, "Error: expecting SPARSEDATA!\n"));
|
||||
@ -806,7 +806,7 @@ pkeyitlv_print(netdissect_options *ndo,
|
||||
ND_TCHECK_1(tdp);
|
||||
id = EXTRACT_BE_U_4(tdp);
|
||||
ND_PRINT((ndo, "%sKeyinfo: Key 0x%x\n", ib, id));
|
||||
ND_TCHECK(*kdtlv);
|
||||
ND_TCHECK_SIZE(kdtlv);
|
||||
type = EXTRACT_BE_U_2(&kdtlv->type);
|
||||
invtlv = tlv_valid(kdtlv, len);
|
||||
|
||||
@ -923,7 +923,7 @@ pdatacnt_print(netdissect_options *ndo,
|
||||
u_int aln;
|
||||
u_int invtlv;
|
||||
|
||||
ND_TCHECK(*pdtlv);
|
||||
ND_TCHECK_SIZE(pdtlv);
|
||||
type = EXTRACT_BE_U_2(&pdtlv->type);
|
||||
invtlv = tlv_valid(pdtlv, len);
|
||||
if (invtlv) {
|
||||
@ -998,7 +998,7 @@ pdata_print(netdissect_options *ndo,
|
||||
int more_pd = 0;
|
||||
uint16_t idcnt = 0;
|
||||
|
||||
ND_TCHECK(*pdh);
|
||||
ND_TCHECK_SIZE(pdh);
|
||||
if (len < sizeof(struct pathdata_h))
|
||||
goto trunc;
|
||||
if (ndo->ndo_vflag >= 3) {
|
||||
@ -1062,7 +1062,7 @@ genoptlv_print(netdissect_options *ndo,
|
||||
u_int invtlv;
|
||||
char *ib = indent_pr(indent, 0);
|
||||
|
||||
ND_TCHECK(*pdtlv);
|
||||
ND_TCHECK_SIZE(pdtlv);
|
||||
type = EXTRACT_BE_U_2(&pdtlv->type);
|
||||
tll = EXTRACT_BE_U_2(&pdtlv->length) - TLV_HDRL;
|
||||
invtlv = tlv_valid(pdtlv, len);
|
||||
@ -1110,7 +1110,7 @@ recpdoptlv_print(netdissect_options *ndo,
|
||||
char *ib;
|
||||
|
||||
while (len != 0) {
|
||||
ND_TCHECK(*pdtlv);
|
||||
ND_TCHECK_SIZE(pdtlv);
|
||||
invtlv = tlv_valid(pdtlv, len);
|
||||
if (invtlv) {
|
||||
break;
|
||||
@ -1181,7 +1181,7 @@ otlv_print(netdissect_options *ndo,
|
||||
* lfbselect_print() has ensured that EXTRACT_BE_U_2(&otlv->length)
|
||||
* >= TLV_HDRL.
|
||||
*/
|
||||
ND_TCHECK(*otlv);
|
||||
ND_TCHECK_SIZE(otlv);
|
||||
type = EXTRACT_BE_U_2(&otlv->type);
|
||||
tll = EXTRACT_BE_U_2(&otlv->length) - TLV_HDRL;
|
||||
ops = get_forces_optlv_h(type);
|
||||
@ -1356,7 +1356,7 @@ print_metailv(netdissect_options *ndo,
|
||||
* ILV) >= ILV_HDRL.
|
||||
*/
|
||||
rlen = EXTRACT_BE_U_4(&ilv->length) - ILV_HDRL;
|
||||
ND_TCHECK(*ilv);
|
||||
ND_TCHECK_SIZE(ilv);
|
||||
ND_PRINT((ndo, "%sMetaID 0x%x length %d\n", ib, EXTRACT_BE_U_4(&ilv->type),
|
||||
EXTRACT_BE_U_4(&ilv->length)));
|
||||
if (ndo->ndo_vflag >= 3) {
|
||||
@ -1389,7 +1389,7 @@ print_metatlv(netdissect_options *ndo,
|
||||
rlen = dlen;
|
||||
ND_PRINT((ndo, "\n%s METADATA length %d \n", ib, rlen));
|
||||
while (rlen != 0) {
|
||||
ND_TCHECK(*ilv);
|
||||
ND_TCHECK_SIZE(ilv);
|
||||
invilv = ilv_valid(ilv, rlen);
|
||||
if (invilv) {
|
||||
break;
|
||||
@ -1458,7 +1458,7 @@ redirect_print(netdissect_options *ndo,
|
||||
rlen = dlen;
|
||||
indent += 1;
|
||||
while (rlen != 0) {
|
||||
ND_TCHECK(*tlv);
|
||||
ND_TCHECK_SIZE(tlv);
|
||||
invtlv = tlv_valid(tlv, rlen);
|
||||
if (invtlv) {
|
||||
ND_PRINT((ndo, "Bad Redirect data\n"));
|
||||
@ -1535,7 +1535,7 @@ lfbselect_print(netdissect_options *ndo,
|
||||
rlen = dlen - OP_OFF;
|
||||
|
||||
lfbs = (const struct forces_lfbsh *)pptr;
|
||||
ND_TCHECK(*lfbs);
|
||||
ND_TCHECK_SIZE(lfbs);
|
||||
if (ndo->ndo_vflag >= 3) {
|
||||
ND_PRINT((ndo, "\n%s%s(Classid %x) instance %x\n",
|
||||
ib, tok2str(ForCES_LFBs, NULL, EXTRACT_BE_U_4(&lfbs->class)),
|
||||
@ -1547,7 +1547,7 @@ lfbselect_print(netdissect_options *ndo,
|
||||
|
||||
indent += 1;
|
||||
while (rlen != 0) {
|
||||
ND_TCHECK(*otlv);
|
||||
ND_TCHECK_SIZE(otlv);
|
||||
invtlv = tlv_valid(otlv, rlen);
|
||||
if (invtlv)
|
||||
break;
|
||||
@ -1625,7 +1625,7 @@ forces_type_print(netdissect_options *ndo,
|
||||
/*XXX: 15 top level tlvs will probably be fine
|
||||
You are nuts if you send more ;-> */
|
||||
while (rlen != 0) {
|
||||
ND_TCHECK(*tltlv);
|
||||
ND_TCHECK_SIZE(tltlv);
|
||||
invtlv = tlv_valid(tltlv, rlen);
|
||||
if (invtlv)
|
||||
break;
|
||||
@ -1687,7 +1687,7 @@ forces_print(netdissect_options *ndo,
|
||||
int rc = 0;
|
||||
|
||||
fhdr = (const struct forcesh *)pptr;
|
||||
ND_TCHECK(*fhdr);
|
||||
ND_TCHECK_SIZE(fhdr);
|
||||
tom = EXTRACT_U_1(fhdr->fm_tom);
|
||||
if (!tom_valid(tom)) {
|
||||
ND_PRINT((ndo, "Invalid ForCES message type %d\n", tom));
|
||||
|
@ -41,7 +41,7 @@ frag6_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2)
|
||||
dp = (const struct ip6_frag *)bp;
|
||||
ip6 = (const struct ip6_hdr *)bp2;
|
||||
|
||||
ND_TCHECK(*dp);
|
||||
ND_TCHECK_SIZE(dp);
|
||||
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_PRINT((ndo, "frag (0x%08x:%d|%ld)",
|
||||
|
@ -457,7 +457,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
|
||||
cp = buf + strlen(buf);
|
||||
|
||||
ihp = (const struct ih_rdiscovery *)&dp->icmp_void;
|
||||
ND_TCHECK(*ihp);
|
||||
ND_TCHECK_SIZE(ihp);
|
||||
(void)strncpy(cp, " lifetime ", sizeof(buf) - (cp - buf));
|
||||
cp = buf + strlen(buf);
|
||||
lifetime = EXTRACT_BE_U_2(ihp->ird_lifetime);
|
||||
@ -488,7 +488,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
|
||||
}
|
||||
idp = (const struct id_rdiscovery *)&dp->icmp_data;
|
||||
while (num-- > 0) {
|
||||
ND_TCHECK(*idp);
|
||||
ND_TCHECK_SIZE(idp);
|
||||
(void)snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}",
|
||||
ipaddr_string(ndo, &idp->ird_addr),
|
||||
EXTRACT_BE_U_4(idp->ird_pref));
|
||||
@ -596,7 +596,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
|
||||
*/
|
||||
if (ndo->ndo_vflag >= 1 && plen > ICMP_EXTD_MINLEN && ICMP_MPLS_EXT_TYPE(icmp_type)) {
|
||||
|
||||
ND_TCHECK(*ext_dp);
|
||||
ND_TCHECK_SIZE(ext_dp);
|
||||
|
||||
/*
|
||||
* Check first if the mpls extension header shows a non-zero length.
|
||||
@ -641,7 +641,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
|
||||
while (hlen > sizeof(struct icmp_mpls_ext_object_header_t)) {
|
||||
|
||||
icmp_mpls_ext_object_header = (const struct icmp_mpls_ext_object_header_t *)obj_tptr;
|
||||
ND_TCHECK(*icmp_mpls_ext_object_header);
|
||||
ND_TCHECK_SIZE(icmp_mpls_ext_object_header);
|
||||
obj_tlen = EXTRACT_BE_U_2(icmp_mpls_ext_object_header->length);
|
||||
obj_class_num = EXTRACT_U_1(icmp_mpls_ext_object_header->class_num);
|
||||
obj_ctype = EXTRACT_U_1(icmp_mpls_ext_object_header->ctype);
|
||||
|
@ -851,7 +851,7 @@ rpl_dio_print(netdissect_options *ndo,
|
||||
const struct nd_rpl_dio *dio = (const struct nd_rpl_dio *)bp;
|
||||
const char *dagid_str;
|
||||
|
||||
ND_TCHECK(*dio);
|
||||
ND_TCHECK_SIZE(dio);
|
||||
dagid_str = ip6addr_string (ndo, dio->rpl_dagid);
|
||||
|
||||
ND_PRINT((ndo, " [dagid:%s,seq:%u,instance:%u,rank:%u,%smop:%s,prf:%u]",
|
||||
@ -881,7 +881,7 @@ rpl_dao_print(netdissect_options *ndo,
|
||||
const char *dagid_str = "<elided>";
|
||||
uint8_t rpl_flags;
|
||||
|
||||
ND_TCHECK(*dao);
|
||||
ND_TCHECK_SIZE(dao);
|
||||
if (length < ND_RPL_DAO_MIN_LEN)
|
||||
goto tooshort;
|
||||
|
||||
@ -1281,7 +1281,7 @@ icmp6_print(netdissect_options *ndo,
|
||||
cp = (const u_char *)dp + length;
|
||||
in6 = (const struct in6_addr *)(dp + 1);
|
||||
for (; (const u_char *)in6 < cp; in6++) {
|
||||
ND_TCHECK(*in6);
|
||||
ND_TCHECK_SIZE(in6);
|
||||
ND_PRINT((ndo,", %s", ip6addr_string(ndo, in6)));
|
||||
}
|
||||
}
|
||||
@ -1518,7 +1518,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid)
|
||||
memcpy(&in6, opri + 1, 8);
|
||||
break;
|
||||
case 3:
|
||||
ND_TCHECK(*in6p);
|
||||
ND_TCHECK_SIZE(in6p);
|
||||
memcpy(&in6, opri + 1, sizeof(in6));
|
||||
break;
|
||||
default:
|
||||
|
@ -114,7 +114,7 @@ print_mtrace(netdissect_options *ndo,
|
||||
{
|
||||
const struct tr_query *tr = (const struct tr_query *)(bp + 8);
|
||||
|
||||
ND_TCHECK(*tr);
|
||||
ND_TCHECK_SIZE(tr);
|
||||
if (len < 8 + sizeof (struct tr_query)) {
|
||||
ND_PRINT((ndo, " [invalid len %d]", len));
|
||||
return;
|
||||
@ -136,7 +136,7 @@ print_mresp(netdissect_options *ndo,
|
||||
{
|
||||
const struct tr_query *tr = (const struct tr_query *)(bp + 8);
|
||||
|
||||
ND_TCHECK(*tr);
|
||||
ND_TCHECK_SIZE(tr);
|
||||
if (len < 8 + sizeof (struct tr_query)) {
|
||||
ND_PRINT((ndo, " [invalid len %d]", len));
|
||||
return;
|
||||
|
@ -113,7 +113,7 @@ igrp_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
||||
ND_PRINT((ndo, "igrp:"));
|
||||
|
||||
/* Header */
|
||||
ND_TCHECK(*hdr);
|
||||
ND_TCHECK_SIZE(hdr);
|
||||
nint = EXTRACT_BE_U_2(hdr->ig_ni);
|
||||
nsys = EXTRACT_BE_U_2(hdr->ig_ns);
|
||||
next = EXTRACT_BE_U_2(hdr->ig_nx);
|
||||
|
@ -97,7 +97,7 @@ ip6_finddst(netdissect_options *ndo, struct in6_addr *dst,
|
||||
* OK, we found it.
|
||||
*/
|
||||
dp = (const struct ip6_rthdr *)cp;
|
||||
ND_TCHECK(*dp);
|
||||
ND_TCHECK_SIZE(dp);
|
||||
len = EXTRACT_U_1(dp->ip6r_len);
|
||||
switch (EXTRACT_U_1(dp->ip6r_type)) {
|
||||
|
||||
@ -227,7 +227,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
||||
|
||||
ip6 = (const struct ip6_hdr *)bp;
|
||||
|
||||
ND_TCHECK(*ip6);
|
||||
ND_TCHECK_SIZE(ip6);
|
||||
if (length < sizeof (struct ip6_hdr)) {
|
||||
ND_PRINT((ndo, "truncated-ip6 %u", length));
|
||||
return;
|
||||
|
@ -43,7 +43,7 @@ ipcomp_print(netdissect_options *ndo, const u_char *bp)
|
||||
uint16_t cpi;
|
||||
|
||||
ipcomp = (const struct ipcomp *)bp;
|
||||
ND_TCHECK(*ipcomp);
|
||||
ND_TCHECK_SIZE(ipcomp);
|
||||
cpi = EXTRACT_BE_U_2(ipcomp->comp_cpi);
|
||||
|
||||
ND_PRINT((ndo, "IPComp(cpi=0x%04x)", cpi));
|
||||
|
@ -39,7 +39,7 @@ ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
||||
const ipnet_hdr_t *hdr;
|
||||
hdr = (const ipnet_hdr_t *)bp;
|
||||
|
||||
ND_TCHECK(*hdr);
|
||||
ND_TCHECK_SIZE(hdr);
|
||||
ND_PRINT((ndo, "%d > %d", EXTRACT_BE_U_4(hdr->iph_zsrc),
|
||||
EXTRACT_BE_U_4(hdr->iph_zdst)));
|
||||
|
||||
|
@ -1009,7 +1009,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_SA)));
|
||||
|
||||
p = (const struct ikev1_pl_sa *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
doi = EXTRACT_BE_U_4(p->doi);
|
||||
sit = EXTRACT_BE_U_4(p->sit);
|
||||
if (doi != 1) {
|
||||
@ -1041,7 +1041,7 @@ ikev1_sa_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
}
|
||||
|
||||
ext = (const struct isakmp_gen *)np;
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
cp = ikev1_sub_print(ndo, ISAKMP_NPTYPE_P, ext, ep, phase, doi, proto0,
|
||||
depth);
|
||||
@ -1065,7 +1065,7 @@ ikev1_p_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_P)));
|
||||
|
||||
p = (const struct ikev1_pl_p *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
ND_PRINT((ndo," #%u protoid=%s transform=%u",
|
||||
EXTRACT_U_1(p->p_no), PROTOIDSTR(EXTRACT_U_1(p->prot_id)),
|
||||
EXTRACT_U_1(p->num_t)));
|
||||
@ -1077,7 +1077,7 @@ ikev1_p_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
}
|
||||
|
||||
ext = (const struct isakmp_gen *)((const u_char *)(p + 1) + spi_size);
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
cp = ikev1_sub_print(ndo, ISAKMP_NPTYPE_T, ext, ep, phase, doi0,
|
||||
EXTRACT_U_1(p->prot_id), depth);
|
||||
@ -1232,7 +1232,7 @@ ikev1_t_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_T)));
|
||||
|
||||
p = (const struct ikev1_pl_t *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
|
||||
switch (proto) {
|
||||
case 1:
|
||||
@ -1292,7 +1292,7 @@ ikev1_ke_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
{
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_KE)));
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
/*
|
||||
* Our caller has ensured that the length is >= 4.
|
||||
*/
|
||||
@ -1331,7 +1331,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_ID)));
|
||||
|
||||
p = (const struct ikev1_pl_id *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
if (sizeof(*p) < item_len) {
|
||||
data = (const u_char *)(p + 1);
|
||||
len = item_len - sizeof(*p);
|
||||
@ -1363,7 +1363,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
uint8_t type, proto_id;
|
||||
|
||||
doi_p = (const struct ipsecdoi_id *)ext;
|
||||
ND_TCHECK(*doi_p);
|
||||
ND_TCHECK_SIZE(doi_p);
|
||||
type = EXTRACT_U_1(doi_p->type);
|
||||
ND_PRINT((ndo," idtype=%s", STR_OR_ID(type, ipsecidtypestr)));
|
||||
/* A protocol ID of 0 DOES NOT mean IPPROTO_IP! */
|
||||
@ -1495,7 +1495,7 @@ ikev1_cert_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_CERT)));
|
||||
|
||||
p = (const struct ikev1_pl_cert *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
/*
|
||||
* Our caller has ensured that the length is >= 4.
|
||||
*/
|
||||
@ -1529,7 +1529,7 @@ ikev1_cr_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_CR)));
|
||||
|
||||
p = (const struct ikev1_pl_cert *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
/*
|
||||
* Our caller has ensured that the length is >= 4.
|
||||
*/
|
||||
@ -1555,7 +1555,7 @@ ikev1_hash_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
{
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_HASH)));
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
/*
|
||||
* Our caller has ensured that the length is >= 4.
|
||||
*/
|
||||
@ -1580,7 +1580,7 @@ ikev1_sig_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
{
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_SIG)));
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
/*
|
||||
* Our caller has ensured that the length is >= 4.
|
||||
*/
|
||||
@ -1607,7 +1607,7 @@ ikev1_nonce_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
{
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_NONCE)));
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
/*
|
||||
* Our caller has ensured that the length is >= 4.
|
||||
*/
|
||||
@ -1691,7 +1691,7 @@ ikev1_n_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_N)));
|
||||
|
||||
p = (const struct ikev1_pl_n *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
doi = EXTRACT_BE_U_4(p->doi);
|
||||
proto = EXTRACT_U_1(p->prot_id);
|
||||
if (doi != 1) {
|
||||
@ -1801,7 +1801,7 @@ ikev1_d_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_D)));
|
||||
|
||||
p = (const struct ikev1_pl_d *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
doi = EXTRACT_BE_U_4(p->doi);
|
||||
proto = EXTRACT_U_1(p->prot_id);
|
||||
if (doi != 1) {
|
||||
@ -1839,7 +1839,7 @@ ikev1_vid_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
{
|
||||
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_VID)));
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
/*
|
||||
* Our caller has ensured that the length is >= 4.
|
||||
*/
|
||||
@ -1874,7 +1874,7 @@ ikev2_gen_print(netdissect_options *ndo, u_char tpay,
|
||||
{
|
||||
const struct isakmp_gen *p = (const struct isakmp_gen *)ext;
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(p->critical));
|
||||
|
||||
/*
|
||||
@ -1908,7 +1908,7 @@ ikev2_t_print(netdissect_options *ndo, int tcount,
|
||||
const u_char *ep2;
|
||||
|
||||
p = (const struct ikev2_t *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_T), EXTRACT_U_1(p->h.critical));
|
||||
|
||||
t_id = EXTRACT_BE_U_2(p->t_id);
|
||||
@ -1986,7 +1986,7 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
|
||||
u_int item_len;
|
||||
|
||||
p = (const struct ikev2_p *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
|
||||
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_P), EXTRACT_U_1(p->h.critical));
|
||||
|
||||
@ -2019,7 +2019,7 @@ ikev2_p_print(netdissect_options *ndo, u_char tpay _U_, int pcount _U_,
|
||||
ext = (const struct isakmp_gen *)cp;
|
||||
if (prop_length < sizeof(*ext))
|
||||
goto toolong;
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
/*
|
||||
* Since we can't have a payload length of less than 4 bytes,
|
||||
@ -2082,7 +2082,7 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay,
|
||||
u_char np;
|
||||
u_int item_len;
|
||||
|
||||
ND_TCHECK(*ext1);
|
||||
ND_TCHECK_SIZE(ext1);
|
||||
ikev2_pay_print(ndo, "sa", EXTRACT_U_1(ext1->critical));
|
||||
|
||||
/*
|
||||
@ -2102,7 +2102,7 @@ ikev2_sa_print(netdissect_options *ndo, u_char tpay,
|
||||
ext = (const struct isakmp_gen *)cp;
|
||||
if (sa_length < sizeof(*ext))
|
||||
goto toolong;
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
/*
|
||||
* Since we can't have a payload length of less than 4 bytes,
|
||||
@ -2161,7 +2161,7 @@ ikev2_ke_print(netdissect_options *ndo, u_char tpay,
|
||||
const struct ikev2_ke *k;
|
||||
|
||||
k = (const struct ikev2_ke *)ext;
|
||||
ND_TCHECK(*k);
|
||||
ND_TCHECK_SIZE(k);
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(k->h.critical));
|
||||
|
||||
if (item_len < 8) {
|
||||
@ -2195,7 +2195,7 @@ ikev2_ID_print(netdissect_options *ndo, u_char tpay,
|
||||
const unsigned char *typedata;
|
||||
|
||||
idp = (const struct ikev2_id *)ext;
|
||||
ND_TCHECK(*idp);
|
||||
ND_TCHECK_SIZE(idp);
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(idp->h.critical));
|
||||
|
||||
/*
|
||||
@ -2332,7 +2332,7 @@ ikev2_nonce_print(netdissect_options *ndo, u_char tpay,
|
||||
uint32_t phase _U_, uint32_t doi _U_,
|
||||
uint32_t proto _U_, int depth _U_)
|
||||
{
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
ikev2_pay_print(ndo, "nonce", EXTRACT_U_1(ext->critical));
|
||||
|
||||
/*
|
||||
@ -2370,7 +2370,7 @@ ikev2_n_print(netdissect_options *ndo, u_char tpay _U_,
|
||||
const char *notify_name;
|
||||
|
||||
p = (const struct ikev2_n *)ext;
|
||||
ND_TCHECK(*p);
|
||||
ND_TCHECK_SIZE(p);
|
||||
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_N), EXTRACT_U_1(p->h.critical));
|
||||
|
||||
showspi = 1;
|
||||
@ -2579,7 +2579,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay,
|
||||
const u_char *vid;
|
||||
u_int i, len;
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(ext->critical));
|
||||
|
||||
/*
|
||||
@ -2649,7 +2649,7 @@ ikev2_e_print(netdissect_options *ndo,
|
||||
uint8_t np;
|
||||
#endif
|
||||
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
ikev2_pay_print(ndo, NPSTR(tpay), EXTRACT_U_1(ext->critical));
|
||||
|
||||
dlen = item_len-4;
|
||||
@ -2721,7 +2721,7 @@ ike_sub0_print(netdissect_options *ndo,
|
||||
u_int item_len;
|
||||
|
||||
cp = (const u_char *)ext;
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
/*
|
||||
* Since we can't have a payload length of less than 4 bytes,
|
||||
@ -2762,7 +2762,7 @@ ikev1_sub_print(netdissect_options *ndo,
|
||||
cp = (const u_char *)ext;
|
||||
|
||||
while (np) {
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
item_len = EXTRACT_BE_U_2(ext->len);
|
||||
ND_TCHECK_LEN(ext, item_len);
|
||||
@ -2885,7 +2885,7 @@ ikev2_sub0_print(netdissect_options *ndo, const struct isakmp *base,
|
||||
u_int item_len;
|
||||
|
||||
cp = (const u_char *)ext;
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
/*
|
||||
* Since we can't have a payload length of less than 4 bytes,
|
||||
@ -2929,7 +2929,7 @@ ikev2_sub_print(netdissect_options *ndo,
|
||||
|
||||
cp = (const u_char *)ext;
|
||||
while (np) {
|
||||
ND_TCHECK(*ext);
|
||||
ND_TCHECK_SIZE(ext);
|
||||
|
||||
ND_TCHECK_LEN(ext, EXTRACT_BE_U_2(ext->len));
|
||||
|
||||
|
@ -780,7 +780,7 @@ clnp_print(netdissect_options *ndo,
|
||||
uint8_t rfd_error,rfd_error_major,rfd_error_minor;
|
||||
|
||||
clnp_header = (const struct clnp_header_t *) pptr;
|
||||
ND_TCHECK(*clnp_header);
|
||||
ND_TCHECK_SIZE(clnp_header);
|
||||
|
||||
li = EXTRACT_U_1(clnp_header->length_indicator);
|
||||
li_remaining = li;
|
||||
@ -892,7 +892,7 @@ clnp_print(netdissect_options *ndo,
|
||||
return (0);
|
||||
}
|
||||
clnp_segment_header = (const struct clnp_segment_header_t *) pptr;
|
||||
ND_TCHECK(*clnp_segment_header);
|
||||
ND_TCHECK_SIZE(clnp_segment_header);
|
||||
ND_PRINT((ndo, "\n\tData Unit ID: 0x%04x, Segment Offset: %u, Total PDU Length: %u",
|
||||
EXTRACT_BE_U_2(clnp_segment_header->data_unit_id),
|
||||
EXTRACT_BE_U_2(clnp_segment_header->segment_offset),
|
||||
@ -1116,7 +1116,7 @@ esis_print(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
esis_header = (const struct esis_header_t *) pptr;
|
||||
ND_TCHECK(*esis_header);
|
||||
ND_TCHECK_SIZE(esis_header);
|
||||
li = EXTRACT_U_1(esis_header->length_indicator);
|
||||
optr = pptr;
|
||||
|
||||
@ -1394,7 +1394,7 @@ isis_print_mcid(netdissect_options *ndo,
|
||||
{
|
||||
int i;
|
||||
|
||||
ND_TCHECK(*mcid);
|
||||
ND_TCHECK_SIZE(mcid);
|
||||
ND_PRINT((ndo, "ID: %u, Name: ", EXTRACT_U_1(mcid->format_id)));
|
||||
|
||||
if (fn_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
|
||||
@ -1733,7 +1733,7 @@ isis_print_tlv_ip_reach(netdissect_options *ndo,
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (!ND_TTEST(*tlv_ip_reach))
|
||||
if (!ND_TTEST_SIZE(tlv_ip_reach))
|
||||
return (0);
|
||||
|
||||
prefix_len = mask2plen(EXTRACT_IPV4_TO_HOST_ORDER(tlv_ip_reach->mask));
|
||||
@ -2274,7 +2274,7 @@ isis_print(netdissect_options *ndo,
|
||||
need it for parsing the checksum TLV and authentication
|
||||
TLV verification */
|
||||
isis_header = (const struct isis_common_header *)p;
|
||||
ND_TCHECK(*isis_header);
|
||||
ND_TCHECK_SIZE(isis_header);
|
||||
if (length < ISIS_COMMON_HEADER_SIZE)
|
||||
goto trunc;
|
||||
pptr = p+(ISIS_COMMON_HEADER_SIZE);
|
||||
@ -2400,7 +2400,7 @@ isis_print(netdissect_options *ndo,
|
||||
fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE)));
|
||||
return (0);
|
||||
}
|
||||
ND_TCHECK(*header_iih_lan);
|
||||
ND_TCHECK_SIZE(header_iih_lan);
|
||||
if (length < ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE)
|
||||
goto trunc;
|
||||
if (ndo->ndo_vflag == 0) {
|
||||
@ -2445,7 +2445,7 @@ isis_print(netdissect_options *ndo,
|
||||
fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE)));
|
||||
return (0);
|
||||
}
|
||||
ND_TCHECK(*header_iih_ptp);
|
||||
ND_TCHECK_SIZE(header_iih_ptp);
|
||||
if (length < ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE)
|
||||
goto trunc;
|
||||
if (ndo->ndo_vflag == 0) {
|
||||
@ -2486,7 +2486,7 @@ isis_print(netdissect_options *ndo,
|
||||
fixed_len, (unsigned long)ISIS_LSP_HEADER_SIZE));
|
||||
return (0);
|
||||
}
|
||||
ND_TCHECK(*header_lsp);
|
||||
ND_TCHECK_SIZE(header_lsp);
|
||||
if (length < ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE)
|
||||
goto trunc;
|
||||
if (ndo->ndo_vflag == 0) {
|
||||
@ -2544,7 +2544,7 @@ isis_print(netdissect_options *ndo,
|
||||
fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE)));
|
||||
return (0);
|
||||
}
|
||||
ND_TCHECK(*header_csnp);
|
||||
ND_TCHECK_SIZE(header_csnp);
|
||||
if (length < ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE)
|
||||
goto trunc;
|
||||
if (ndo->ndo_vflag == 0) {
|
||||
@ -2582,7 +2582,7 @@ isis_print(netdissect_options *ndo,
|
||||
fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE)));
|
||||
return (0);
|
||||
}
|
||||
ND_TCHECK(*header_psnp);
|
||||
ND_TCHECK_SIZE(header_psnp);
|
||||
if (length < ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE)
|
||||
goto trunc;
|
||||
if (ndo->ndo_vflag == 0) {
|
||||
@ -2742,7 +2742,7 @@ isis_print(netdissect_options *ndo,
|
||||
tptr++;
|
||||
tlv_is_reach = (const struct isis_tlv_is_reach *)tptr;
|
||||
while (tmp >= sizeof(struct isis_tlv_is_reach)) {
|
||||
ND_TCHECK(*tlv_is_reach);
|
||||
ND_TCHECK_SIZE(tlv_is_reach);
|
||||
ND_PRINT((ndo, "\n\t IS Neighbor: %s",
|
||||
isis_print_id(tlv_is_reach->neighbor_nodeid, NODE_ID_LEN)));
|
||||
isis_print_metric_block(ndo, &tlv_is_reach->isis_metric_block);
|
||||
@ -2754,7 +2754,7 @@ isis_print(netdissect_options *ndo,
|
||||
case ISIS_TLV_ESNEIGH:
|
||||
tlv_es_reach = (const struct isis_tlv_es_reach *)tptr;
|
||||
while (tmp >= sizeof(struct isis_tlv_es_reach)) {
|
||||
ND_TCHECK(*tlv_es_reach);
|
||||
ND_TCHECK_SIZE(tlv_es_reach);
|
||||
ND_PRINT((ndo, "\n\t ES Neighbor: %s",
|
||||
isis_print_id(tlv_es_reach->neighbor_sysid, SYSTEM_ID_LEN)));
|
||||
isis_print_metric_block(ndo, &tlv_es_reach->isis_metric_block);
|
||||
|
@ -473,7 +473,7 @@ juniper_ggsn_if_print(netdissect_options *ndo,
|
||||
p+=l2info.header_len;
|
||||
gh = (struct juniper_ggsn_header *)&l2info.cookie;
|
||||
|
||||
ND_TCHECK(*gh);
|
||||
ND_TCHECK_SIZE(gh);
|
||||
proto = EXTRACT_U_1(gh->proto);
|
||||
if (ndo->ndo_eflag) {
|
||||
ND_PRINT((ndo, "proto %s (%u), vlan %u: ",
|
||||
@ -526,7 +526,7 @@ juniper_es_if_print(netdissect_options *ndo,
|
||||
p+=l2info.header_len;
|
||||
ih = (const struct juniper_ipsec_header *)p;
|
||||
|
||||
ND_TCHECK(*ih);
|
||||
ND_TCHECK_SIZE(ih);
|
||||
switch (EXTRACT_U_1(ih->type)) {
|
||||
case JUNIPER_IPSEC_O_ESP_ENCRYPT_ESP_AUTHEN_TYPE:
|
||||
case JUNIPER_IPSEC_O_ESP_ENCRYPT_AH_AUTHEN_TYPE:
|
||||
@ -600,7 +600,7 @@ juniper_monitor_if_print(netdissect_options *ndo,
|
||||
p+=l2info.header_len;
|
||||
mh = (const struct juniper_monitor_header *)p;
|
||||
|
||||
ND_TCHECK(*mh);
|
||||
ND_TCHECK_SIZE(mh);
|
||||
if (ndo->ndo_eflag)
|
||||
ND_PRINT((ndo, "service-id %u, iif %u, pkt-type %u: ",
|
||||
EXTRACT_BE_U_4(mh->service_id),
|
||||
@ -640,7 +640,7 @@ juniper_services_if_print(netdissect_options *ndo,
|
||||
p+=l2info.header_len;
|
||||
sh = (const struct juniper_services_header *)p;
|
||||
|
||||
ND_TCHECK(*sh);
|
||||
ND_TCHECK_SIZE(sh);
|
||||
if (ndo->ndo_eflag)
|
||||
ND_PRINT((ndo, "service-id %u flags 0x%02x service-set-id 0x%04x iif %u: ",
|
||||
EXTRACT_U_1(sh->svc_id),
|
||||
|
@ -250,7 +250,7 @@ ldp_tlv_print(netdissect_options *ndo,
|
||||
int i;
|
||||
|
||||
ldp_tlv_header = (const struct ldp_tlv_header *)tptr;
|
||||
ND_TCHECK(*ldp_tlv_header);
|
||||
ND_TCHECK_SIZE(ldp_tlv_header);
|
||||
tlv_len=EXTRACT_BE_U_2(ldp_tlv_header->length);
|
||||
if (tlv_len + 4 > msg_tlen) {
|
||||
ND_PRINT((ndo, "\n\t\t TLV contents go past end of message"));
|
||||
@ -568,7 +568,7 @@ ldp_pdu_print(netdissect_options *ndo,
|
||||
int hexdump,processed;
|
||||
|
||||
ldp_com_header = (const struct ldp_common_header *)pptr;
|
||||
ND_TCHECK(*ldp_com_header);
|
||||
ND_TCHECK_SIZE(ldp_com_header);
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
|
@ -440,7 +440,7 @@ lmp_print(netdissect_options *ndo,
|
||||
|
||||
tptr=pptr;
|
||||
lmp_com_header = (const struct lmp_common_header *)pptr;
|
||||
ND_TCHECK(*lmp_com_header);
|
||||
ND_TCHECK_SIZE(lmp_com_header);
|
||||
|
||||
version_res = EXTRACT_BE_U_2(lmp_com_header->version_res);
|
||||
|
||||
|
@ -527,7 +527,7 @@ lspping_print(netdissect_options *ndo,
|
||||
lspping_com_header = (const struct lspping_common_header *)pptr;
|
||||
if (len < sizeof(struct lspping_common_header))
|
||||
goto tooshort;
|
||||
ND_TCHECK(*lspping_com_header);
|
||||
ND_TCHECK_SIZE(lspping_com_header);
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
|
@ -181,7 +181,7 @@ lwapp_control_print(netdissect_options *ndo,
|
||||
} else {
|
||||
lwapp_trans_header = (const struct lwapp_transport_header *)pptr;
|
||||
}
|
||||
ND_TCHECK(*lwapp_trans_header);
|
||||
ND_TCHECK_SIZE(lwapp_trans_header);
|
||||
version = EXTRACT_U_1(lwapp_trans_header->version);
|
||||
|
||||
/*
|
||||
@ -309,7 +309,7 @@ lwapp_data_print(netdissect_options *ndo,
|
||||
/* check if enough bytes for AP identity */
|
||||
ND_TCHECK_6(tptr);
|
||||
lwapp_trans_header = (const struct lwapp_transport_header *)pptr;
|
||||
ND_TCHECK(*lwapp_trans_header);
|
||||
ND_TCHECK_SIZE(lwapp_trans_header);
|
||||
version = EXTRACT_U_1(lwapp_trans_header->version);
|
||||
|
||||
/*
|
||||
|
@ -307,7 +307,7 @@ m3ua_print(netdissect_options *ndo,
|
||||
/* size includes the header */
|
||||
if (size < sizeof(struct m3ua_common_header))
|
||||
goto invalid;
|
||||
ND_TCHECK(*hdr);
|
||||
ND_TCHECK_SIZE(hdr);
|
||||
if (EXTRACT_U_1(hdr->v) != M3UA_REL_1_0)
|
||||
return;
|
||||
|
||||
|
@ -148,7 +148,7 @@ medsa_print(netdissect_options *ndo,
|
||||
u_short ether_type;
|
||||
|
||||
medsa = (const struct medsa_pkthdr *)bp;
|
||||
ND_TCHECK(*medsa);
|
||||
ND_TCHECK_SIZE(medsa);
|
||||
|
||||
if (!ndo->ndo_eflag)
|
||||
ND_PRINT((ndo, "MEDSA %d.%d:%d: ",
|
||||
|
@ -72,7 +72,7 @@ mobile_print(netdissect_options *ndo, const u_char *bp, u_int length)
|
||||
|
||||
mob = (const struct mobile_ip *)bp;
|
||||
|
||||
if (length < MOBILE_SIZE || !ND_TTEST(*mob)) {
|
||||
if (length < MOBILE_SIZE || !ND_TTEST_SIZE(mob)) {
|
||||
ND_PRINT((ndo, "[|mobile]"));
|
||||
return;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ msnlb_print(netdissect_options *ndo, const u_char *bp)
|
||||
const struct msnlb_heartbeat_pkt *hb;
|
||||
|
||||
hb = (const struct msnlb_heartbeat_pkt *)bp;
|
||||
ND_TCHECK(*hb);
|
||||
ND_TCHECK_SIZE(hb);
|
||||
|
||||
ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,",
|
||||
EXTRACT_LE_U_4((hb->host_prio))));
|
||||
|
@ -1425,7 +1425,7 @@ parsefsinfo(netdissect_options *ndo,
|
||||
return (1);
|
||||
|
||||
sfp = (const struct nfsv3_fsinfo *)dp;
|
||||
ND_TCHECK(*sfp);
|
||||
ND_TCHECK_SIZE(sfp);
|
||||
ND_PRINT((ndo, " rtmax %u rtpref %u wtmax %u wtpref %u dtpref %u",
|
||||
EXTRACT_BE_U_4(&sfp->fs_rtmax),
|
||||
EXTRACT_BE_U_4(&sfp->fs_rtpref),
|
||||
@ -1463,7 +1463,7 @@ parsepathconf(netdissect_options *ndo,
|
||||
return (1);
|
||||
|
||||
spp = (const struct nfsv3_pathconf *)dp;
|
||||
ND_TCHECK(*spp);
|
||||
ND_TCHECK_SIZE(spp);
|
||||
|
||||
ND_PRINT((ndo, " linkmax %u namemax %u %s %s %s %s",
|
||||
EXTRACT_BE_U_4(&spp->pc_linkmax),
|
||||
|
@ -239,7 +239,7 @@ olsr_print_lq_neighbor4(netdissect_options *ndo,
|
||||
while (hello_len >= sizeof(struct olsr_lq_neighbor4)) {
|
||||
|
||||
lq_neighbor = (const struct olsr_lq_neighbor4 *)msg_data;
|
||||
if (!ND_TTEST(*lq_neighbor))
|
||||
if (!ND_TTEST_SIZE(lq_neighbor))
|
||||
return (-1);
|
||||
|
||||
ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2f%%"
|
||||
@ -263,7 +263,7 @@ olsr_print_lq_neighbor6(netdissect_options *ndo,
|
||||
while (hello_len >= sizeof(struct olsr_lq_neighbor6)) {
|
||||
|
||||
lq_neighbor = (const struct olsr_lq_neighbor6 *)msg_data;
|
||||
if (!ND_TTEST(*lq_neighbor))
|
||||
if (!ND_TTEST_SIZE(lq_neighbor))
|
||||
return (-1);
|
||||
|
||||
ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2f%%"
|
||||
|
10
print-ospf.c
10
print-ospf.c
@ -593,7 +593,7 @@ ospf_print_tos_metrics(netdissect_options *ndo,
|
||||
* All but the first metric contain a valid topology id.
|
||||
*/
|
||||
while (toscount != 0) {
|
||||
ND_TCHECK(*tos);
|
||||
ND_TCHECK_SIZE(tos);
|
||||
tos_type = EXTRACT_U_1(tos->metrics.tos_type);
|
||||
ND_PRINT((ndo, "\n\t\ttopology %s (%u), metric %u",
|
||||
tok2str(ospf_topology_values, "Unknown",
|
||||
@ -647,7 +647,7 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
ND_TCHECK(lsap->lsa_un.un_rla.rla_link);
|
||||
rlp = lsap->lsa_un.un_rla.rla_link;
|
||||
while (j--) {
|
||||
ND_TCHECK(*rlp);
|
||||
ND_TCHECK_SIZE(rlp);
|
||||
switch (EXTRACT_U_1(rlp->un_tos.link.link_type)) {
|
||||
|
||||
case RLA_TYPE_VIRTUAL:
|
||||
@ -694,7 +694,7 @@ ospf_print_lsa(netdissect_options *ndo,
|
||||
ipaddr_string(ndo, &lsap->lsa_un.un_nla.nla_mask)));
|
||||
ap = lsap->lsa_un.un_nla.nla_router;
|
||||
while ((const u_char *)ap < ls_end) {
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap)));
|
||||
++ap;
|
||||
}
|
||||
@ -1017,7 +1017,7 @@ ospf_decode_v2(netdissect_options *ndo,
|
||||
if ((const u_char *)ap < dataend)
|
||||
ND_PRINT((ndo, "\n\t Neighbor List:"));
|
||||
while ((const u_char *)ap < dataend) {
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap)));
|
||||
++ap;
|
||||
}
|
||||
@ -1047,7 +1047,7 @@ ospf_decode_v2(netdissect_options *ndo,
|
||||
case OSPF_TYPE_LS_REQ:
|
||||
lsrp = op->ospf_lsr;
|
||||
while ((const u_char *)lsrp < dataend) {
|
||||
ND_TCHECK(*lsrp);
|
||||
ND_TCHECK_SIZE(lsrp);
|
||||
|
||||
ND_PRINT((ndo, "\n\t Advertising Router: %s, %s LSA (%u)",
|
||||
ipaddr_string(ndo, &lsrp->ls_router),
|
||||
|
@ -505,7 +505,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (*rlp))
|
||||
return (1);
|
||||
lsa_length -= sizeof (*rlp);
|
||||
ND_TCHECK(*rlp);
|
||||
ND_TCHECK_SIZE(rlp);
|
||||
switch (EXTRACT_U_1(rlp->link_type)) {
|
||||
|
||||
case RLA_TYPE_VIRTUAL:
|
||||
@ -557,7 +557,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (*ap))
|
||||
return (1);
|
||||
lsa_length -= sizeof (*ap);
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
ND_PRINT((ndo, "\n\t\t%s", ipaddr_string(ndo, ap)));
|
||||
++ap;
|
||||
}
|
||||
@ -608,7 +608,7 @@ ospf6_print_lsa(netdissect_options *ndo,
|
||||
if (lsa_length < sizeof (*fwdaddr6))
|
||||
return (1);
|
||||
lsa_length -= sizeof (*fwdaddr6);
|
||||
ND_TCHECK(*fwdaddr6);
|
||||
ND_TCHECK_SIZE(fwdaddr6);
|
||||
ND_PRINT((ndo, " forward %s",
|
||||
ip6addr_string(ndo, fwdaddr6)));
|
||||
tptr += sizeof(*fwdaddr6);
|
||||
@ -761,7 +761,7 @@ ospf6_decode_v3(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "\n\t Neighbor List:"));
|
||||
ap = hellop->hello_neighbor;
|
||||
while ((const u_char *)ap < dataend) {
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap)));
|
||||
++ap;
|
||||
}
|
||||
@ -799,7 +799,7 @@ ospf6_decode_v3(netdissect_options *ndo,
|
||||
if (ndo->ndo_vflag > 1) {
|
||||
lsrp = (const struct lsr6 *)((const uint8_t *)op + OSPF6HDR_LEN);
|
||||
while ((const u_char *)lsrp < dataend) {
|
||||
ND_TCHECK(*lsrp);
|
||||
ND_TCHECK_SIZE(lsrp);
|
||||
ND_PRINT((ndo, "\n\t Advertising Router %s",
|
||||
ipaddr_string(ndo, &lsrp->ls_router)));
|
||||
ospf6_print_ls_type(ndo,
|
||||
|
@ -134,7 +134,7 @@ pflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h,
|
||||
}
|
||||
|
||||
/* print what we know */
|
||||
ND_TCHECK(*hdr);
|
||||
ND_TCHECK_SIZE(hdr);
|
||||
if (ndo->ndo_eflag)
|
||||
pflog_print(ndo, hdr);
|
||||
|
||||
|
16
print-pgm.c
16
print-pgm.c
@ -205,7 +205,7 @@ pgm_print(netdissect_options *ndo,
|
||||
}
|
||||
}
|
||||
|
||||
ND_TCHECK(*pgm);
|
||||
ND_TCHECK_SIZE(pgm);
|
||||
|
||||
ND_PRINT((ndo, "PGM, length %u", EXTRACT_BE_U_2(pgm->pgm_length)));
|
||||
|
||||
@ -225,7 +225,7 @@ pgm_print(netdissect_options *ndo,
|
||||
const struct pgm_spm *spm;
|
||||
|
||||
spm = (const struct pgm_spm *)(pgm + 1);
|
||||
ND_TCHECK(*spm);
|
||||
ND_TCHECK_SIZE(spm);
|
||||
bp = (const u_char *) (spm + 1);
|
||||
|
||||
switch (EXTRACT_BE_U_2(spm->pgms_nla_afi)) {
|
||||
@ -256,7 +256,7 @@ pgm_print(netdissect_options *ndo,
|
||||
const struct pgm_poll *poll_msg;
|
||||
|
||||
poll_msg = (const struct pgm_poll *)(pgm + 1);
|
||||
ND_TCHECK(*poll_msg);
|
||||
ND_TCHECK_SIZE(poll_msg);
|
||||
ND_PRINT((ndo, "POLL seq %u round %u",
|
||||
EXTRACT_BE_U_4(poll_msg->pgmp_seq),
|
||||
EXTRACT_BE_U_2(poll_msg->pgmp_round)));
|
||||
@ -268,7 +268,7 @@ pgm_print(netdissect_options *ndo,
|
||||
uint32_t ivl, rnd, mask;
|
||||
|
||||
polr = (const struct pgm_polr *)(pgm + 1);
|
||||
ND_TCHECK(*polr);
|
||||
ND_TCHECK_SIZE(polr);
|
||||
bp = (const u_char *) (polr + 1);
|
||||
|
||||
switch (EXTRACT_BE_U_2(polr->pgmp_nla_afi)) {
|
||||
@ -308,7 +308,7 @@ pgm_print(netdissect_options *ndo,
|
||||
const struct pgm_data *odata;
|
||||
|
||||
odata = (const struct pgm_data *)(pgm + 1);
|
||||
ND_TCHECK(*odata);
|
||||
ND_TCHECK_SIZE(odata);
|
||||
ND_PRINT((ndo, "ODATA trail %u seq %u",
|
||||
EXTRACT_BE_U_4(odata->pgmd_trailseq),
|
||||
EXTRACT_BE_U_4(odata->pgmd_seq)));
|
||||
@ -320,7 +320,7 @@ pgm_print(netdissect_options *ndo,
|
||||
const struct pgm_data *rdata;
|
||||
|
||||
rdata = (const struct pgm_data *)(pgm + 1);
|
||||
ND_TCHECK(*rdata);
|
||||
ND_TCHECK_SIZE(rdata);
|
||||
ND_PRINT((ndo, "RDATA trail %u seq %u",
|
||||
EXTRACT_BE_U_4(rdata->pgmd_trailseq),
|
||||
EXTRACT_BE_U_4(rdata->pgmd_seq)));
|
||||
@ -335,7 +335,7 @@ pgm_print(netdissect_options *ndo,
|
||||
char source_buf[INET6_ADDRSTRLEN], group_buf[INET6_ADDRSTRLEN];
|
||||
|
||||
nak = (const struct pgm_nak *)(pgm + 1);
|
||||
ND_TCHECK(*nak);
|
||||
ND_TCHECK_SIZE(nak);
|
||||
bp = (const u_char *) (nak + 1);
|
||||
|
||||
/*
|
||||
@ -405,7 +405,7 @@ pgm_print(netdissect_options *ndo,
|
||||
const struct pgm_ack *ack;
|
||||
|
||||
ack = (const struct pgm_ack *)(pgm + 1);
|
||||
ND_TCHECK(*ack);
|
||||
ND_TCHECK_SIZE(ack);
|
||||
ND_PRINT((ndo, "ACK seq %u",
|
||||
EXTRACT_BE_U_4(ack->pgma_rx_max_seq)));
|
||||
bp = (const u_char *) (ack + 1);
|
||||
|
@ -1065,7 +1065,7 @@ radius_attrs_print(netdissect_options *ndo,
|
||||
{
|
||||
if (length < 2)
|
||||
goto trunc;
|
||||
ND_TCHECK(*rad_attr);
|
||||
ND_TCHECK_SIZE(rad_attr);
|
||||
|
||||
type = EXTRACT_U_1(rad_attr->type);
|
||||
len = EXTRACT_U_1(rad_attr->len);
|
||||
|
@ -141,7 +141,7 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length)
|
||||
ND_PRINT((ndo, " ripng-req %u:", j));
|
||||
for (ni = rp->rip6_nets; length_left >= sizeof(*ni);
|
||||
length_left -= sizeof(*ni), ++ni) {
|
||||
ND_TCHECK(*ni);
|
||||
ND_TCHECK_SIZE(ni);
|
||||
if (ndo->ndo_vflag > 1)
|
||||
ND_PRINT((ndo, "\n\t"));
|
||||
else
|
||||
@ -163,7 +163,7 @@ ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length)
|
||||
ND_PRINT((ndo, " ripng-resp %u:", j));
|
||||
for (ni = rp->rip6_nets; length_left >= sizeof(*ni);
|
||||
length_left -= sizeof(*ni), ++ni) {
|
||||
ND_TCHECK(*ni);
|
||||
ND_TCHECK_SIZE(ni);
|
||||
if (ndo->ndo_vflag > 1)
|
||||
ND_PRINT((ndo, "\n\t"));
|
||||
else
|
||||
|
@ -1888,7 +1888,7 @@ rsvp_print(netdissect_options *ndo,
|
||||
tptr=pptr;
|
||||
|
||||
rsvp_com_header = (const struct rsvp_common_header *)pptr;
|
||||
ND_TCHECK(*rsvp_com_header);
|
||||
ND_TCHECK_SIZE(rsvp_com_header);
|
||||
version_flags = EXTRACT_U_1(rsvp_com_header->version_flags);
|
||||
|
||||
/*
|
||||
@ -1948,7 +1948,7 @@ rsvp_print(netdissect_options *ndo,
|
||||
subtptr=subpptr;
|
||||
|
||||
rsvp_com_header = (const struct rsvp_common_header *)subpptr;
|
||||
ND_TCHECK(*rsvp_com_header);
|
||||
ND_TCHECK_SIZE(rsvp_com_header);
|
||||
version_flags = EXTRACT_U_1(rsvp_com_header->version_flags);
|
||||
|
||||
/*
|
||||
|
@ -470,7 +470,7 @@ sctp_print(netdissect_options *ndo,
|
||||
return;
|
||||
}
|
||||
sctpPktHdr = (const struct sctpHeader*) bp;
|
||||
ND_TCHECK(*sctpPktHdr);
|
||||
ND_TCHECK_SIZE(sctpPktHdr);
|
||||
sctpPacketLengthRemaining = sctpPacketLength;
|
||||
|
||||
sourcePort = EXTRACT_BE_U_2(&sctpPktHdr->source);
|
||||
@ -526,7 +526,7 @@ sctp_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "%s%u) [chunk descriptor cut off at end of packet]", sep, chunkCount+1));
|
||||
break;
|
||||
}
|
||||
ND_TCHECK(*chunkDescPtr);
|
||||
ND_TCHECK_SIZE(chunkDescPtr);
|
||||
chunkLength = EXTRACT_BE_U_2(&chunkDescPtr->chunkLength);
|
||||
if (chunkLength < sizeof(*chunkDescPtr)) {
|
||||
ND_PRINT((ndo, "%s%u) [Bad chunk length %u, < size of chunk descriptor]", sep, chunkCount+1, chunkLength));
|
||||
|
@ -308,7 +308,7 @@ print_sflow_counter_generic(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_gen_counter = (const struct sflow_generic_counter_t *)pointer;
|
||||
ND_TCHECK(*sflow_gen_counter);
|
||||
ND_TCHECK_SIZE(sflow_gen_counter);
|
||||
ND_PRINT((ndo, "\n\t ifindex %u, iftype %u, ifspeed %" PRIu64 ", ifdirection %u (%s)",
|
||||
EXTRACT_BE_U_4(sflow_gen_counter->ifindex),
|
||||
EXTRACT_BE_U_4(sflow_gen_counter->iftype),
|
||||
@ -357,7 +357,7 @@ print_sflow_counter_ethernet(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_eth_counter = (const struct sflow_ethernet_counter_t *)pointer;
|
||||
ND_TCHECK(*sflow_eth_counter);
|
||||
ND_TCHECK_SIZE(sflow_eth_counter);
|
||||
ND_PRINT((ndo, "\n\t align errors %u, fcs errors %u, single collision %u, multiple collision %u, test error %u",
|
||||
EXTRACT_BE_U_4(sflow_eth_counter->alignerrors),
|
||||
EXTRACT_BE_U_4(sflow_eth_counter->fcserrors),
|
||||
@ -398,7 +398,7 @@ print_sflow_counter_basevg(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_100basevg_counter = (const struct sflow_100basevg_counter_t *)pointer;
|
||||
ND_TCHECK(*sflow_100basevg_counter);
|
||||
ND_TCHECK_SIZE(sflow_100basevg_counter);
|
||||
ND_PRINT((ndo, "\n\t in high prio frames %u, in high prio octets %" PRIu64,
|
||||
EXTRACT_BE_U_4(sflow_100basevg_counter->in_highpriority_frames),
|
||||
EXTRACT_BE_U_8(sflow_100basevg_counter->in_highpriority_octets)));
|
||||
@ -438,7 +438,7 @@ print_sflow_counter_vlan(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_vlan_counter = (const struct sflow_vlan_counter_t *)pointer;
|
||||
ND_TCHECK(*sflow_vlan_counter);
|
||||
ND_TCHECK_SIZE(sflow_vlan_counter);
|
||||
ND_PRINT((ndo, "\n\t vlan_id %u, octets %" PRIu64
|
||||
", unicast_pkt %u, multicast_pkt %u, broadcast_pkt %u, discards %u",
|
||||
EXTRACT_BE_U_4(sflow_vlan_counter->vlan_id),
|
||||
@ -472,7 +472,7 @@ print_sflow_counter_processor(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_processor_counter = (const struct sflow_processor_counter_t *)pointer;
|
||||
ND_TCHECK(*sflow_processor_counter);
|
||||
ND_TCHECK_SIZE(sflow_processor_counter);
|
||||
ND_PRINT((ndo, "\n\t 5sec %u, 1min %u, 5min %u, total_mem %" PRIu64
|
||||
", total_mem %" PRIu64,
|
||||
EXTRACT_BE_U_4(sflow_processor_counter->five_sec_util),
|
||||
@ -508,7 +508,7 @@ sflow_print_counter_records(netdissect_options *ndo,
|
||||
if (tlen < sizeof(struct sflow_counter_record_t))
|
||||
return 1;
|
||||
sflow_counter_record = (const struct sflow_counter_record_t *)tptr;
|
||||
ND_TCHECK(*sflow_counter_record);
|
||||
ND_TCHECK_SIZE(sflow_counter_record);
|
||||
|
||||
enterprise = EXTRACT_BE_U_4(sflow_counter_record->format);
|
||||
counter_type = enterprise & 0x0FFF;
|
||||
@ -580,7 +580,7 @@ sflow_print_counter_sample(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_counter_sample = (const struct sflow_counter_sample_t *)pointer;
|
||||
ND_TCHECK(*sflow_counter_sample);
|
||||
ND_TCHECK_SIZE(sflow_counter_sample);
|
||||
|
||||
nrecords = EXTRACT_BE_U_4(sflow_counter_sample->records);
|
||||
|
||||
@ -610,7 +610,7 @@ sflow_print_expanded_counter_sample(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_expanded_counter_sample = (const struct sflow_expanded_counter_sample_t *)pointer;
|
||||
ND_TCHECK(*sflow_expanded_counter_sample);
|
||||
ND_TCHECK_SIZE(sflow_expanded_counter_sample);
|
||||
|
||||
nrecords = EXTRACT_BE_U_4(sflow_expanded_counter_sample->records);
|
||||
|
||||
@ -638,7 +638,7 @@ print_sflow_raw_packet(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_flow_raw = (const struct sflow_expanded_flow_raw_t *)pointer;
|
||||
ND_TCHECK(*sflow_flow_raw);
|
||||
ND_TCHECK_SIZE(sflow_flow_raw);
|
||||
ND_PRINT((ndo, "\n\t protocol %s (%u), length %u, stripped bytes %u, header_size %u",
|
||||
tok2str(sflow_flow_raw_protocol_values,"Unknown",EXTRACT_BE_U_4(sflow_flow_raw->protocol)),
|
||||
EXTRACT_BE_U_4(sflow_flow_raw->protocol),
|
||||
@ -665,7 +665,7 @@ print_sflow_ethernet_frame(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_ethernet_frame = (const struct sflow_ethernet_frame_t *)pointer;
|
||||
ND_TCHECK(*sflow_ethernet_frame);
|
||||
ND_TCHECK_SIZE(sflow_ethernet_frame);
|
||||
|
||||
ND_PRINT((ndo, "\n\t frame len %u, type %u",
|
||||
EXTRACT_BE_U_4(sflow_ethernet_frame->length),
|
||||
@ -687,7 +687,7 @@ print_sflow_extended_switch_data(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_extended_sw_data = (const struct sflow_extended_switch_data_t *)pointer;
|
||||
ND_TCHECK(*sflow_extended_sw_data);
|
||||
ND_TCHECK_SIZE(sflow_extended_sw_data);
|
||||
ND_PRINT((ndo, "\n\t src vlan %u, src pri %u, dst vlan %u, dst pri %u",
|
||||
EXTRACT_BE_U_4(sflow_extended_sw_data->src_vlan),
|
||||
EXTRACT_BE_U_4(sflow_extended_sw_data->src_pri),
|
||||
@ -722,7 +722,7 @@ sflow_print_flow_records(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_flow_record = (const struct sflow_flow_record_t *)tptr;
|
||||
ND_TCHECK(*sflow_flow_record);
|
||||
ND_TCHECK_SIZE(sflow_flow_record);
|
||||
|
||||
/* so, the funky encoding means we cannot blythly mask-off
|
||||
bits, we must also check the enterprise. */
|
||||
@ -801,7 +801,7 @@ sflow_print_flow_sample(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_flow_sample = (const struct sflow_flow_sample_t *)pointer;
|
||||
ND_TCHECK(*sflow_flow_sample);
|
||||
ND_TCHECK_SIZE(sflow_flow_sample);
|
||||
|
||||
nrecords = EXTRACT_BE_U_4(sflow_flow_sample->records);
|
||||
|
||||
@ -835,7 +835,7 @@ sflow_print_expanded_flow_sample(netdissect_options *ndo,
|
||||
return 1;
|
||||
|
||||
sflow_expanded_flow_sample = (const struct sflow_expanded_flow_sample_t *)pointer;
|
||||
ND_TCHECK(*sflow_expanded_flow_sample);
|
||||
ND_TCHECK_SIZE(sflow_expanded_flow_sample);
|
||||
|
||||
nrecords = EXTRACT_BE_U_4(sflow_expanded_flow_sample->records);
|
||||
|
||||
@ -871,7 +871,7 @@ sflow_print(netdissect_options *ndo,
|
||||
tptr = pptr;
|
||||
tlen = len;
|
||||
sflow_datagram = (const struct sflow_datagram_t *)pptr;
|
||||
ND_TCHECK(*sflow_datagram);
|
||||
ND_TCHECK_SIZE(sflow_datagram);
|
||||
|
||||
/*
|
||||
* Sanity checking of the header.
|
||||
@ -910,7 +910,7 @@ sflow_print(netdissect_options *ndo,
|
||||
|
||||
while (nsamples > 0 && tlen > 0) {
|
||||
sflow_sample = (const struct sflow_sample_header *)tptr;
|
||||
ND_TCHECK(*sflow_sample);
|
||||
ND_TCHECK_SIZE(sflow_sample);
|
||||
|
||||
sflow_sample_type = (EXTRACT_BE_U_4(sflow_sample->format)&0x0FFF);
|
||||
sflow_sample_len = EXTRACT_BE_U_4(sflow_sample->len);
|
||||
|
@ -214,7 +214,7 @@ tcp_print(netdissect_options *ndo,
|
||||
}
|
||||
}
|
||||
|
||||
ND_TCHECK(*tp);
|
||||
ND_TCHECK_SIZE(tp);
|
||||
|
||||
hlen = TH_OFF(tp) * 4;
|
||||
|
||||
|
@ -259,7 +259,7 @@ print_internal(netdissect_options *ndo, const struct internal_tipc_pkthdr *ap)
|
||||
tok2str(tipcmtype_values, "Unknown", mtype), w1));
|
||||
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_TCHECK(*ap);
|
||||
ND_TCHECK_SIZE(ap);
|
||||
seq_gap = TIPC_SEQ_GAP(w1);
|
||||
broadcast_ack = TIPC_BROADCAST_ACK(w1);
|
||||
w2 = EXTRACT_BE_U_4(ap->w2);
|
||||
|
@ -229,7 +229,7 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
|
||||
double ts, dts;
|
||||
if ((const u_char *)(rh + 1) > ep)
|
||||
goto trunc;
|
||||
ND_TCHECK(*rh);
|
||||
ND_TCHECK_SIZE(rh);
|
||||
len = (EXTRACT_BE_U_2(rh->rh_len) + 1) * 4;
|
||||
flags = EXTRACT_BE_U_2(rh->rh_flags);
|
||||
cnt = (flags >> 8) & 0x1f;
|
||||
@ -243,7 +243,7 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
|
||||
ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(rh->rh_ssrc)));
|
||||
if ((const u_char *)(sr + 1) > ep)
|
||||
goto trunc;
|
||||
ND_TCHECK(*sr);
|
||||
ND_TCHECK_SIZE(sr);
|
||||
ts = (double)(EXTRACT_BE_U_4(sr->sr_ntp.upper)) +
|
||||
((double)(EXTRACT_BE_U_4(sr->sr_ntp.lower)) /
|
||||
4294967296.0);
|
||||
@ -281,7 +281,7 @@ rtcp_print(netdissect_options *ndo, const u_char *hdr, const u_char *ep)
|
||||
while (--cnt >= 0) {
|
||||
if ((const u_char *)(rr + 1) > ep)
|
||||
goto trunc;
|
||||
ND_TCHECK(*rr);
|
||||
ND_TCHECK_SIZE(rr);
|
||||
if (ndo->ndo_vflag)
|
||||
ND_PRINT((ndo, " %u", EXTRACT_BE_U_4(rr->rr_srcid)));
|
||||
ts = (double)(EXTRACT_BE_U_4(rr->rr_lsr)) / 65536.;
|
||||
|
@ -111,7 +111,7 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
|
||||
tptr=pptr;
|
||||
tlen = len;
|
||||
vqp_common_header = (const struct vqp_common_header_t *)pptr;
|
||||
ND_TCHECK(*vqp_common_header);
|
||||
ND_TCHECK_SIZE(vqp_common_header);
|
||||
if (sizeof(struct vqp_common_header_t) > tlen)
|
||||
goto trunc;
|
||||
version = EXTRACT_U_1(vqp_common_header->version);
|
||||
@ -154,7 +154,7 @@ vqp_print(netdissect_options *ndo, const u_char *pptr, u_int len)
|
||||
while (nitems != 0 && tlen != 0) {
|
||||
|
||||
vqp_obj_tlv = (const struct vqp_obj_tlv_t *)tptr;
|
||||
ND_TCHECK(*vqp_obj_tlv);
|
||||
ND_TCHECK_SIZE(vqp_obj_tlv);
|
||||
if (sizeof(struct vqp_obj_tlv_t) > tlen)
|
||||
goto trunc;
|
||||
vqp_obj_type = EXTRACT_BE_U_4(vqp_obj_tlv->obj_type);
|
||||
|
@ -253,7 +253,7 @@ vtp_print (netdissect_options *ndo,
|
||||
vtp_vlan = (const struct vtp_vlan_*)tptr;
|
||||
if (len < VTP_VLAN_INFO_FIXED_PART_LEN)
|
||||
goto trunc;
|
||||
ND_TCHECK(*vtp_vlan);
|
||||
ND_TCHECK_SIZE(vtp_vlan);
|
||||
ND_PRINT((ndo, "\n\tVLAN info status %s, type %s, VLAN-id %u, MTU %u, SAID 0x%08x, Name ",
|
||||
tok2str(vtp_vlan_status,"Unknown",EXTRACT_U_1(vtp_vlan->status)),
|
||||
tok2str(vtp_vlan_type_values,"Unknown",EXTRACT_U_1(vtp_vlan->type)),
|
||||
|
22
print-wb.c
22
print-wb.c
@ -187,7 +187,7 @@ wb_id(netdissect_options *ndo,
|
||||
u_int nid;
|
||||
|
||||
ND_PRINT((ndo, " wb-id:"));
|
||||
if (len < sizeof(*id) || !ND_TTEST(*id))
|
||||
if (len < sizeof(*id) || !ND_TTEST_SIZE(id))
|
||||
return (-1);
|
||||
len -= sizeof(*id);
|
||||
|
||||
@ -210,7 +210,7 @@ wb_id(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
c = '<';
|
||||
for (i = 0; i < nid && ND_TTEST(*io); ++io, ++i) {
|
||||
for (i = 0; i < nid && ND_TTEST_SIZE(io); ++io, ++i) {
|
||||
ND_PRINT((ndo, "%c%s:%u",
|
||||
c, ipaddr_string(ndo, &io->id), EXTRACT_BE_U_4(io->off)));
|
||||
c = ',';
|
||||
@ -227,7 +227,7 @@ wb_rreq(netdissect_options *ndo,
|
||||
const struct pkt_rreq *rreq, u_int len)
|
||||
{
|
||||
ND_PRINT((ndo, " wb-rreq:"));
|
||||
if (len < sizeof(*rreq) || !ND_TTEST(*rreq))
|
||||
if (len < sizeof(*rreq) || !ND_TTEST_SIZE(rreq))
|
||||
return (-1);
|
||||
|
||||
ND_PRINT((ndo, " please repair %s %s:%u<%u:%u>",
|
||||
@ -244,7 +244,7 @@ wb_preq(netdissect_options *ndo,
|
||||
const struct pkt_preq *preq, u_int len)
|
||||
{
|
||||
ND_PRINT((ndo, " wb-preq:"));
|
||||
if (len < sizeof(*preq) || !ND_TTEST(*preq))
|
||||
if (len < sizeof(*preq) || !ND_TTEST_SIZE(preq))
|
||||
return (-1);
|
||||
|
||||
ND_PRINT((ndo, " need %u/%s:%u",
|
||||
@ -263,11 +263,11 @@ wb_prep(netdissect_options *ndo,
|
||||
const u_char *ep = ndo->ndo_snapend;
|
||||
|
||||
ND_PRINT((ndo, " wb-prep:"));
|
||||
if (len < sizeof(*prep) || !ND_TTEST(*prep))
|
||||
if (len < sizeof(*prep) || !ND_TTEST_SIZE(prep))
|
||||
return (-1);
|
||||
n = EXTRACT_BE_U_4(prep->pp_n);
|
||||
ps = (const struct pgstate *)(prep + 1);
|
||||
while (n != 0 && ND_TTEST(*ps)) {
|
||||
while (n != 0 && ND_TTEST_SIZE(ps)) {
|
||||
const struct id_off *io, *ie;
|
||||
char c = '<';
|
||||
|
||||
@ -276,7 +276,7 @@ wb_prep(netdissect_options *ndo,
|
||||
ipaddr_string(ndo, &ps->page.p_sid),
|
||||
EXTRACT_BE_U_4(ps->page.p_uid)));
|
||||
io = (const struct id_off *)(ps + 1);
|
||||
for (ie = io + EXTRACT_U_1(ps->nid); io < ie && ND_TTEST(*io); ++io) {
|
||||
for (ie = io + EXTRACT_U_1(ps->nid); io < ie && ND_TTEST_SIZE(io); ++io) {
|
||||
ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id),
|
||||
EXTRACT_BE_U_4(io->off)));
|
||||
c = ',';
|
||||
@ -318,7 +318,7 @@ wb_dops(netdissect_options *ndo, const struct pkt_dop *dop,
|
||||
for ( ; ss <= es; ++ss) {
|
||||
u_int t;
|
||||
|
||||
if (!ND_TTEST(*dh)) {
|
||||
if (!ND_TTEST_SIZE(dh)) {
|
||||
ND_PRINT((ndo, "%s", tstr));
|
||||
break;
|
||||
}
|
||||
@ -352,7 +352,7 @@ wb_rrep(netdissect_options *ndo,
|
||||
const struct pkt_dop *dop = &rrep->pr_dop;
|
||||
|
||||
ND_PRINT((ndo, " wb-rrep:"));
|
||||
if (len < sizeof(*rrep) || !ND_TTEST(*rrep))
|
||||
if (len < sizeof(*rrep) || !ND_TTEST_SIZE(rrep))
|
||||
return (-1);
|
||||
len -= sizeof(*rrep);
|
||||
|
||||
@ -375,7 +375,7 @@ wb_drawop(netdissect_options *ndo,
|
||||
const struct pkt_dop *dop, u_int len)
|
||||
{
|
||||
ND_PRINT((ndo, " wb-dop:"));
|
||||
if (len < sizeof(*dop) || !ND_TTEST(*dop))
|
||||
if (len < sizeof(*dop) || !ND_TTEST_SIZE(dop))
|
||||
return (-1);
|
||||
len -= sizeof(*dop);
|
||||
|
||||
@ -403,7 +403,7 @@ wb_print(netdissect_options *ndo,
|
||||
uint8_t type;
|
||||
|
||||
ph = (const struct pkt_hdr *)hdr;
|
||||
if (len < sizeof(*ph) || !ND_TTEST(*ph)) {
|
||||
if (len < sizeof(*ph) || !ND_TTEST_SIZE(ph)) {
|
||||
ND_PRINT((ndo, "%s", tstr));
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user