mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 03:53:53 +08:00
Rename ND_TCHECK_/ND_TTEST_ macros
Now all the macros have a name meaning a count in bytes. e.g.: ND_TCHECK_32BITS -> ND_TCHECK_4 ND_TTEST_32BITS -> ND_TTEST_4
This commit is contained in:
parent
e534e38f78
commit
3c8f3e13b0
36
extract.h
36
extract.h
@ -389,29 +389,29 @@ EXTRACT_BE_INT64(const void *p)
|
||||
/*
|
||||
* Macros to check the presence of the values in question.
|
||||
*/
|
||||
#define ND_TTEST_8BITS(p) ND_TTEST2(*(p), 1)
|
||||
#define ND_TCHECK_8BITS(p) ND_TCHECK2(*(p), 1)
|
||||
#define ND_TTEST_1(p) ND_TTEST2(*(p), 1)
|
||||
#define ND_TCHECK_1(p) ND_TCHECK2(*(p), 1)
|
||||
|
||||
#define ND_TTEST_16BITS(p) ND_TTEST2(*(p), 2)
|
||||
#define ND_TCHECK_16BITS(p) ND_TCHECK2(*(p), 2)
|
||||
#define ND_TTEST_2(p) ND_TTEST2(*(p), 2)
|
||||
#define ND_TCHECK_2(p) ND_TCHECK2(*(p), 2)
|
||||
|
||||
#define ND_TTEST_24BITS(p) ND_TTEST2(*(p), 3)
|
||||
#define ND_TCHECK_24BITS(p) ND_TCHECK2(*(p), 3)
|
||||
#define ND_TTEST_3(p) ND_TTEST2(*(p), 3)
|
||||
#define ND_TCHECK_3(p) ND_TCHECK2(*(p), 3)
|
||||
|
||||
#define ND_TTEST_32BITS(p) ND_TTEST2(*(p), 4)
|
||||
#define ND_TCHECK_32BITS(p) ND_TCHECK2(*(p), 4)
|
||||
#define ND_TTEST_4(p) ND_TTEST2(*(p), 4)
|
||||
#define ND_TCHECK_4(p) ND_TCHECK2(*(p), 4)
|
||||
|
||||
#define ND_TTEST_40BITS(p) ND_TTEST2(*(p), 5)
|
||||
#define ND_TCHECK_40BITS(p) ND_TCHECK2(*(p), 5)
|
||||
#define ND_TTEST_5(p) ND_TTEST2(*(p), 5)
|
||||
#define ND_TCHECK_5(p) ND_TCHECK2(*(p), 5)
|
||||
|
||||
#define ND_TTEST_48BITS(p) ND_TTEST2(*(p), 6)
|
||||
#define ND_TCHECK_48BITS(p) ND_TCHECK2(*(p), 6)
|
||||
#define ND_TTEST_6(p) ND_TTEST2(*(p), 6)
|
||||
#define ND_TCHECK_6(p) ND_TCHECK2(*(p), 6)
|
||||
|
||||
#define ND_TTEST_56BITS(p) ND_TTEST2(*(p), 7)
|
||||
#define ND_TCHECK_56BITS(p) ND_TCHECK2(*(p), 7)
|
||||
#define ND_TTEST_7(p) ND_TTEST2(*(p), 7)
|
||||
#define ND_TCHECK_7(p) ND_TCHECK2(*(p), 7)
|
||||
|
||||
#define ND_TTEST_64BITS(p) ND_TTEST2(*(p), 8)
|
||||
#define ND_TCHECK_64BITS(p) ND_TCHECK2(*(p), 8)
|
||||
#define ND_TTEST_8(p) ND_TTEST2(*(p), 8)
|
||||
#define ND_TCHECK_8(p) ND_TCHECK2(*(p), 8)
|
||||
|
||||
#define ND_TTEST_128BITS(p) ND_TTEST2(*(p), 16)
|
||||
#define ND_TCHECK_128BITS(p) ND_TCHECK2(*(p), 16)
|
||||
#define ND_TTEST_16(p) ND_TTEST2(*(p), 16)
|
||||
#define ND_TCHECK_16(p) ND_TCHECK2(*(p), 16)
|
||||
|
@ -49,7 +49,7 @@ ah_print(netdissect_options *ndo, register const u_char *bp)
|
||||
ND_PRINT((ndo, "AH(spi=0x%08x", EXTRACT_BE_32BITS(&ah->ah_spi)));
|
||||
if (ndo->ndo_vflag)
|
||||
ND_PRINT((ndo, ",sumlen=%d", sumlen));
|
||||
ND_TCHECK_32BITS(ah + 1);
|
||||
ND_TCHECK_4(ah + 1);
|
||||
ND_PRINT((ndo, ",seq=0x%x", EXTRACT_BE_32BITS(ah + 1)));
|
||||
if (!ND_TTEST2(*bp, sizeof(struct ah) + sumlen)) {
|
||||
ND_PRINT((ndo, "[truncated]):"));
|
||||
|
22
print-bgp.c
22
print-bgp.c
@ -680,7 +680,7 @@ bgp_vpn_sg_print(netdissect_options *ndo,
|
||||
total_length = 0;
|
||||
|
||||
/* Source address length, encoded in bits */
|
||||
ND_TCHECK_8BITS(pptr);
|
||||
ND_TCHECK_1(pptr);
|
||||
addr_length = EXTRACT_8BITS(pptr);
|
||||
pptr++;
|
||||
|
||||
@ -695,7 +695,7 @@ bgp_vpn_sg_print(netdissect_options *ndo,
|
||||
}
|
||||
|
||||
/* Group address length, encoded in bits */
|
||||
ND_TCHECK_8BITS(pptr);
|
||||
ND_TCHECK_1(pptr);
|
||||
addr_length = EXTRACT_8BITS(pptr);
|
||||
pptr++;
|
||||
|
||||
@ -784,7 +784,7 @@ decode_rt_routing_info(netdissect_options *ndo,
|
||||
return -1;
|
||||
|
||||
/* With at least "origin AS", possibly with "route target". */
|
||||
ND_TCHECK_32BITS(pptr + 1);
|
||||
ND_TCHECK_4(pptr + 1);
|
||||
as_printf(ndo, asbuf, sizeof(asbuf), EXTRACT_BE_32BITS(pptr + 1));
|
||||
|
||||
plen-=32; /* adjust prefix length */
|
||||
@ -1037,7 +1037,7 @@ decode_labeled_vpn_l2(netdissect_options *ndo,
|
||||
{
|
||||
int plen,tlen,stringlen,tlv_type,tlv_len,ttlv_len;
|
||||
|
||||
ND_TCHECK_16BITS(pptr);
|
||||
ND_TCHECK_2(pptr);
|
||||
plen=EXTRACT_BE_16BITS(pptr);
|
||||
tlen=plen;
|
||||
pptr+=2;
|
||||
@ -1458,7 +1458,7 @@ bgp_attr_print(netdissect_options *ndo,
|
||||
if (len != 4)
|
||||
ND_PRINT((ndo, "invalid len"));
|
||||
else {
|
||||
ND_TCHECK_32BITS(tptr);
|
||||
ND_TCHECK_4(tptr);
|
||||
ND_PRINT((ndo, "%u", EXTRACT_BE_32BITS(tptr)));
|
||||
}
|
||||
break;
|
||||
@ -1504,7 +1504,7 @@ bgp_attr_print(netdissect_options *ndo,
|
||||
}
|
||||
while (tlen>0) {
|
||||
uint32_t comm;
|
||||
ND_TCHECK_32BITS(tptr);
|
||||
ND_TCHECK_4(tptr);
|
||||
comm = EXTRACT_BE_32BITS(tptr);
|
||||
switch (comm) {
|
||||
case BGP_COMMUNITY_NO_EXPORT:
|
||||
@ -2064,7 +2064,7 @@ bgp_attr_print(netdissect_options *ndo,
|
||||
while (tlen>0) {
|
||||
uint16_t extd_comm;
|
||||
|
||||
ND_TCHECK_16BITS(tptr);
|
||||
ND_TCHECK_2(tptr);
|
||||
extd_comm=EXTRACT_BE_16BITS(tptr);
|
||||
|
||||
ND_PRINT((ndo, "\n\t %s (0x%04x), Flags [%s]",
|
||||
@ -2250,7 +2250,7 @@ bgp_attr_print(netdissect_options *ndo,
|
||||
break;
|
||||
}
|
||||
case BGPTYPE_ATTR_SET:
|
||||
ND_TCHECK_32BITS(tptr);
|
||||
ND_TCHECK_4(tptr);
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, "\n\t Origin AS: %s",
|
||||
@ -2516,7 +2516,7 @@ bgp_update_print(netdissect_options *ndo,
|
||||
length -= BGP_SIZE;
|
||||
|
||||
/* Unfeasible routes */
|
||||
ND_TCHECK_16BITS(p);
|
||||
ND_TCHECK_2(p);
|
||||
if (length < 2)
|
||||
goto trunc;
|
||||
withdrawn_routes_len = EXTRACT_BE_16BITS(p);
|
||||
@ -2536,7 +2536,7 @@ bgp_update_print(netdissect_options *ndo,
|
||||
length -= withdrawn_routes_len;
|
||||
}
|
||||
|
||||
ND_TCHECK_16BITS(p);
|
||||
ND_TCHECK_2(p);
|
||||
if (length < 2)
|
||||
goto trunc;
|
||||
len = EXTRACT_BE_16BITS(p);
|
||||
@ -2716,7 +2716,7 @@ bgp_notification_print(netdissect_options *ndo,
|
||||
bgpn.bgpn_minor == BGP_NOTIFY_MINOR_CEASE_RESET) &&
|
||||
length >= BGP_NOTIFICATION_SIZE + 1) {
|
||||
tptr = dat + BGP_NOTIFICATION_SIZE;
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
shutdown_comm_length = EXTRACT_8BITS(tptr);
|
||||
remainder_offset = 0;
|
||||
/* garbage, hexdump it all */
|
||||
|
@ -354,7 +354,7 @@ bootp_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "\n\t Client-Ethernet-Address %s", etheraddr_string(ndo, bp->bp_chaddr)));
|
||||
}
|
||||
|
||||
ND_TCHECK_8BITS(bp->bp_sname); /* check first char only */
|
||||
ND_TCHECK_1(bp->bp_sname); /* check first char only */
|
||||
if (EXTRACT_8BITS(bp->bp_sname)) {
|
||||
ND_PRINT((ndo, "\n\t sname \""));
|
||||
if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof bp->bp_sname,
|
||||
@ -365,7 +365,7 @@ bootp_print(netdissect_options *ndo,
|
||||
}
|
||||
ND_PRINT((ndo, "\""));
|
||||
}
|
||||
ND_TCHECK_8BITS(bp->bp_file); /* check first char only */
|
||||
ND_TCHECK_1(bp->bp_file); /* check first char only */
|
||||
if (EXTRACT_8BITS(bp->bp_file)) {
|
||||
ND_PRINT((ndo, "\n\t file \""));
|
||||
if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof bp->bp_file,
|
||||
@ -611,7 +611,7 @@ rfc1048_print(netdissect_options *ndo,
|
||||
bp += sizeof(int32_t);
|
||||
|
||||
/* Loop while we there is a tag left in the buffer */
|
||||
while (ND_TTEST_8BITS(bp)) {
|
||||
while (ND_TTEST_1(bp)) {
|
||||
tag = EXTRACT_8BITS(bp);
|
||||
bp++;
|
||||
if (tag == TAG_PAD && ndo->ndo_vflag < 3)
|
||||
@ -619,7 +619,7 @@ rfc1048_print(netdissect_options *ndo,
|
||||
if (tag == TAG_END && ndo->ndo_vflag < 3)
|
||||
return;
|
||||
if (tag == TAG_EXTENDED_OPTION) {
|
||||
ND_TCHECK_16BITS(bp + 1);
|
||||
ND_TCHECK_2(bp + 1);
|
||||
tag = EXTRACT_BE_16BITS(bp + 1);
|
||||
/* XXX we don't know yet if the IANA will
|
||||
* preclude overlap of 1-byte and 2-byte spaces.
|
||||
@ -634,7 +634,7 @@ rfc1048_print(netdissect_options *ndo,
|
||||
len = 0;
|
||||
else {
|
||||
/* Get the length; check for truncation */
|
||||
ND_TCHECK_8BITS(bp);
|
||||
ND_TCHECK_1(bp);
|
||||
len = EXTRACT_8BITS(bp);
|
||||
bp++;
|
||||
}
|
||||
@ -644,8 +644,8 @@ rfc1048_print(netdissect_options *ndo,
|
||||
|
||||
if (tag == TAG_PAD && ndo->ndo_vflag > 2) {
|
||||
u_int ntag = 1;
|
||||
while (ND_TTEST_8BITS(bp) &&
|
||||
EXTRACT_8BITS(bp) == TAG_PAD) {
|
||||
while (ND_TTEST_1(bp) &&
|
||||
EXTRACT_8BITS(bp) == TAG_PAD) {
|
||||
bp++;
|
||||
ntag++;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length)
|
||||
/* is the fudge byte set ? lets verify by spotting ISO headers */
|
||||
if (length < 2)
|
||||
goto trunc;
|
||||
ND_TCHECK_16BITS(p);
|
||||
ND_TCHECK_2(p);
|
||||
if (*(p+1) == NLPID_CLNP ||
|
||||
*(p+1) == NLPID_ESIS ||
|
||||
*(p+1) == NLPID_ISIS)
|
||||
|
@ -56,7 +56,7 @@ ns_nskip(netdissect_options *ndo,
|
||||
{
|
||||
register u_char i;
|
||||
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return (NULL);
|
||||
i = EXTRACT_8BITS(cp);
|
||||
cp++;
|
||||
@ -68,7 +68,7 @@ ns_nskip(netdissect_options *ndo,
|
||||
|
||||
if ((i & ~INDIR_MASK) != EDNS0_ELT_BITLABEL)
|
||||
return(NULL); /* unknown ELT */
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return (NULL);
|
||||
if ((bitlen = EXTRACT_8BITS(cp)) == 0)
|
||||
bitlen = 256;
|
||||
@ -77,7 +77,7 @@ ns_nskip(netdissect_options *ndo,
|
||||
cp += bytelen;
|
||||
} else
|
||||
cp += i;
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return (NULL);
|
||||
i = EXTRACT_8BITS(cp);
|
||||
cp++;
|
||||
@ -94,7 +94,7 @@ blabel_print(netdissect_options *ndo,
|
||||
const u_char *bitp, *lim;
|
||||
char tc;
|
||||
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return(NULL);
|
||||
if ((bitlen = EXTRACT_8BITS(cp)) == 0)
|
||||
bitlen = 256;
|
||||
@ -131,7 +131,7 @@ labellen(netdissect_options *ndo,
|
||||
{
|
||||
register u_int i;
|
||||
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return(-1);
|
||||
i = EXTRACT_8BITS(cp);
|
||||
if ((i & INDIR_MASK) == EDNS0_MASK) {
|
||||
@ -140,7 +140,7 @@ labellen(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "<ELT %d>", elt));
|
||||
return(-1);
|
||||
}
|
||||
if (!ND_TTEST_8BITS(cp + 1))
|
||||
if (!ND_TTEST_1(cp + 1))
|
||||
return(-1);
|
||||
if ((bitlen = EXTRACT_8BITS(cp + 1)) == 0)
|
||||
bitlen = 256;
|
||||
@ -161,7 +161,7 @@ ns_nprint(netdissect_options *ndo,
|
||||
|
||||
if ((l = labellen(ndo, cp)) == (u_int)-1)
|
||||
return(NULL);
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return(NULL);
|
||||
max_offset = (u_int)(cp - bp);
|
||||
i = EXTRACT_8BITS(cp);
|
||||
@ -178,7 +178,7 @@ ns_nprint(netdissect_options *ndo,
|
||||
rp = cp + 1;
|
||||
compress = 1;
|
||||
}
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return(NULL);
|
||||
offset = (((i << 8) | EXTRACT_8BITS(cp)) & 0x3fff);
|
||||
/*
|
||||
@ -199,7 +199,7 @@ ns_nprint(netdissect_options *ndo,
|
||||
cp = bp + offset;
|
||||
if ((l = labellen(ndo, cp)) == (u_int)-1)
|
||||
return(NULL);
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return(NULL);
|
||||
i = EXTRACT_8BITS(cp);
|
||||
cp++;
|
||||
@ -226,7 +226,7 @@ ns_nprint(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "."));
|
||||
if ((l = labellen(ndo, cp)) == (u_int)-1)
|
||||
return(NULL);
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return(NULL);
|
||||
i = EXTRACT_8BITS(cp);
|
||||
cp++;
|
||||
@ -245,7 +245,7 @@ ns_cprint(netdissect_options *ndo,
|
||||
{
|
||||
register u_int i;
|
||||
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return (NULL);
|
||||
i = EXTRACT_8BITS(cp);
|
||||
cp++;
|
||||
@ -512,7 +512,7 @@ ns_rprint(netdissect_options *ndo,
|
||||
int pbit, pbyte;
|
||||
char ntop_buf[INET6_ADDRSTRLEN];
|
||||
|
||||
if (!ND_TTEST_8BITS(cp))
|
||||
if (!ND_TTEST_1(cp))
|
||||
return(NULL);
|
||||
pbit = EXTRACT_8BITS(cp);
|
||||
pbyte = (pbit & ~7) / 8;
|
||||
@ -558,23 +558,23 @@ ns_rprint(netdissect_options *ndo,
|
||||
if ((cp = ns_nprint(ndo, cp, bp)) == NULL)
|
||||
return(NULL);
|
||||
cp += 6;
|
||||
if (!ND_TTEST_16BITS(cp))
|
||||
if (!ND_TTEST_2(cp))
|
||||
return(NULL);
|
||||
ND_PRINT((ndo, " fudge=%u", EXTRACT_BE_16BITS(cp)));
|
||||
cp += 2;
|
||||
if (!ND_TTEST_16BITS(cp))
|
||||
if (!ND_TTEST_2(cp))
|
||||
return(NULL);
|
||||
ND_PRINT((ndo, " maclen=%u", EXTRACT_BE_16BITS(cp)));
|
||||
cp += 2 + EXTRACT_BE_16BITS(cp);
|
||||
if (!ND_TTEST_16BITS(cp))
|
||||
if (!ND_TTEST_2(cp))
|
||||
return(NULL);
|
||||
ND_PRINT((ndo, " origid=%u", EXTRACT_BE_16BITS(cp)));
|
||||
cp += 2;
|
||||
if (!ND_TTEST_16BITS(cp))
|
||||
if (!ND_TTEST_2(cp))
|
||||
return(NULL);
|
||||
ND_PRINT((ndo, " error=%u", EXTRACT_BE_16BITS(cp)));
|
||||
cp += 2;
|
||||
if (!ND_TTEST_16BITS(cp))
|
||||
if (!ND_TTEST_2(cp))
|
||||
return(NULL);
|
||||
ND_PRINT((ndo, " otherlen=%u", EXTRACT_BE_16BITS(cp)));
|
||||
cp += 2;
|
||||
|
@ -77,7 +77,7 @@ dvmrp_print(netdissect_options *ndo,
|
||||
if (bp >= ep)
|
||||
return;
|
||||
|
||||
ND_TCHECK_8BITS(bp + 1);
|
||||
ND_TCHECK_1(bp + 1);
|
||||
type = EXTRACT_8BITS(bp + 1);
|
||||
|
||||
/* Skip IGMP header */
|
||||
@ -198,14 +198,14 @@ print_report(netdissect_options *ndo,
|
||||
}
|
||||
origin = 0;
|
||||
for (i = 0; i < width; ++i) {
|
||||
ND_TCHECK_8BITS(bp);
|
||||
ND_TCHECK_1(bp);
|
||||
origin = origin << 8 | EXTRACT_8BITS(bp);
|
||||
bp++;
|
||||
}
|
||||
for ( ; i < 4; ++i)
|
||||
origin <<= 8;
|
||||
|
||||
ND_TCHECK_8BITS(bp);
|
||||
ND_TCHECK_1(bp);
|
||||
metric = EXTRACT_8BITS(bp);
|
||||
bp++;
|
||||
done = metric & 0x80;
|
||||
|
18
print-eap.c
18
print-eap.c
@ -182,9 +182,9 @@ eap_print(netdissect_options *ndo,
|
||||
|
||||
switch (eap->type) {
|
||||
case EAP_FRAME_TYPE_PACKET:
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
type = *(tptr);
|
||||
ND_TCHECK_16BITS(tptr+2);
|
||||
ND_TCHECK_2(tptr + 2);
|
||||
len = EXTRACT_BE_16BITS(tptr + 2);
|
||||
ND_PRINT((ndo, ", %s (%u), id %u, len %u",
|
||||
tok2str(eap_code_values, "unknown", type),
|
||||
@ -195,7 +195,7 @@ eap_print(netdissect_options *ndo,
|
||||
ND_TCHECK2(*tptr, len);
|
||||
|
||||
if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */
|
||||
ND_TCHECK_8BITS(tptr+4);
|
||||
ND_TCHECK_1(tptr + 4);
|
||||
subtype = EXTRACT_8BITS(tptr + 4);
|
||||
ND_PRINT((ndo, "\n\t\t Type %s (%u)",
|
||||
tok2str(eap_type_values, "unknown", subtype),
|
||||
@ -225,7 +225,7 @@ eap_print(netdissect_options *ndo,
|
||||
* type one octet per type
|
||||
*/
|
||||
while (count < len) {
|
||||
ND_TCHECK_8BITS(tptr+count);
|
||||
ND_TCHECK_1(tptr + count);
|
||||
ND_PRINT((ndo, " %s (%u),",
|
||||
tok2str(eap_type_values, "unknown", EXTRACT_8BITS((tptr + count))),
|
||||
*(tptr + count)));
|
||||
@ -235,7 +235,7 @@ eap_print(netdissect_options *ndo,
|
||||
|
||||
case EAP_TYPE_TTLS:
|
||||
case EAP_TYPE_TLS:
|
||||
ND_TCHECK_8BITS(tptr + 5);
|
||||
ND_TCHECK_1(tptr + 5);
|
||||
if (subtype == EAP_TYPE_TTLS)
|
||||
ND_PRINT((ndo, " TTLSv%u",
|
||||
EAP_TTLS_VERSION(EXTRACT_8BITS((tptr + 5)))));
|
||||
@ -244,13 +244,13 @@ eap_print(netdissect_options *ndo,
|
||||
*(tptr + 5)));
|
||||
|
||||
if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
|
||||
ND_TCHECK_32BITS(tptr + 6);
|
||||
ND_TCHECK_4(tptr + 6);
|
||||
ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6)));
|
||||
}
|
||||
break;
|
||||
|
||||
case EAP_TYPE_FAST:
|
||||
ND_TCHECK_8BITS(tptr + 5);
|
||||
ND_TCHECK_1(tptr + 5);
|
||||
ND_PRINT((ndo, " FASTv%u",
|
||||
EAP_TTLS_VERSION(EXTRACT_8BITS((tptr + 5)))));
|
||||
ND_PRINT((ndo, " flags [%s] 0x%02x,",
|
||||
@ -258,7 +258,7 @@ eap_print(netdissect_options *ndo,
|
||||
*(tptr + 5)));
|
||||
|
||||
if (EAP_TLS_EXTRACT_BIT_L(*(tptr+5))) {
|
||||
ND_TCHECK_32BITS(tptr + 6);
|
||||
ND_TCHECK_4(tptr + 6);
|
||||
ND_PRINT((ndo, " len %u", EXTRACT_BE_32BITS(tptr + 6)));
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ eap_print(netdissect_options *ndo,
|
||||
|
||||
case EAP_TYPE_AKA:
|
||||
case EAP_TYPE_SIM:
|
||||
ND_TCHECK_8BITS(tptr + 5);
|
||||
ND_TCHECK_1(tptr + 5);
|
||||
ND_PRINT((ndo, " subtype [%s] 0x%02x,",
|
||||
tok2str(eap_aka_subtype_values, "unknown", EXTRACT_8BITS((tptr + 5))),
|
||||
*(tptr + 5)));
|
||||
|
18
print-fr.c
18
print-fr.c
@ -102,12 +102,12 @@ static int parse_q922_addr(netdissect_options *ndo,
|
||||
const u_char *p, u_int *dlci,
|
||||
u_int *addr_len, uint8_t *flags, u_int length)
|
||||
{
|
||||
if (!ND_TTEST_8BITS(p) || length < 1)
|
||||
if (!ND_TTEST_1(p) || length < 1)
|
||||
return -1;
|
||||
if ((EXTRACT_8BITS(p) & FR_EA_BIT))
|
||||
return 0;
|
||||
|
||||
if (!ND_TTEST_8BITS(p+1) || length < 2)
|
||||
if (!ND_TTEST_1(p + 1) || length < 2)
|
||||
return -1;
|
||||
*addr_len = 2;
|
||||
*dlci = ((EXTRACT_8BITS(p) & 0xFC) << 2) | ((EXTRACT_8BITS(p+1) & 0xF0) >> 4);
|
||||
@ -122,7 +122,7 @@ static int parse_q922_addr(netdissect_options *ndo,
|
||||
|
||||
p += 2;
|
||||
length -= 2;
|
||||
if (!ND_TTEST_8BITS(p) || length < 1)
|
||||
if (!ND_TTEST_1(p) || length < 1)
|
||||
return -1;
|
||||
(*addr_len)++; /* 3- or 4-byte Q.922 address */
|
||||
if ((EXTRACT_8BITS(p) & FR_EA_BIT) == 0) {
|
||||
@ -132,7 +132,7 @@ static int parse_q922_addr(netdissect_options *ndo,
|
||||
length--;
|
||||
}
|
||||
|
||||
if (!ND_TTEST_8BITS(p) || length < 1)
|
||||
if (!ND_TTEST_1(p) || length < 1)
|
||||
return -1;
|
||||
if ((EXTRACT_8BITS(p) & FR_EA_BIT) == 0)
|
||||
return 0; /* more than 4 bytes of Q.922 address? */
|
||||
@ -253,7 +253,7 @@ fr_print(netdissect_options *ndo,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ND_TCHECK_8BITS(p + addr_len);
|
||||
ND_TCHECK_1(p + addr_len);
|
||||
if (length < addr_len + 1)
|
||||
goto trunc;
|
||||
|
||||
@ -263,7 +263,7 @@ fr_print(netdissect_options *ndo,
|
||||
* with an Ethernet type (Cisco HDLC type?) following the
|
||||
* address.
|
||||
*/
|
||||
if (!ND_TTEST_16BITS(p + addr_len) || length < addr_len + 2) {
|
||||
if (!ND_TTEST_2(p + addr_len) || length < addr_len + 2) {
|
||||
/* no Ethertype */
|
||||
ND_PRINT((ndo, "UI %02x! ", EXTRACT_8BITS(p + addr_len)));
|
||||
} else {
|
||||
@ -285,7 +285,7 @@ fr_print(netdissect_options *ndo,
|
||||
}
|
||||
}
|
||||
|
||||
ND_TCHECK_8BITS(p + addr_len + 1);
|
||||
ND_TCHECK_1(p + addr_len + 1);
|
||||
if (length < addr_len + 2)
|
||||
goto trunc;
|
||||
|
||||
@ -307,7 +307,7 @@ fr_print(netdissect_options *ndo,
|
||||
hdr_len = addr_len + 1 /* UI */ + 1 /* NLPID */;
|
||||
}
|
||||
|
||||
ND_TCHECK_8BITS(p + hdr_len - 1);
|
||||
ND_TCHECK_1(p + hdr_len - 1);
|
||||
if (length < hdr_len)
|
||||
goto trunc;
|
||||
nlpid = EXTRACT_8BITS(p + hdr_len - 1);
|
||||
@ -907,7 +907,7 @@ q933_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "%s, codeset %u", is_ansi ? "ANSI" : "CCITT", codeset));
|
||||
|
||||
if (call_ref_length != 0) {
|
||||
ND_TCHECK_8BITS(p);
|
||||
ND_TCHECK_1(p);
|
||||
if (call_ref_length > 1 || EXTRACT_8BITS(p) != 0) {
|
||||
/*
|
||||
* Not a dummy call reference.
|
||||
|
@ -581,7 +581,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
|
||||
ND_PRINT((ndo, "\n\t"));
|
||||
ip = (const struct ip *)bp;
|
||||
snapend_save = ndo->ndo_snapend;
|
||||
ND_TCHECK_16BITS(&ip->ip_len);
|
||||
ND_TCHECK_2(&ip->ip_len);
|
||||
ip_print(ndo, bp, EXTRACT_BE_16BITS(&ip->ip_len));
|
||||
ndo->ndo_snapend = snapend_save;
|
||||
}
|
||||
|
14
print-igmp.c
14
print-igmp.c
@ -158,7 +158,7 @@ print_igmpv3_report(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " [invalid len %d]", len));
|
||||
return;
|
||||
}
|
||||
ND_TCHECK_16BITS(bp + 6);
|
||||
ND_TCHECK_2(bp + 6);
|
||||
ngroups = EXTRACT_BE_16BITS(bp + 6);
|
||||
ND_PRINT((ndo, ", %d group record(s)", ngroups));
|
||||
if (ndo->ndo_vflag > 0) {
|
||||
@ -215,7 +215,7 @@ print_igmpv3_query(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " [invalid len %d]", len));
|
||||
return;
|
||||
}
|
||||
ND_TCHECK_8BITS(bp + 1);
|
||||
ND_TCHECK_1(bp + 1);
|
||||
mrc = EXTRACT_8BITS(bp + 1);
|
||||
if (mrc < 128) {
|
||||
mrt = mrc;
|
||||
@ -231,11 +231,11 @@ print_igmpv3_query(netdissect_options *ndo,
|
||||
}
|
||||
ND_PRINT((ndo, "]"));
|
||||
}
|
||||
ND_TCHECK_32BITS(bp + 4);
|
||||
ND_TCHECK_4(bp + 4);
|
||||
if (EXTRACT_BE_32BITS(bp + 4) == 0)
|
||||
return;
|
||||
ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[4])));
|
||||
ND_TCHECK_16BITS(bp + 10);
|
||||
ND_TCHECK_2(bp + 10);
|
||||
nsrcs = EXTRACT_BE_16BITS(bp + 10);
|
||||
if (nsrcs > 0) {
|
||||
if (len < 12 + (nsrcs << 2))
|
||||
@ -267,21 +267,21 @@ igmp_print(netdissect_options *ndo,
|
||||
return;
|
||||
}
|
||||
|
||||
ND_TCHECK_8BITS(bp);
|
||||
ND_TCHECK_1(bp);
|
||||
switch (EXTRACT_8BITS(bp)) {
|
||||
case 0x11:
|
||||
ND_PRINT((ndo, "igmp query"));
|
||||
if (len >= 12)
|
||||
print_igmpv3_query(ndo, bp, len);
|
||||
else {
|
||||
ND_TCHECK_8BITS(bp + 1);
|
||||
ND_TCHECK_1(bp + 1);
|
||||
if (EXTRACT_8BITS(bp + 1)) {
|
||||
ND_PRINT((ndo, " v2"));
|
||||
if (EXTRACT_8BITS(bp + 1) != 100)
|
||||
ND_PRINT((ndo, " [max resp time %u]", EXTRACT_8BITS(bp + 1)));
|
||||
} else
|
||||
ND_PRINT((ndo, " v1"));
|
||||
ND_TCHECK_32BITS(bp + 4);
|
||||
ND_TCHECK_4(bp + 4);
|
||||
if (EXTRACT_BE_32BITS(bp + 4))
|
||||
ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, &bp[4])));
|
||||
if (len != 8)
|
||||
|
@ -922,7 +922,7 @@ ikev1_attrmap_print(netdissect_options *ndo,
|
||||
if (p[0] & 0x80)
|
||||
totlen = 4;
|
||||
else {
|
||||
ND_TCHECK_16BITS(&p[2]);
|
||||
ND_TCHECK_2(&p[2]);
|
||||
totlen = 4 + EXTRACT_BE_16BITS(p + 2);
|
||||
}
|
||||
if (ep2 < p + totlen) {
|
||||
@ -930,7 +930,7 @@ ikev1_attrmap_print(netdissect_options *ndo,
|
||||
return ep2 + 1;
|
||||
}
|
||||
|
||||
ND_TCHECK_16BITS(&p[0]);
|
||||
ND_TCHECK_2(&p[0]);
|
||||
ND_PRINT((ndo,"("));
|
||||
t = EXTRACT_BE_16BITS(p) & 0x7fff;
|
||||
if (map && t < nmap && map[t].type)
|
||||
@ -939,7 +939,7 @@ ikev1_attrmap_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo,"type=#%d ", t));
|
||||
if (p[0] & 0x80) {
|
||||
ND_PRINT((ndo,"value="));
|
||||
ND_TCHECK_16BITS(&p[2]);
|
||||
ND_TCHECK_2(&p[2]);
|
||||
v = EXTRACT_BE_16BITS(p + 2);
|
||||
if (map && t < nmap && v < map[t].nvalue && map[t].value[v])
|
||||
ND_PRINT((ndo,"%s", map[t].value[v]));
|
||||
@ -973,7 +973,7 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2)
|
||||
if (p[0] & 0x80)
|
||||
totlen = 4;
|
||||
else {
|
||||
ND_TCHECK_16BITS(&p[2]);
|
||||
ND_TCHECK_2(&p[2]);
|
||||
totlen = 4 + EXTRACT_BE_16BITS(p + 2);
|
||||
}
|
||||
if (ep2 < p + totlen) {
|
||||
@ -981,7 +981,7 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2)
|
||||
return ep2 + 1;
|
||||
}
|
||||
|
||||
ND_TCHECK_16BITS(&p[0]);
|
||||
ND_TCHECK_2(&p[0]);
|
||||
ND_PRINT((ndo,"("));
|
||||
t = EXTRACT_BE_16BITS(p) & 0x7fff;
|
||||
ND_PRINT((ndo,"type=#%d ", t));
|
||||
|
@ -1342,7 +1342,7 @@ esis_print(netdissect_options *ndo,
|
||||
|
||||
case ESIS_OPTION_PROTOCOLS:
|
||||
while (opli>0) {
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
ND_PRINT((ndo, "%s (0x%02x)",
|
||||
tok2str(nlpid_values,
|
||||
"unknown",
|
||||
@ -1625,7 +1625,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
|
||||
stlv_len = stlv_len - 8;
|
||||
|
||||
while (stlv_len >= 4) {
|
||||
ND_TCHECK_32BITS(tptr);
|
||||
ND_TCHECK_4(tptr);
|
||||
ND_PRINT((ndo, "\n\t T: %d, R: %d, RES: %d, ISID: %d",
|
||||
(EXTRACT_BE_32BITS(tptr) >> 31),
|
||||
(EXTRACT_BE_32BITS(tptr) >> 30) & 0x01,
|
||||
@ -2000,13 +2000,13 @@ isis_print_ext_is_reach(netdissect_options *ndo,
|
||||
tptr+=NODE_ID_LEN;
|
||||
|
||||
if (tlv_type != ISIS_TLV_IS_ALIAS_ID) { /* the Alias TLV Metric field is implicit 0 */
|
||||
if (!ND_TTEST_24BITS(tptr)) /* and is therefore skipped */
|
||||
if (!ND_TTEST_3(tptr)) /* and is therefore skipped */
|
||||
return(0);
|
||||
ND_PRINT((ndo, ", Metric: %d", EXTRACT_BE_24BITS(tptr)));
|
||||
tptr+=3;
|
||||
}
|
||||
|
||||
if (!ND_TTEST_8BITS(tptr))
|
||||
if (!ND_TTEST_1(tptr))
|
||||
return(0);
|
||||
subtlv_sum_len=EXTRACT_8BITS(tptr); /* read out subTLV length */
|
||||
tptr++;
|
||||
@ -2041,7 +2041,7 @@ static int
|
||||
isis_print_mtid(netdissect_options *ndo,
|
||||
const uint8_t *tptr, const char *ident)
|
||||
{
|
||||
if (!ND_TTEST_16BITS(tptr))
|
||||
if (!ND_TTEST_2(tptr))
|
||||
return(0);
|
||||
|
||||
ND_PRINT((ndo, "%s%s",
|
||||
@ -2072,14 +2072,14 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
|
||||
uint8_t prefix[sizeof(struct in6_addr)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
|
||||
u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen;
|
||||
|
||||
if (!ND_TTEST_32BITS(tptr))
|
||||
if (!ND_TTEST_4(tptr))
|
||||
return (0);
|
||||
metric = EXTRACT_BE_32BITS(tptr);
|
||||
processed=4;
|
||||
tptr+=4;
|
||||
|
||||
if (afi == AF_INET) {
|
||||
if (!ND_TTEST_8BITS(tptr)) /* fetch status byte */
|
||||
if (!ND_TTEST_1(tptr)) /* fetch status byte */
|
||||
return (0);
|
||||
status_byte=EXTRACT_8BITS(tptr);
|
||||
tptr++;
|
||||
@ -2145,7 +2145,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
|
||||
than one subTLV - therefore the first byte must reflect
|
||||
the aggregate bytecount of the subTLVs for this prefix
|
||||
*/
|
||||
if (!ND_TTEST_8BITS(tptr))
|
||||
if (!ND_TTEST_1(tptr))
|
||||
return (0);
|
||||
sublen=EXTRACT_8BITS(tptr);
|
||||
tptr++;
|
||||
@ -2588,7 +2588,7 @@ isis_print(netdissect_options *ndo,
|
||||
/* now check if we have a decoder otherwise do a hexdump at the end*/
|
||||
switch (tlv_type) {
|
||||
case ISIS_TLV_AREA_ADDR:
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
alen = EXTRACT_8BITS(tptr);
|
||||
tptr++;
|
||||
while (tmp && alen < tmp) {
|
||||
@ -2600,7 +2600,7 @@ isis_print(netdissect_options *ndo,
|
||||
tmp -= alen + 1;
|
||||
if (tmp==0) /* if this is the last area address do not attemt a boundary check */
|
||||
break;
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
alen = EXTRACT_8BITS(tptr);
|
||||
tptr++;
|
||||
}
|
||||
@ -2615,7 +2615,7 @@ isis_print(netdissect_options *ndo,
|
||||
break;
|
||||
|
||||
case ISIS_TLV_ISNEIGH_VARLEN:
|
||||
if (!ND_TTEST_8BITS(tptr) || tmp < 3) /* min. TLV length */
|
||||
if (!ND_TTEST_1(tptr) || tmp < 3) /* min. TLV length */
|
||||
goto trunctlv;
|
||||
lan_alen = EXTRACT_8BITS(tptr); /* LAN address length */
|
||||
tptr++;
|
||||
@ -2672,7 +2672,7 @@ isis_print(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case ISIS_TLV_IS_REACH:
|
||||
ND_TCHECK_8BITS(tptr); /* check if there is one byte left to read out the virtual flag */
|
||||
ND_TCHECK_1(tptr); /* check if there is one byte left to read out the virtual flag */
|
||||
ND_PRINT((ndo, "\n\t %s",
|
||||
tok2str(isis_is_reach_virtual_values,
|
||||
"bogus virtual flag 0x%02x",
|
||||
@ -2774,7 +2774,7 @@ isis_print(netdissect_options *ndo,
|
||||
}
|
||||
break;
|
||||
case ISIS_TLV_AUTH:
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
|
||||
ND_PRINT((ndo, "\n\t %s: ",
|
||||
tok2str(isis_subtlv_auth_values,
|
||||
@ -2788,7 +2788,7 @@ isis_print(netdissect_options *ndo,
|
||||
break;
|
||||
case ISIS_SUBTLV_AUTH_MD5:
|
||||
for(i=1;i<tlv_len;i++) {
|
||||
ND_TCHECK_8BITS(tptr + i);
|
||||
ND_TCHECK_1(tptr + i);
|
||||
ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tptr + i)));
|
||||
}
|
||||
if (tlv_len != ISIS_SUBTLV_AUTH_MD5_LEN+1)
|
||||
@ -2801,11 +2801,11 @@ isis_print(netdissect_options *ndo,
|
||||
|
||||
break;
|
||||
case ISIS_SUBTLV_AUTH_GENERIC:
|
||||
ND_TCHECK_16BITS(tptr + 1);
|
||||
ND_TCHECK_2(tptr + 1);
|
||||
key_id = EXTRACT_BE_16BITS(tptr + 1);
|
||||
ND_PRINT((ndo, "%u, password: ", key_id));
|
||||
for(i=1 + sizeof(uint16_t);i<tlv_len;i++) {
|
||||
ND_TCHECK_8BITS(tptr + i);
|
||||
ND_TCHECK_1(tptr + i);
|
||||
ND_PRINT((ndo, "%02x", EXTRACT_8BITS(tptr + i)));
|
||||
}
|
||||
break;
|
||||
@ -2820,7 +2820,7 @@ isis_print(netdissect_options *ndo,
|
||||
case ISIS_TLV_PTP_ADJ:
|
||||
tlv_ptp_adj = (const struct isis_tlv_ptp_adj *)tptr;
|
||||
if(tmp>=1) {
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
ND_PRINT((ndo, "\n\t Adjacency State: %s (%u)",
|
||||
tok2str(isis_ptp_adjancey_values, "unknown", EXTRACT_8BITS(tptr)),
|
||||
EXTRACT_8BITS(tptr)));
|
||||
@ -2848,7 +2848,7 @@ isis_print(netdissect_options *ndo,
|
||||
case ISIS_TLV_PROTOCOLS:
|
||||
ND_PRINT((ndo, "\n\t NLPID(s): "));
|
||||
while (tmp>0) {
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
ND_PRINT((ndo, "%s (0x%02x)",
|
||||
tok2str(nlpid_values,
|
||||
"unknown",
|
||||
@ -2863,7 +2863,7 @@ isis_print(netdissect_options *ndo,
|
||||
|
||||
case ISIS_TLV_MT_PORT_CAP:
|
||||
{
|
||||
ND_TCHECK_16BITS(tptr);
|
||||
ND_TCHECK_2(tptr);
|
||||
|
||||
ND_PRINT((ndo, "\n\t RES: %d, MTID(s): %d",
|
||||
(EXTRACT_BE_16BITS(tptr) >> 12),
|
||||
@ -2880,7 +2880,7 @@ isis_print(netdissect_options *ndo,
|
||||
|
||||
case ISIS_TLV_MT_CAPABILITY:
|
||||
|
||||
ND_TCHECK_16BITS(tptr);
|
||||
ND_TCHECK_2(tptr);
|
||||
|
||||
ND_PRINT((ndo, "\n\t O: %d, RES: %d, MTID(s): %d",
|
||||
(EXTRACT_BE_16BITS(tptr) >> 15) & 0x01,
|
||||
@ -2925,7 +2925,7 @@ isis_print(netdissect_options *ndo,
|
||||
|
||||
if (tmp < 1)
|
||||
break;
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
ND_PRINT((ndo, ", Flags: [%s]", ISIS_MASK_TLV_SHARED_RISK_GROUP(EXTRACT_8BITS(tptr)) ? "numbered" : "unnumbered"));
|
||||
tptr++;
|
||||
tmp--;
|
||||
@ -2945,7 +2945,7 @@ isis_print(netdissect_options *ndo,
|
||||
tmp-=sizeof(struct in_addr);
|
||||
|
||||
while (tmp>=4) {
|
||||
ND_TCHECK_32BITS(tptr);
|
||||
ND_TCHECK_4(tptr);
|
||||
ND_PRINT((ndo, "\n\t Link-ID: 0x%08x", EXTRACT_BE_32BITS(tptr)));
|
||||
tptr+=4;
|
||||
tmp-=4;
|
||||
@ -3057,7 +3057,7 @@ isis_print(netdissect_options *ndo,
|
||||
tptr++;
|
||||
switch (isis_subtlv_idrp) {
|
||||
case ISIS_SUBTLV_IDRP_ASN:
|
||||
ND_TCHECK_16BITS(tptr); /* fetch AS number */
|
||||
ND_TCHECK_2(tptr); /* fetch AS number */
|
||||
ND_PRINT((ndo, "AS Number: %u", EXTRACT_BE_16BITS(tptr)));
|
||||
break;
|
||||
case ISIS_SUBTLV_IDRP_LOCAL:
|
||||
@ -3095,7 +3095,7 @@ isis_print(netdissect_options *ndo,
|
||||
tmp-=sizeof(struct isis_metric_block);
|
||||
|
||||
while(tmp>0) {
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
prefix_len=EXTRACT_8BITS(tptr); /* read out prefix length in semioctets*/
|
||||
tptr++;
|
||||
if (prefix_len < 2) {
|
||||
|
@ -1369,7 +1369,7 @@ juniper_parse_header(netdissect_options *ndo,
|
||||
if (ndo->ndo_eflag) ND_PRINT((ndo, ": ")); /* print demarc b/w L2/L3*/
|
||||
|
||||
|
||||
ND_TCHECK_16BITS(p+l2info->cookie_len);
|
||||
ND_TCHECK_2(p + l2info->cookie_len);
|
||||
l2info->proto = EXTRACT_BE_16BITS(p + l2info->cookie_len);
|
||||
break;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ mobility_opt_print(netdissect_options *ndo,
|
||||
goto trunc;
|
||||
}
|
||||
/* units of 4 secs */
|
||||
ND_TCHECK_16BITS(&bp[i+2]);
|
||||
ND_TCHECK_2(&bp[i + 2]);
|
||||
ND_PRINT((ndo, "(refresh: %u)",
|
||||
EXTRACT_BE_16BITS(bp + i + 2) << 2));
|
||||
break;
|
||||
@ -159,7 +159,7 @@ mobility_opt_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "(altcoa: trunc)"));
|
||||
goto trunc;
|
||||
}
|
||||
ND_TCHECK_128BITS(&bp[i+2]);
|
||||
ND_TCHECK_16(&bp[i + 2]);
|
||||
ND_PRINT((ndo, "(alt-CoA: %s)", ip6addr_string(ndo, &bp[i+2])));
|
||||
break;
|
||||
case IP6MOPT_NONCEID:
|
||||
@ -167,8 +167,8 @@ mobility_opt_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "(ni: trunc)"));
|
||||
goto trunc;
|
||||
}
|
||||
ND_TCHECK_16BITS(&bp[i+2]);
|
||||
ND_TCHECK_16BITS(&bp[i+4]);
|
||||
ND_TCHECK_2(&bp[i + 2]);
|
||||
ND_TCHECK_2(&bp[i + 4]);
|
||||
ND_PRINT((ndo, "(ni: ho=0x%04x co=0x%04x)",
|
||||
EXTRACT_BE_16BITS(bp + i + 2),
|
||||
EXTRACT_BE_16BITS(bp + i + 4)));
|
||||
@ -247,7 +247,7 @@ mobility_print(netdissect_options *ndo,
|
||||
case IP6M_CAREOF_TEST_INIT:
|
||||
hlen = IP6M_MINLEN;
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_TCHECK_32BITS(&bp[hlen + 4]);
|
||||
ND_TCHECK_4(&bp[hlen + 4]);
|
||||
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
|
||||
type == IP6M_HOME_TEST_INIT ? "Home" : "Care-of",
|
||||
EXTRACT_BE_32BITS(bp + hlen),
|
||||
@ -261,7 +261,7 @@ mobility_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " nonce id=0x%x", EXTRACT_BE_16BITS(&mh->ip6m_data16[0])));
|
||||
hlen = IP6M_MINLEN;
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_TCHECK_32BITS(&bp[hlen + 4]);
|
||||
ND_TCHECK_4(&bp[hlen + 4]);
|
||||
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
|
||||
type == IP6M_HOME_TEST ? "Home" : "Care-of",
|
||||
EXTRACT_BE_32BITS(bp + hlen),
|
||||
@ -269,7 +269,7 @@ mobility_print(netdissect_options *ndo,
|
||||
}
|
||||
hlen += 8;
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_TCHECK_32BITS(&bp[hlen + 4]);
|
||||
ND_TCHECK_4(&bp[hlen + 4]);
|
||||
ND_PRINT((ndo, " %s Keygen Token=%08x:%08x",
|
||||
type == IP6M_HOME_TEST ? "Home" : "Care-of",
|
||||
EXTRACT_BE_32BITS(bp + hlen),
|
||||
@ -281,7 +281,7 @@ mobility_print(netdissect_options *ndo,
|
||||
ND_TCHECK(mh->ip6m_data16[0]);
|
||||
ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&mh->ip6m_data16[0])));
|
||||
hlen = IP6M_MINLEN;
|
||||
ND_TCHECK_16BITS(&bp[hlen]);
|
||||
ND_TCHECK_2(&bp[hlen]);
|
||||
if (bp[hlen] & 0xf0) {
|
||||
ND_PRINT((ndo, " "));
|
||||
if (bp[hlen] & 0x80)
|
||||
@ -297,7 +297,7 @@ mobility_print(netdissect_options *ndo,
|
||||
hlen += 1;
|
||||
/* Reserved (8bits) */
|
||||
hlen += 1;
|
||||
ND_TCHECK_16BITS(&bp[hlen]);
|
||||
ND_TCHECK_2(&bp[hlen]);
|
||||
/* units of 4 secs */
|
||||
ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2));
|
||||
hlen += 2;
|
||||
@ -310,10 +310,10 @@ mobility_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " K"));
|
||||
/* Reserved (7bits) */
|
||||
hlen = IP6M_MINLEN;
|
||||
ND_TCHECK_16BITS(&bp[hlen]);
|
||||
ND_TCHECK_2(&bp[hlen]);
|
||||
ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(bp + hlen)));
|
||||
hlen += 2;
|
||||
ND_TCHECK_16BITS(&bp[hlen]);
|
||||
ND_TCHECK_2(&bp[hlen]);
|
||||
/* units of 4 secs */
|
||||
ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2));
|
||||
hlen += 2;
|
||||
|
@ -737,7 +737,7 @@ ospf6_decode_v3(netdissect_options *ndo,
|
||||
case OSPF_TYPE_HELLO: {
|
||||
register const struct hello6 *hellop = (const struct hello6 *)((const uint8_t *)op + OSPF6HDR_LEN);
|
||||
|
||||
ND_TCHECK_32BITS(&hellop->hello_options);
|
||||
ND_TCHECK_4(&hellop->hello_options);
|
||||
ND_PRINT((ndo, "\n\tOptions [%s]",
|
||||
bittok2str(ospf6_option_values, "none",
|
||||
EXTRACT_BE_32BITS(&hellop->hello_options))));
|
||||
|
@ -361,7 +361,7 @@ pgm_print(netdissect_options *ndo,
|
||||
* and stopping if we don't have enough.
|
||||
*/
|
||||
bp += (2 * sizeof(uint16_t));
|
||||
ND_TCHECK_16BITS(bp);
|
||||
ND_TCHECK_2(bp);
|
||||
switch (EXTRACT_BE_16BITS(bp)) {
|
||||
case AFNUM_INET:
|
||||
ND_TCHECK2(*bp, sizeof(struct in_addr));
|
||||
|
@ -1022,7 +1022,7 @@ pimv2_print(netdissect_options *ndo,
|
||||
/* Fragment Tag, Hash Mask len, and BSR-priority */
|
||||
if (len < 2)
|
||||
goto trunc;
|
||||
ND_TCHECK_16BITS(bp);
|
||||
ND_TCHECK_2(bp);
|
||||
ND_PRINT((ndo, " tag=%x", EXTRACT_BE_16BITS(bp)));
|
||||
bp += 2;
|
||||
len -= 2;
|
||||
@ -1079,7 +1079,7 @@ pimv2_print(netdissect_options *ndo,
|
||||
|
||||
if (len < 2)
|
||||
goto trunc;
|
||||
ND_TCHECK_16BITS(bp);
|
||||
ND_TCHECK_2(bp);
|
||||
ND_PRINT((ndo, ",holdtime="));
|
||||
unsigned_relts_print(ndo,
|
||||
EXTRACT_BE_16BITS(bp));
|
||||
@ -1130,7 +1130,7 @@ pimv2_print(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " prio=%d", bp[1]));
|
||||
if (len < 4)
|
||||
goto trunc;
|
||||
ND_TCHECK_16BITS(&bp[2]);
|
||||
ND_TCHECK_2(&bp[2]);
|
||||
ND_PRINT((ndo, " holdtime="));
|
||||
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2));
|
||||
bp += 4;
|
||||
@ -1172,7 +1172,7 @@ pimv2_print(netdissect_options *ndo,
|
||||
len -= advance;
|
||||
if (len < 2)
|
||||
goto trunc;
|
||||
ND_TCHECK_16BITS(bp);
|
||||
ND_TCHECK_2(bp);
|
||||
ND_PRINT((ndo, " TUNR "));
|
||||
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp));
|
||||
break;
|
||||
|
22
print-ppp.c
22
print-ppp.c
@ -613,7 +613,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be >= 6)"));
|
||||
return len;
|
||||
}
|
||||
ND_TCHECK_24BITS(p + 2);
|
||||
ND_TCHECK_3(p + 2);
|
||||
ND_PRINT((ndo, ": Vendor: %s (%u)",
|
||||
tok2str(oui_values,"Unknown",EXTRACT_BE_24BITS(p + 2)),
|
||||
EXTRACT_BE_24BITS(p + 2)));
|
||||
@ -632,7 +632,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be = 4)"));
|
||||
return len;
|
||||
}
|
||||
ND_TCHECK_16BITS(p + 2);
|
||||
ND_TCHECK_2(p + 2);
|
||||
ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2)));
|
||||
break;
|
||||
case LCPOPT_ACCM:
|
||||
@ -640,7 +640,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be = 6)"));
|
||||
return len;
|
||||
}
|
||||
ND_TCHECK_32BITS(p + 2);
|
||||
ND_TCHECK_4(p + 2);
|
||||
ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2)));
|
||||
break;
|
||||
case LCPOPT_AP:
|
||||
@ -648,7 +648,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be >= 4)"));
|
||||
return len;
|
||||
}
|
||||
ND_TCHECK_16BITS(p + 2);
|
||||
ND_TCHECK_2(p + 2);
|
||||
ND_PRINT((ndo, ": %s", tok2str(ppptype2str, "Unknown Auth Proto (0x04x)", EXTRACT_BE_16BITS(p + 2))));
|
||||
|
||||
switch (EXTRACT_BE_16BITS(p + 2)) {
|
||||
@ -670,7 +670,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be >= 4)"));
|
||||
return 0;
|
||||
}
|
||||
ND_TCHECK_16BITS(p+2);
|
||||
ND_TCHECK_2(p + 2);
|
||||
if (EXTRACT_BE_16BITS(p + 2) == PPP_LQM)
|
||||
ND_PRINT((ndo, ": LQR"));
|
||||
else
|
||||
@ -681,7 +681,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be = 6)"));
|
||||
return 0;
|
||||
}
|
||||
ND_TCHECK_32BITS(p + 2);
|
||||
ND_TCHECK_4(p + 2);
|
||||
ND_PRINT((ndo, ": 0x%08x", EXTRACT_BE_32BITS(p + 2)));
|
||||
break;
|
||||
case LCPOPT_PFC:
|
||||
@ -693,7 +693,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be = 4)"));
|
||||
return 0;
|
||||
}
|
||||
ND_TCHECK_16BITS(p + 2);
|
||||
ND_TCHECK_2(p + 2);
|
||||
ND_PRINT((ndo, ": 0x%04x", EXTRACT_BE_16BITS(p + 2)));
|
||||
break;
|
||||
case LCPOPT_CBACK:
|
||||
@ -712,7 +712,7 @@ print_lcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be = 4)"));
|
||||
return 0;
|
||||
}
|
||||
ND_TCHECK_16BITS(p + 2);
|
||||
ND_TCHECK_2(p + 2);
|
||||
ND_PRINT((ndo, ": %u", EXTRACT_BE_16BITS(p + 2)));
|
||||
break;
|
||||
case LCPOPT_MLED:
|
||||
@ -817,7 +817,7 @@ handle_mlppp(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, "[|mlppp]"));
|
||||
return;
|
||||
}
|
||||
if (!ND_TTEST_16BITS(p)) {
|
||||
if (!ND_TTEST_2(p)) {
|
||||
ND_PRINT((ndo, "[|mlppp]"));
|
||||
return;
|
||||
}
|
||||
@ -1072,7 +1072,7 @@ print_ipcp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be >= 4)"));
|
||||
return 0;
|
||||
}
|
||||
ND_TCHECK_16BITS(p+2);
|
||||
ND_TCHECK_2(p + 2);
|
||||
compproto = EXTRACT_BE_16BITS(p + 2);
|
||||
|
||||
ND_PRINT((ndo, ": %s (0x%02x):",
|
||||
@ -1353,7 +1353,7 @@ print_bacp_config_options(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, " (length bogus, should be = 6)"));
|
||||
return len;
|
||||
}
|
||||
ND_TCHECK_32BITS(p + 2);
|
||||
ND_TCHECK_4(p + 2);
|
||||
ND_PRINT((ndo, ": Magic-Num 0x%08x", EXTRACT_BE_32BITS(p + 2)));
|
||||
break;
|
||||
default:
|
||||
|
@ -182,7 +182,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len
|
||||
const u_char *msg;
|
||||
|
||||
/* Protocol Version */
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
if (*tptr != 0) {
|
||||
/* Skip the rest of the input buffer because even if this is
|
||||
* a well-formed PDU of a future RPKI-Router protocol version
|
||||
|
76
print-rx.c
76
print-rx.c
@ -682,7 +682,7 @@ rx_cache_insert(netdissect_options *ndo,
|
||||
struct rx_cache_entry *rxent;
|
||||
const struct rx_header *rxh = (const struct rx_header *) bp;
|
||||
|
||||
if (!ND_TTEST_32BITS(bp + sizeof(struct rx_header)))
|
||||
if (!ND_TTEST_4(bp + sizeof(struct rx_header)))
|
||||
return;
|
||||
|
||||
rxent = &rx_cache[rx_cache_next];
|
||||
@ -771,14 +771,14 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
|
||||
}
|
||||
|
||||
#define INTOUT() { int32_t _i; \
|
||||
ND_TCHECK_32BITS(bp); \
|
||||
ND_TCHECK_4(bp); \
|
||||
_i = EXTRACT_BE_INT32(bp); \
|
||||
bp += sizeof(int32_t); \
|
||||
ND_PRINT((ndo, " %d", _i)); \
|
||||
}
|
||||
|
||||
#define UINTOUT() { uint32_t _i; \
|
||||
ND_TCHECK_32BITS(bp); \
|
||||
ND_TCHECK_4(bp); \
|
||||
_i = EXTRACT_BE_32BITS(bp); \
|
||||
bp += sizeof(uint32_t); \
|
||||
ND_PRINT((ndo, " %u", _i)); \
|
||||
@ -792,7 +792,7 @@ rx_cache_find(const struct rx_header *rxh, const struct ip *ip, u_int sport,
|
||||
}
|
||||
|
||||
#define DATEOUT() { time_t _t; struct tm *tm; char str[256]; \
|
||||
ND_TCHECK_32BITS(bp); \
|
||||
ND_TCHECK_4(bp); \
|
||||
_t = (time_t) EXTRACT_BE_INT32(bp); \
|
||||
bp += sizeof(int32_t); \
|
||||
tm = localtime(&_t); \
|
||||
@ -896,7 +896,7 @@ fs_print(netdissect_options *ndo,
|
||||
* gleaned from fsint/afsint.xg
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(bp + sizeof(struct rx_header));
|
||||
ND_TCHECK_4(bp + sizeof(struct rx_header));
|
||||
fs_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
|
||||
|
||||
ND_PRINT((ndo, " fs call %s", tok2str(fs_req, "op#%u", fs_op)));
|
||||
@ -1005,7 +1005,7 @@ fs_print(netdissect_options *ndo,
|
||||
case 65536: /* Inline bulk stat */
|
||||
{
|
||||
uint32_t j;
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
|
||||
@ -1081,7 +1081,7 @@ fs_reply_print(netdissect_options *ndo,
|
||||
case 131: /* Fetch ACL */
|
||||
{
|
||||
char a[AFSOPAQUEMAX+1];
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
i = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
ND_TCHECK2(bp[0], i);
|
||||
@ -1112,7 +1112,7 @@ fs_reply_print(netdissect_options *ndo,
|
||||
*/
|
||||
int32_t errcode;
|
||||
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
errcode = EXTRACT_BE_INT32(bp);
|
||||
bp += sizeof(int32_t);
|
||||
|
||||
@ -1229,7 +1229,7 @@ cb_print(netdissect_options *ndo,
|
||||
* gleaned from fsint/afscbint.xg
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(bp + sizeof(struct rx_header));
|
||||
ND_TCHECK_4(bp + sizeof(struct rx_header));
|
||||
cb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
|
||||
|
||||
ND_PRINT((ndo, " cb call %s", tok2str(cb_req, "op#%u", cb_op)));
|
||||
@ -1245,7 +1245,7 @@ cb_print(netdissect_options *ndo,
|
||||
case 204: /* Callback */
|
||||
{
|
||||
uint32_t j, t;
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
|
||||
@ -1258,7 +1258,7 @@ cb_print(netdissect_options *ndo,
|
||||
if (j == 0)
|
||||
ND_PRINT((ndo, " <none!>"));
|
||||
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
|
||||
@ -1270,7 +1270,7 @@ cb_print(netdissect_options *ndo,
|
||||
INTOUT();
|
||||
ND_PRINT((ndo, " expires"));
|
||||
DATEOUT();
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
t = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
tok2str(cb_types, "type %u", t);
|
||||
@ -1360,7 +1360,7 @@ prot_print(netdissect_options *ndo,
|
||||
* gleaned from ptserver/ptint.xg
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(bp + sizeof(struct rx_header));
|
||||
ND_TCHECK_4(bp + sizeof(struct rx_header));
|
||||
pt_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
|
||||
|
||||
ND_PRINT((ndo, " pt"));
|
||||
@ -1413,7 +1413,7 @@ prot_print(netdissect_options *ndo,
|
||||
case 504: /* Name to ID */
|
||||
{
|
||||
uint32_t j;
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
|
||||
@ -1435,7 +1435,7 @@ prot_print(netdissect_options *ndo,
|
||||
{
|
||||
uint32_t j;
|
||||
ND_PRINT((ndo, " ids:"));
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
i = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
for (j = 0; j < i; j++)
|
||||
@ -1525,7 +1525,7 @@ prot_reply_print(netdissect_options *ndo,
|
||||
{
|
||||
uint32_t j;
|
||||
ND_PRINT((ndo, " ids:"));
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
i = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
for (j = 0; j < i; j++)
|
||||
@ -1537,7 +1537,7 @@ prot_reply_print(netdissect_options *ndo,
|
||||
case 505: /* ID to name */
|
||||
{
|
||||
uint32_t j;
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
|
||||
@ -1562,7 +1562,7 @@ prot_reply_print(netdissect_options *ndo,
|
||||
case 519: /* Get host CPS */
|
||||
{
|
||||
uint32_t j;
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
for (i = 0; i < j; i++) {
|
||||
@ -1614,7 +1614,7 @@ vldb_print(netdissect_options *ndo,
|
||||
* gleaned from vlserver/vldbint.xg
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(bp + sizeof(struct rx_header));
|
||||
ND_TCHECK_4(bp + sizeof(struct rx_header));
|
||||
vldb_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
|
||||
|
||||
ND_PRINT((ndo, " vldb"));
|
||||
@ -1644,7 +1644,7 @@ vldb_print(netdissect_options *ndo,
|
||||
case 518: /* Get entry by ID N */
|
||||
ND_PRINT((ndo, " volid"));
|
||||
INTOUT();
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
i = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
if (i <= 2)
|
||||
@ -1664,7 +1664,7 @@ vldb_print(netdissect_options *ndo,
|
||||
case 520: /* Replace entry N */
|
||||
ND_PRINT((ndo, " volid"));
|
||||
INTOUT();
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
i = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
if (i <= 2)
|
||||
@ -1734,16 +1734,16 @@ vldb_reply_print(netdissect_options *ndo,
|
||||
case 504: /* Get entry by name */
|
||||
{ uint32_t nservers, j;
|
||||
VECOUT(VLNAMEMAX);
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
ND_PRINT((ndo, " numservers"));
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
nservers = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
ND_PRINT((ndo, " %u", nservers));
|
||||
ND_PRINT((ndo, " servers"));
|
||||
for (i = 0; i < 8; i++) {
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
if (i < nservers)
|
||||
ND_PRINT((ndo, " %s",
|
||||
intoa(((const struct in_addr *) bp)->s_addr)));
|
||||
@ -1751,7 +1751,7 @@ vldb_reply_print(netdissect_options *ndo,
|
||||
}
|
||||
ND_PRINT((ndo, " partitions"));
|
||||
for (i = 0; i < 8; i++) {
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
if (i < nservers && j <= 26)
|
||||
ND_PRINT((ndo, " %c", 'a' + j));
|
||||
@ -1784,13 +1784,13 @@ vldb_reply_print(netdissect_options *ndo,
|
||||
{ uint32_t nservers, j;
|
||||
VECOUT(VLNAMEMAX);
|
||||
ND_PRINT((ndo, " numservers"));
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
nservers = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
ND_PRINT((ndo, " %u", nservers));
|
||||
ND_PRINT((ndo, " servers"));
|
||||
for (i = 0; i < 13; i++) {
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
if (i < nservers)
|
||||
ND_PRINT((ndo, " %s",
|
||||
intoa(((const struct in_addr *) bp)->s_addr)));
|
||||
@ -1798,7 +1798,7 @@ vldb_reply_print(netdissect_options *ndo,
|
||||
}
|
||||
ND_PRINT((ndo, " partitions"));
|
||||
for (i = 0; i < 13; i++) {
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
if (i < nservers && j <= 26)
|
||||
ND_PRINT((ndo, " %c", 'a' + j));
|
||||
@ -1821,7 +1821,7 @@ vldb_reply_print(netdissect_options *ndo,
|
||||
{ uint32_t nservers, j;
|
||||
VECOUT(VLNAMEMAX);
|
||||
ND_PRINT((ndo, " numservers"));
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
nservers = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
ND_PRINT((ndo, " %u", nservers));
|
||||
@ -1839,7 +1839,7 @@ vldb_reply_print(netdissect_options *ndo,
|
||||
bp += 4 * 13;
|
||||
ND_PRINT((ndo, " partitions"));
|
||||
for (i = 0; i < 13; i++) {
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
if (i < nservers && j <= 26)
|
||||
ND_PRINT((ndo, " %c", 'a' + j));
|
||||
@ -1892,7 +1892,7 @@ kauth_print(netdissect_options *ndo,
|
||||
* gleaned from kauth/kauth.rg
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(bp + sizeof(struct rx_header));
|
||||
ND_TCHECK_4(bp + sizeof(struct rx_header));
|
||||
kauth_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
|
||||
|
||||
ND_PRINT((ndo, " kauth"));
|
||||
@ -1934,7 +1934,7 @@ kauth_print(netdissect_options *ndo,
|
||||
INTOUT();
|
||||
ND_PRINT((ndo, " domain"));
|
||||
STROUT(KANAMEMAX);
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
i = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
ND_TCHECK2(bp[0], i);
|
||||
@ -2035,7 +2035,7 @@ vol_print(netdissect_options *ndo,
|
||||
* gleaned from volser/volint.xg
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(bp + sizeof(struct rx_header));
|
||||
ND_TCHECK_4(bp + sizeof(struct rx_header));
|
||||
vol_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
|
||||
|
||||
ND_PRINT((ndo, " vol call %s", tok2str(vol_req, "op#%u", vol_op)));
|
||||
@ -2187,7 +2187,7 @@ vol_print(netdissect_options *ndo,
|
||||
DATEOUT();
|
||||
{
|
||||
uint32_t i, j;
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
for (i = 0; i < j; i++) {
|
||||
@ -2315,7 +2315,7 @@ vol_reply_print(netdissect_options *ndo,
|
||||
case 121: /* List one volume */
|
||||
{
|
||||
uint32_t i, j;
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
j = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
for (i = 0; i < j; i++) {
|
||||
@ -2369,7 +2369,7 @@ bos_print(netdissect_options *ndo,
|
||||
* gleaned from bozo/bosint.xg
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(bp + sizeof(struct rx_header));
|
||||
ND_TCHECK_4(bp + sizeof(struct rx_header));
|
||||
bos_op = EXTRACT_BE_32BITS(bp + sizeof(struct rx_header));
|
||||
|
||||
ND_PRINT((ndo, " bos call %s", tok2str(bos_req, "op#%u", bos_op)));
|
||||
@ -2531,7 +2531,7 @@ ubik_print(netdissect_options *ndo,
|
||||
|
||||
switch (ubik_op) {
|
||||
case 10000: /* Beacon */
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
temp = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
ND_PRINT((ndo, " syncsite %s", temp ? "yes" : "no"));
|
||||
@ -2563,7 +2563,7 @@ ubik_print(netdissect_options *ndo,
|
||||
INTOUT();
|
||||
ND_PRINT((ndo, " length"));
|
||||
INTOUT();
|
||||
ND_TCHECK_32BITS(bp);
|
||||
ND_TCHECK_4(bp);
|
||||
temp = EXTRACT_BE_32BITS(bp);
|
||||
bp += sizeof(uint32_t);
|
||||
tok2str(ubik_lock_types, "type %u", temp);
|
||||
|
@ -820,7 +820,7 @@ print_smb(netdissect_options *ndo,
|
||||
if (ndo->ndo_vflag < 2)
|
||||
return;
|
||||
|
||||
ND_TCHECK_16BITS(&buf[10]);
|
||||
ND_TCHECK_2(&buf[10]);
|
||||
flags2 = EXTRACT_LE_16BITS(buf + 10);
|
||||
unicodestr = flags2 & 0x8000;
|
||||
nterrcodes = flags2 & 0x4000;
|
||||
@ -1167,12 +1167,12 @@ nbt_udp137_print(netdissect_options *ndo,
|
||||
p = smb_fdata(ndo, p, "Name=[n1]\n#", maxbuf, 0);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
ND_TCHECK_16BITS(p);
|
||||
ND_TCHECK_2(p);
|
||||
restype = EXTRACT_BE_16BITS(p);
|
||||
p = smb_fdata(ndo, p, "ResType=[rw]\nResClass=[rw]\nTTL=[rD]\n", p + 8, 0);
|
||||
if (p == NULL)
|
||||
goto out;
|
||||
ND_TCHECK_16BITS(p);
|
||||
ND_TCHECK_2(p);
|
||||
rdlen = EXTRACT_BE_16BITS(p);
|
||||
ND_PRINT((ndo, "ResourceLength=%d\nResourceData=\n", rdlen));
|
||||
p += 2;
|
||||
|
14
print-stp.c
14
print-stp.c
@ -281,9 +281,9 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
|
||||
(float) EXTRACT_BE_16BITS(&stp_bpdu->hello_time) / STP_TIME_BASE,
|
||||
(float) EXTRACT_BE_16BITS(&stp_bpdu->forward_delay) / STP_TIME_BASE));
|
||||
|
||||
ND_TCHECK_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
|
||||
ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET);
|
||||
ND_PRINT((ndo, "\n\tv3len %d, ", EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET)));
|
||||
ND_TCHECK_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12);
|
||||
ND_TCHECK_4(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12);
|
||||
ND_PRINT((ndo, "MCID Name "));
|
||||
if (fn_printzp(ndo, ptr + MST_BPDU_CONFIG_NAME_OFFSET, 32, ndo->ndo_snapend))
|
||||
goto trunc;
|
||||
@ -295,7 +295,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
|
||||
EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 8),
|
||||
EXTRACT_BE_32BITS(ptr + MST_BPDU_CONFIG_DIGEST_OFFSET + 12)));
|
||||
|
||||
ND_TCHECK_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET);
|
||||
ND_TCHECK_4(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET);
|
||||
ND_PRINT((ndo, "CIST int-root-pathcost %u,",
|
||||
EXTRACT_BE_32BITS(ptr + MST_BPDU_CIST_INT_PATH_COST_OFFSET)));
|
||||
|
||||
@ -307,7 +307,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
|
||||
ND_PRINT((ndo, "CIST remaining-hops %d", ptr[MST_BPDU_CIST_REMAIN_HOPS_OFFSET]));
|
||||
|
||||
/* Dump all MSTI's */
|
||||
ND_TCHECK_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
|
||||
ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET);
|
||||
v3len = EXTRACT_BE_16BITS(ptr + MST_BPDU_VER3_LEN_OFFSET);
|
||||
if (v3len > MST_BPDU_CONFIG_INFO_LENGTH) {
|
||||
len = v3len - MST_BPDU_CONFIG_INFO_LENGTH;
|
||||
@ -355,7 +355,7 @@ stp_print_spb_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu,
|
||||
}
|
||||
|
||||
ptr = (const u_char *)stp_bpdu;
|
||||
ND_TCHECK_32BITS(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16);
|
||||
ND_TCHECK_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 16);
|
||||
|
||||
ND_PRINT((ndo, "\n\tv4len %d, ", EXTRACT_BE_16BITS(ptr + offset)));
|
||||
ND_PRINT((ndo, "AUXMCID Name "));
|
||||
@ -462,7 +462,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length)
|
||||
}
|
||||
|
||||
/* Validate v3 length */
|
||||
ND_TCHECK_16BITS(p + MST_BPDU_VER3_LEN_OFFSET);
|
||||
ND_TCHECK_2(p + MST_BPDU_VER3_LEN_OFFSET);
|
||||
mstp_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET);
|
||||
mstp_len += 2; /* length encoding itself is 2 bytes */
|
||||
if (length < (sizeof(struct stp_bpdu_) + mstp_len)) {
|
||||
@ -474,7 +474,7 @@ stp_print(netdissect_options *ndo, const u_char *p, u_int length)
|
||||
if (stp_bpdu->protocol_version == STP_PROTO_SPB)
|
||||
{
|
||||
/* Validate v4 length */
|
||||
ND_TCHECK_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
|
||||
ND_TCHECK_2(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
|
||||
spb_len = EXTRACT_BE_16BITS(p + MST_BPDU_VER3_LEN_OFFSET + mstp_len);
|
||||
spb_len += 2;
|
||||
if (length < (sizeof(struct stp_bpdu_) + mstp_len + spb_len) ||
|
||||
|
@ -101,7 +101,7 @@ tftp_print(netdissect_options *ndo,
|
||||
/* Print tftp request type */
|
||||
if (length < 2)
|
||||
goto trunc;
|
||||
ND_TCHECK_16BITS(bp);
|
||||
ND_TCHECK_2(bp);
|
||||
opcode = EXTRACT_BE_16BITS(bp);
|
||||
cp = tok2str(op2str, "tftp-#%d", opcode);
|
||||
ND_PRINT((ndo, " %s", cp));
|
||||
@ -168,7 +168,7 @@ tftp_print(netdissect_options *ndo,
|
||||
case DATA:
|
||||
if (length < 2)
|
||||
goto trunc; /* no block number */
|
||||
ND_TCHECK_16BITS(bp);
|
||||
ND_TCHECK_2(bp);
|
||||
ND_PRINT((ndo, " block %d", EXTRACT_BE_16BITS(bp)));
|
||||
break;
|
||||
|
||||
@ -176,7 +176,7 @@ tftp_print(netdissect_options *ndo,
|
||||
/* Print error code string */
|
||||
if (length < 2)
|
||||
goto trunc; /* no error code */
|
||||
ND_TCHECK_16BITS(bp);
|
||||
ND_TCHECK_2(bp);
|
||||
ND_PRINT((ndo, " %s", tok2str(err2str, "tftp-err-#%d \"",
|
||||
EXTRACT_BE_16BITS(bp))));
|
||||
bp += 2;
|
||||
|
24
print-udp.c
24
print-udp.c
@ -102,11 +102,11 @@ vat_print(netdissect_options *ndo, const void *hdr, register const struct udphdr
|
||||
/* vat/vt audio */
|
||||
u_int ts;
|
||||
|
||||
ND_TCHECK_16BITS((const u_int *)hdr);
|
||||
ND_TCHECK_2((const u_int *)hdr);
|
||||
ts = EXTRACT_BE_16BITS(hdr);
|
||||
if ((ts & 0xf060) != 0) {
|
||||
/* probably vt */
|
||||
ND_TCHECK_16BITS(&up->uh_ulen);
|
||||
ND_TCHECK_2(&up->uh_ulen);
|
||||
ND_PRINT((ndo, "udp/vt %u %d / %d",
|
||||
(uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up)),
|
||||
ts & 0x3ff, ts >> 10));
|
||||
@ -114,11 +114,11 @@ vat_print(netdissect_options *ndo, const void *hdr, register const struct udphdr
|
||||
/* probably vat */
|
||||
uint32_t i0, i1;
|
||||
|
||||
ND_TCHECK_32BITS(&((const u_int *)hdr)[0]);
|
||||
ND_TCHECK_4(&((const u_int *)hdr)[0]);
|
||||
i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
|
||||
ND_TCHECK_32BITS(&((const u_int *)hdr)[1]);
|
||||
ND_TCHECK_4(&((const u_int *)hdr)[1]);
|
||||
i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
|
||||
ND_TCHECK_16BITS(&up->uh_ulen);
|
||||
ND_TCHECK_2(&up->uh_ulen);
|
||||
ND_PRINT((ndo, "udp/vat %u c%d %u%s",
|
||||
(uint32_t)(EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8),
|
||||
i0 & 0xffff,
|
||||
@ -144,11 +144,11 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
|
||||
uint32_t i0, i1;
|
||||
const char * ptype;
|
||||
|
||||
ND_TCHECK_32BITS(&((const u_int *)hdr)[0]);
|
||||
ND_TCHECK_4(&((const u_int *)hdr)[0]);
|
||||
i0 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[0]);
|
||||
ND_TCHECK_32BITS(&((const u_int *)hdr)[1]);
|
||||
ND_TCHECK_4(&((const u_int *)hdr)[1]);
|
||||
i1 = EXTRACT_BE_32BITS(&((const u_int *)hdr)[1]);
|
||||
ND_TCHECK_16BITS(&up->uh_ulen);
|
||||
ND_TCHECK_2(&up->uh_ulen);
|
||||
dlen = EXTRACT_BE_16BITS(&up->uh_ulen) - sizeof(*up) - 8;
|
||||
ip += 2;
|
||||
len >>= 2;
|
||||
@ -180,12 +180,12 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
|
||||
i0 & 0xffff,
|
||||
i1));
|
||||
if (ndo->ndo_vflag) {
|
||||
ND_TCHECK_32BITS(&((const u_int *)hdr)[2]);
|
||||
ND_TCHECK_4(&((const u_int *)hdr)[2]);
|
||||
ND_PRINT((ndo, " %u", EXTRACT_BE_32BITS(&((const u_int *)hdr)[2])));
|
||||
if (hasopt) {
|
||||
u_int i2, optlen;
|
||||
do {
|
||||
ND_TCHECK_32BITS(ip);
|
||||
ND_TCHECK_4(ip);
|
||||
i2 = EXTRACT_BE_32BITS(ip);
|
||||
optlen = (i2 >> 16) & 0xff;
|
||||
if (optlen == 0 || optlen > len) {
|
||||
@ -198,7 +198,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
|
||||
}
|
||||
if (hasext) {
|
||||
u_int i2, extlen;
|
||||
ND_TCHECK_32BITS(ip);
|
||||
ND_TCHECK_4(ip);
|
||||
i2 = EXTRACT_BE_32BITS(ip);
|
||||
extlen = (i2 & 0xffff) + 1;
|
||||
if (extlen > len) {
|
||||
@ -207,7 +207,7 @@ rtp_print(netdissect_options *ndo, const void *hdr, u_int len,
|
||||
}
|
||||
ip += extlen;
|
||||
}
|
||||
ND_TCHECK_32BITS(ip);
|
||||
ND_TCHECK_4(ip);
|
||||
if (contype == 0x1f) /*XXX H.261 */
|
||||
ND_PRINT((ndo, " 0x%04x", EXTRACT_BE_32BITS(ip) >> 16));
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ vtp_print (netdissect_options *ndo,
|
||||
*
|
||||
*/
|
||||
|
||||
ND_TCHECK_32BITS(tptr);
|
||||
ND_TCHECK_4(tptr);
|
||||
ND_PRINT((ndo, ", Config Rev %x", EXTRACT_BE_32BITS(tptr)));
|
||||
|
||||
/*
|
||||
@ -243,7 +243,7 @@ vtp_print (netdissect_options *ndo,
|
||||
tptr += 4;
|
||||
while (tptr < (pptr+length)) {
|
||||
|
||||
ND_TCHECK_8BITS(tptr);
|
||||
ND_TCHECK_1(tptr);
|
||||
len = *tptr;
|
||||
if (len == 0)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user