Use pointer expressions like in most similar cases

This commit is contained in:
Francois-Xavier Le Bail 2017-11-20 22:58:59 +01:00
parent a58370c17f
commit 93bee24026
18 changed files with 124 additions and 124 deletions

View File

@ -366,7 +366,7 @@ sig_print(netdissect_options *ndo,
* do from the caplen test above, we also know we have
* the call reference.
*/
call_ref = EXTRACT_BE_24BITS(&p[CALL_REF_POS]);
call_ref = EXTRACT_BE_24BITS(p + CALL_REF_POS);
ND_PRINT((ndo, "CALL_REF:0x%06x", call_ref));
} else {
/* SSCOP with some unknown protocol atop it */

View File

@ -1435,8 +1435,8 @@ bgp_attr_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s ",
as_printf(ndo, astostr, sizeof(astostr),
as_size == 2 ?
EXTRACT_BE_16BITS(&tptr[2 + i]) :
EXTRACT_BE_32BITS(&tptr[2 + i]))));
EXTRACT_BE_16BITS(tptr + i + 2) :
EXTRACT_BE_32BITS(tptr + i + 2))));
}
ND_TCHECK(tptr[0]);
ND_PRINT((ndo, "%s", tok2str(bgp_as_path_segment_close_values,

View File

@ -73,9 +73,9 @@ carp_print(netdissect_options *ndo, register const u_char *bp, register u_int le
vec[0].len = len;
if (ND_TTEST2(bp[0], len) && in_cksum(vec, 1))
ND_PRINT((ndo, " (bad carp cksum %x!)",
EXTRACT_BE_16BITS(&bp[6])));
EXTRACT_BE_16BITS(bp + 6)));
}
ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_64BITS(&bp[8])));
ND_PRINT((ndo, "counter=%" PRIu64, EXTRACT_BE_64BITS(bp + 8)));
return;
trunc:

View File

@ -302,7 +302,7 @@ cdp_print_addr(netdissect_options *ndo,
ND_TCHECK2(p[pl], 2);
if (p + pl + 2 > endp)
goto trunc;
al = EXTRACT_BE_16BITS(&p[pl]); /* address length */
al = EXTRACT_BE_16BITS(p + pl); /* address length */
if (pt == PT_NLPID && pl == 1 && *p == NLPID_IP && al == 4) {
/*

View File

@ -59,7 +59,7 @@ chdlc_print(netdissect_options *ndo, register const u_char *p, u_int length)
if (length < CHDLC_HDRLEN)
goto trunc;
ND_TCHECK2(*p, CHDLC_HDRLEN);
proto = EXTRACT_BE_16BITS(&p[2]);
proto = EXTRACT_BE_16BITS(p + 2);
if (ndo->ndo_eflag) {
ND_PRINT((ndo, "%s, ethertype %s (0x%04x), length %u: ",
tok2str(chdlc_cast_values, "0x%02x", p[0]),

View File

@ -322,8 +322,8 @@ dhcp6opt_print(netdissect_options *ndo,
case 1:
if (optlen >= 2 + 6) {
ND_PRINT((ndo, " hwaddr/time type %u time %u ",
EXTRACT_BE_16BITS(&tp[2]),
EXTRACT_BE_32BITS(&tp[4])));
EXTRACT_BE_16BITS(tp + 2),
EXTRACT_BE_32BITS(tp + 4)));
for (i = 8; i < optlen; i++)
ND_PRINT((ndo, "%02x", tp[i]));
/*(*/
@ -348,7 +348,7 @@ dhcp6opt_print(netdissect_options *ndo,
case 3:
if (optlen >= 2 + 2) {
ND_PRINT((ndo, " hwaddr type %u ",
EXTRACT_BE_16BITS(&tp[2])));
EXTRACT_BE_16BITS(tp + 2)));
for (i = 4; i < optlen; i++)
ND_PRINT((ndo, "%02x", tp[i]));
/*(*/
@ -372,8 +372,8 @@ dhcp6opt_print(netdissect_options *ndo,
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0])));
ND_PRINT((ndo, " pltime:%u vltime:%u",
EXTRACT_BE_32BITS(&tp[16]),
EXTRACT_BE_32BITS(&tp[20])));
EXTRACT_BE_32BITS(tp + 16),
EXTRACT_BE_32BITS(tp + 20)));
if (optlen > 24) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 24, tp + optlen);
@ -389,7 +389,7 @@ dhcp6opt_print(netdissect_options *ndo,
tp = (const u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 2) {
ND_PRINT((ndo, " %s",
tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_16BITS(&tp[i]))));
tok2str(dh6opt_str, "opt_%u", EXTRACT_BE_16BITS(tp + i))));
}
ND_PRINT((ndo, ")"));
break;
@ -579,7 +579,7 @@ dhcp6opt_print(netdissect_options *ndo,
break;
}
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_16BITS(&tp[0]))));
ND_PRINT((ndo, " %s)", dhcp6stcode(EXTRACT_BE_16BITS(tp))));
break;
case DH6OPT_IA_NA:
case DH6OPT_IA_PD:
@ -589,9 +589,9 @@ dhcp6opt_print(netdissect_options *ndo,
}
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " IAID:%u T1:%u T2:%u",
EXTRACT_BE_32BITS(&tp[0]),
EXTRACT_BE_32BITS(&tp[4]),
EXTRACT_BE_32BITS(&tp[8])));
EXTRACT_BE_32BITS(tp),
EXTRACT_BE_32BITS(tp + 4),
EXTRACT_BE_32BITS(tp + 8)));
if (optlen > 12) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 12, tp + optlen);
@ -619,8 +619,8 @@ dhcp6opt_print(netdissect_options *ndo,
tp = (const u_char *)(dh6o + 1);
ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, &tp[9]), tp[8]));
ND_PRINT((ndo, " pltime:%u vltime:%u",
EXTRACT_BE_32BITS(&tp[0]),
EXTRACT_BE_32BITS(&tp[4])));
EXTRACT_BE_32BITS(tp),
EXTRACT_BE_32BITS(tp + 4)));
if (optlen > 25) {
/* there are sub-options */
dhcp6opt_print(ndo, tp + 25, tp + optlen);

View File

@ -1505,7 +1505,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len)
}
ND_TCHECK2(bp[26], 2);
nsrcs = EXTRACT_BE_16BITS(&bp[26]);
nsrcs = EXTRACT_BE_16BITS(bp + 26);
if (nsrcs > 0) {
if (len < 28 + nsrcs * sizeof(struct in6_addr))
ND_PRINT((ndo," [invalid number of sources]"));

View File

@ -159,7 +159,7 @@ print_igmpv3_report(netdissect_options *ndo,
return;
}
ND_TCHECK2(bp[6], 2);
ngroups = EXTRACT_BE_16BITS(&bp[6]);
ngroups = EXTRACT_BE_16BITS(bp + 6);
ND_PRINT((ndo, ", %d group record(s)", ngroups));
if (ndo->ndo_vflag > 0) {
/* Print the group records */
@ -173,7 +173,7 @@ print_igmpv3_report(netdissect_options *ndo,
ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[group+4])));
ND_PRINT((ndo, " %s", tok2str(igmpv3report2str, " [v3-report-#%d]",
bp[group])));
nsrcs = EXTRACT_BE_16BITS(&bp[group + 2]);
nsrcs = EXTRACT_BE_16BITS(bp + group + 2);
/* Check the number of sources and print them */
if (len < group+8+(nsrcs<<2)) {
ND_PRINT((ndo, " [invalid number of sources %d]", nsrcs));
@ -232,11 +232,11 @@ print_igmpv3_query(netdissect_options *ndo,
ND_PRINT((ndo, "]"));
}
ND_TCHECK2(bp[4], 4);
if (EXTRACT_BE_32BITS(&bp[4]) == 0)
if (EXTRACT_BE_32BITS(bp + 4) == 0)
return;
ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[4])));
ND_TCHECK2(bp[10], 2);
nsrcs = EXTRACT_BE_16BITS(&bp[10]);
nsrcs = EXTRACT_BE_16BITS(bp + 10);
if (nsrcs > 0) {
if (len < 12 + (nsrcs << 2))
ND_PRINT((ndo, " [invalid number of sources]"));
@ -282,7 +282,7 @@ igmp_print(netdissect_options *ndo,
} else
ND_PRINT((ndo, " v1"));
ND_TCHECK2(bp[4], 4);
if (EXTRACT_BE_32BITS(&bp[4]))
if (EXTRACT_BE_32BITS(bp + 4))
ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, &bp[4])));
if (len != 8)
ND_PRINT((ndo, " [len %d]", len));
@ -333,7 +333,7 @@ igmp_print(netdissect_options *ndo,
vec[0].ptr = bp;
vec[0].len = len;
if (in_cksum(vec, 1))
ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_BE_16BITS(&bp[2])));
ND_PRINT((ndo, " bad igmp cksum %x!", EXTRACT_BE_16BITS(bp + 2)));
}
return;
trunc:

View File

@ -220,7 +220,7 @@ ip_printts(netdissect_options *ndo,
if (ptr == len)
type = " ^ ";
ND_TCHECK2(cp[len], hoplen);
ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_32BITS(&cp[len + hoplen - 4]),
ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_32BITS(cp + len + hoplen - 4),
hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len])));
type = " ";
}
@ -302,8 +302,8 @@ ip_optprint(netdissect_options *ndo,
break;
}
ND_TCHECK(cp[3]);
if (EXTRACT_BE_16BITS(&cp[2]) != 0)
ND_PRINT((ndo, " value %u", EXTRACT_BE_16BITS(&cp[2])));
if (EXTRACT_BE_16BITS(cp + 2) != 0)
ND_PRINT((ndo, " value %u", EXTRACT_BE_16BITS(cp + 2)));
break;
case IPOPT_NOP: /* nothing to print - fall through */

View File

@ -125,7 +125,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len)
ND_PRINT((ndo, "(rtalert: invalid len %d)", bp[i + 1]));
goto trunc;
}
ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_16BITS(&bp[i + 2])));
ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_16BITS(bp + i + 2)));
break;
case IP6OPT_JUMBO:
if (len - i < IP6OPT_JUMBO_LEN) {
@ -136,7 +136,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len)
ND_PRINT((ndo, "(jumbo: invalid len %d)", bp[i + 1]));
goto trunc;
}
ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_32BITS(&bp[i + 2])));
ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_32BITS(bp + i + 2)));
break;
case IP6OPT_HOME_ADDRESS:
if (len - i < IP6OPT_HOMEADDR_MINLEN) {

View File

@ -165,7 +165,7 @@ ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length)
ND_PRINT((ndo, "ipx-sap-nearest-req"));
ND_TCHECK(ipx[0]);
ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(&ipx[0])))));
ND_PRINT((ndo, " %s", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(ipx)))));
break;
case 2:
@ -177,14 +177,14 @@ ipx_sap_print(netdissect_options *ndo, const u_short *ipx, u_int length)
for (i = 0; i < 8 && length > 0; i++) {
ND_TCHECK(ipx[0]);
ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(&ipx[0])))));
ND_PRINT((ndo, " %s '", ipxsap_string(ndo, htons(EXTRACT_BE_16BITS(ipx)))));
if (fn_printzp(ndo, (const u_char *)&ipx[1], 48, ndo->ndo_snapend)) {
ND_PRINT((ndo, "'"));
goto trunc;
}
ND_TCHECK2(ipx[25], 10);
ND_PRINT((ndo, "' addr %s",
ipxaddr_string(EXTRACT_BE_32BITS(&ipx[25]), (const u_char *)&ipx[27])));
ipxaddr_string(EXTRACT_BE_32BITS(ipx + 25), (const u_char *)&ipx[27])));
ipx += 32;
length -= 64;
}
@ -213,16 +213,16 @@ ipx_rip_print(netdissect_options *ndo, const u_short *ipx, u_int length)
ND_PRINT((ndo, "ipx-rip-req"));
if (length > 0) {
ND_TCHECK(ipx[3]);
ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(&ipx[0]),
EXTRACT_BE_16BITS(&ipx[2]), EXTRACT_BE_16BITS(&ipx[3])));
ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(ipx),
EXTRACT_BE_16BITS(ipx + 2), EXTRACT_BE_16BITS(ipx + 3)));
}
break;
case 2:
ND_PRINT((ndo, "ipx-rip-resp"));
for (i = 0; i < 50 && length > 0; i++) {
ND_TCHECK(ipx[3]);
ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(&ipx[0]),
EXTRACT_BE_16BITS(&ipx[2]), EXTRACT_BE_16BITS(&ipx[3])));
ND_PRINT((ndo, " %08x/%d.%d", EXTRACT_BE_32BITS(ipx),
EXTRACT_BE_16BITS(ipx + 2), EXTRACT_BE_16BITS(ipx + 3)));
ipx += 4;
length -= 8;

View File

@ -923,7 +923,7 @@ ikev1_attrmap_print(netdissect_options *ndo,
totlen = 4;
else {
ND_TCHECK_16BITS(&p[2]);
totlen = 4 + EXTRACT_BE_16BITS(&p[2]);
totlen = 4 + EXTRACT_BE_16BITS(p + 2);
}
if (ep2 < p + totlen) {
ND_PRINT((ndo,"[|attr]"));
@ -932,7 +932,7 @@ ikev1_attrmap_print(netdissect_options *ndo,
ND_TCHECK_16BITS(&p[0]);
ND_PRINT((ndo,"("));
t = EXTRACT_BE_16BITS(&p[0]) & 0x7fff;
t = EXTRACT_BE_16BITS(p) & 0x7fff;
if (map && t < nmap && map[t].type)
ND_PRINT((ndo,"type=%s ", map[t].type));
else
@ -940,7 +940,7 @@ ikev1_attrmap_print(netdissect_options *ndo,
if (p[0] & 0x80) {
ND_PRINT((ndo,"value="));
ND_TCHECK_16BITS(&p[2]);
v = EXTRACT_BE_16BITS(&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]));
else {
@ -974,7 +974,7 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2)
totlen = 4;
else {
ND_TCHECK_16BITS(&p[2]);
totlen = 4 + EXTRACT_BE_16BITS(&p[2]);
totlen = 4 + EXTRACT_BE_16BITS(p + 2);
}
if (ep2 < p + totlen) {
ND_PRINT((ndo,"[|attr]"));
@ -983,7 +983,7 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2)
ND_TCHECK_16BITS(&p[0]);
ND_PRINT((ndo,"("));
t = EXTRACT_BE_16BITS(&p[0]) & 0x7fff;
t = EXTRACT_BE_16BITS(p) & 0x7fff;
ND_PRINT((ndo,"type=#%d ", t));
if (p[0] & 0x80) {
ND_PRINT((ndo,"value="));

View File

@ -152,7 +152,7 @@ mobility_opt_print(netdissect_options *ndo,
/* units of 4 secs */
ND_TCHECK_16BITS(&bp[i+2]);
ND_PRINT((ndo, "(refresh: %u)",
EXTRACT_BE_16BITS(&bp[i + 2]) << 2));
EXTRACT_BE_16BITS(bp + i + 2) << 2));
break;
case IP6MOPT_ALTCOA:
if (len - i < IP6MOPT_ALTCOA_MINLEN) {
@ -170,8 +170,8 @@ mobility_opt_print(netdissect_options *ndo,
ND_TCHECK_16BITS(&bp[i+2]);
ND_TCHECK_16BITS(&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])));
EXTRACT_BE_16BITS(bp + i + 2),
EXTRACT_BE_16BITS(bp + i + 4)));
break;
case IP6MOPT_AUTH:
if (len - i < IP6MOPT_AUTH_MINLEN) {
@ -250,8 +250,8 @@ mobility_print(netdissect_options *ndo,
ND_TCHECK_32BITS(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
type == IP6M_HOME_TEST_INIT ? "Home" : "Care-of",
EXTRACT_BE_32BITS(&bp[hlen]),
EXTRACT_BE_32BITS(&bp[hlen + 4])));
EXTRACT_BE_32BITS(bp + hlen),
EXTRACT_BE_32BITS(bp + hlen + 4)));
}
hlen += 8;
break;
@ -264,16 +264,16 @@ mobility_print(netdissect_options *ndo,
ND_TCHECK_32BITS(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Init Cookie=%08x:%08x",
type == IP6M_HOME_TEST ? "Home" : "Care-of",
EXTRACT_BE_32BITS(&bp[hlen]),
EXTRACT_BE_32BITS(&bp[hlen + 4])));
EXTRACT_BE_32BITS(bp + hlen),
EXTRACT_BE_32BITS(bp + hlen + 4)));
}
hlen += 8;
if (ndo->ndo_vflag) {
ND_TCHECK_32BITS(&bp[hlen + 4]);
ND_PRINT((ndo, " %s Keygen Token=%08x:%08x",
type == IP6M_HOME_TEST ? "Home" : "Care-of",
EXTRACT_BE_32BITS(&bp[hlen]),
EXTRACT_BE_32BITS(&bp[hlen + 4])));
EXTRACT_BE_32BITS(bp + hlen),
EXTRACT_BE_32BITS(bp + hlen + 4)));
}
hlen += 8;
break;
@ -299,7 +299,7 @@ mobility_print(netdissect_options *ndo,
hlen += 1;
ND_TCHECK_16BITS(&bp[hlen]);
/* units of 4 secs */
ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(&bp[hlen]) << 2));
ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2));
hlen += 2;
break;
case IP6M_BINDING_ACK:
@ -311,11 +311,11 @@ mobility_print(netdissect_options *ndo,
/* Reserved (7bits) */
hlen = IP6M_MINLEN;
ND_TCHECK_16BITS(&bp[hlen]);
ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(&bp[hlen])));
ND_PRINT((ndo, " seq#=%u", EXTRACT_BE_16BITS(bp + hlen)));
hlen += 2;
ND_TCHECK_16BITS(&bp[hlen]);
/* units of 4 secs */
ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(&bp[hlen]) << 2));
ND_PRINT((ndo, " lifetime=%u", EXTRACT_BE_16BITS(bp + hlen) << 2));
hlen += 2;
break;
case IP6M_BINDING_ERROR:

View File

@ -426,11 +426,11 @@ parsereq(netdissect_options *ndo,
*/
dp = (const uint32_t *)&rp->rm_call.cb_cred;
ND_TCHECK(dp[1]);
len = EXTRACT_BE_32BITS(&dp[1]);
len = EXTRACT_BE_32BITS(dp + 1);
if (len < length) {
dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp);
ND_TCHECK(dp[1]);
len = EXTRACT_BE_32BITS(&dp[1]);
len = EXTRACT_BE_32BITS(dp + 1);
if (len < length) {
dp += (len + (2 * sizeof(*dp) + 3)) / sizeof(*dp);
ND_TCHECK2(dp[0], 0);
@ -571,7 +571,7 @@ nfsreq_noaddr_print(netdissect_options *ndo,
if ((dp = parsereq(ndo, rp, length)) != NULL &&
(dp = parsefh(ndo, dp, v3)) != NULL) {
ND_TCHECK(dp[0]);
access_flags = EXTRACT_BE_32BITS(&dp[0]);
access_flags = EXTRACT_BE_32BITS(dp);
if (access_flags & ~NFSV3ACCESS_FULL) {
/* NFSV3ACCESS definitions aren't up to date */
ND_PRINT((ndo, " %04x", access_flags));
@ -612,13 +612,13 @@ nfsreq_noaddr_print(netdissect_options *ndo,
if (v3) {
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " %u bytes @ %" PRIu64,
EXTRACT_BE_32BITS(&dp[2]),
EXTRACT_BE_64BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 2),
EXTRACT_BE_64BITS(dp)));
} else {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " %u bytes @ %u",
EXTRACT_BE_32BITS(&dp[1]),
EXTRACT_BE_32BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 1),
EXTRACT_BE_32BITS(dp)));
}
return;
}
@ -630,21 +630,21 @@ nfsreq_noaddr_print(netdissect_options *ndo,
if (v3) {
ND_TCHECK(dp[4]);
ND_PRINT((ndo, " %u (%u) bytes @ %" PRIu64,
EXTRACT_BE_32BITS(&dp[4]),
EXTRACT_BE_32BITS(&dp[2]),
EXTRACT_BE_64BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 4),
EXTRACT_BE_32BITS(dp + 2),
EXTRACT_BE_64BITS(dp)));
if (ndo->ndo_vflag) {
ND_PRINT((ndo, " <%s>",
tok2str(nfsv3_writemodes,
NULL, EXTRACT_BE_32BITS(&dp[3]))));
NULL, EXTRACT_BE_32BITS(dp + 3))));
}
} else {
ND_TCHECK(dp[3]);
ND_PRINT((ndo, " %u (%u) bytes @ %u (%u)",
EXTRACT_BE_32BITS(&dp[3]),
EXTRACT_BE_32BITS(&dp[2]),
EXTRACT_BE_32BITS(&dp[1]),
EXTRACT_BE_32BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 3),
EXTRACT_BE_32BITS(dp + 2),
EXTRACT_BE_32BITS(dp + 1),
EXTRACT_BE_32BITS(dp)));
}
return;
}
@ -676,8 +676,8 @@ nfsreq_noaddr_print(netdissect_options *ndo,
if (ndo->ndo_vflag && (type == NFCHR || type == NFBLK)) {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " %u/%u",
EXTRACT_BE_32BITS(&dp[0]),
EXTRACT_BE_32BITS(&dp[1])));
EXTRACT_BE_32BITS(dp),
EXTRACT_BE_32BITS(dp + 1)));
dp += 2;
}
if (ndo->ndo_vflag)
@ -714,8 +714,8 @@ nfsreq_noaddr_print(netdissect_options *ndo,
* offset cookie here.
*/
ND_PRINT((ndo, " %u bytes @ %" PRId64,
EXTRACT_BE_32BITS(&dp[4]),
EXTRACT_BE_64BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 4),
EXTRACT_BE_64BITS(dp)));
if (ndo->ndo_vflag)
ND_PRINT((ndo, " verf %08x%08x", dp[2], dp[3]));
} else {
@ -725,8 +725,8 @@ nfsreq_noaddr_print(netdissect_options *ndo,
* common, but offsets > 2^31 aren't.
*/
ND_PRINT((ndo, " %u bytes @ %d",
EXTRACT_BE_32BITS(&dp[1]),
EXTRACT_BE_32BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 1),
EXTRACT_BE_32BITS(dp)));
}
return;
}
@ -741,12 +741,12 @@ nfsreq_noaddr_print(netdissect_options *ndo,
* cookie here.
*/
ND_PRINT((ndo, " %u bytes @ %" PRId64,
EXTRACT_BE_32BITS(&dp[4]),
EXTRACT_BE_64BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 4),
EXTRACT_BE_64BITS(dp)));
if (ndo->ndo_vflag) {
ND_TCHECK(dp[5]);
ND_PRINT((ndo, " max %u verf %08x%08x",
EXTRACT_BE_32BITS(&dp[5]), dp[2], dp[3]));
EXTRACT_BE_32BITS(dp + 5), dp[2], dp[3]));
}
return;
}
@ -757,8 +757,8 @@ nfsreq_noaddr_print(netdissect_options *ndo,
(dp = parsefh(ndo, dp, v3)) != NULL) {
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " %u bytes @ %" PRIu64,
EXTRACT_BE_32BITS(&dp[2]),
EXTRACT_BE_64BITS(&dp[0])));
EXTRACT_BE_32BITS(dp + 2),
EXTRACT_BE_64BITS(dp)));
return;
}
break;
@ -997,7 +997,7 @@ parserep(netdissect_options *ndo,
*/
dp = ((const uint32_t *)&rp->rm_reply) + 1;
ND_TCHECK(dp[1]);
len = EXTRACT_BE_32BITS(&dp[1]);
len = EXTRACT_BE_32BITS(dp + 1);
if (len >= length)
return (NULL);
/*
@ -1030,7 +1030,7 @@ parsestatus(netdissect_options *ndo,
ND_TCHECK(dp[0]);
errnum = EXTRACT_BE_32BITS(&dp[0]);
errnum = EXTRACT_BE_32BITS(dp);
if (er)
*er = errnum;
if (errnum != 0) {
@ -1232,7 +1232,7 @@ parserddires(netdissect_options *ndo,
ND_TCHECK(dp[2]);
ND_PRINT((ndo, " offset 0x%x size %d ",
EXTRACT_BE_32BITS(&dp[0]), EXTRACT_BE_32BITS(&dp[1])));
EXTRACT_BE_32BITS(dp), EXTRACT_BE_32BITS(dp + 1)));
if (dp[2] != 0)
ND_PRINT((ndo, " eof"));
@ -1246,10 +1246,10 @@ parse_wcc_attr(netdissect_options *ndo,
const uint32_t *dp)
{
/* Our caller has already checked this */
ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_BE_64BITS(&dp[0])));
ND_PRINT((ndo, " sz %" PRIu64, EXTRACT_BE_64BITS(dp)));
ND_PRINT((ndo, " mtime %u.%06u ctime %u.%06u",
EXTRACT_BE_32BITS(&dp[2]), EXTRACT_BE_32BITS(&dp[3]),
EXTRACT_BE_32BITS(&dp[4]), EXTRACT_BE_32BITS(&dp[5])));
EXTRACT_BE_32BITS(dp + 2), EXTRACT_BE_32BITS(dp + 3),
EXTRACT_BE_32BITS(dp + 4), EXTRACT_BE_32BITS(dp + 5)));
return (dp + 6);
}
@ -1261,7 +1261,7 @@ parse_pre_op_attr(netdissect_options *ndo,
const uint32_t *dp, int verbose)
{
ND_TCHECK(dp[0]);
if (!EXTRACT_BE_32BITS(&dp[0]))
if (!EXTRACT_BE_32BITS(dp))
return (dp + 1);
dp++;
ND_TCHECK2(*dp, 24);
@ -1283,7 +1283,7 @@ parse_post_op_attr(netdissect_options *ndo,
const uint32_t *dp, int verbose)
{
ND_TCHECK(dp[0]);
if (!EXTRACT_BE_32BITS(&dp[0]))
if (!EXTRACT_BE_32BITS(dp))
return (dp + 1);
dp++;
if (verbose) {
@ -1320,7 +1320,7 @@ parsecreateopres(netdissect_options *ndo,
dp = parse_wcc_data(ndo, dp, verbose);
else {
ND_TCHECK(dp[0]);
if (!EXTRACT_BE_32BITS(&dp[0]))
if (!EXTRACT_BE_32BITS(dp))
return (dp + 1);
dp++;
if (!(dp = parsefh(ndo, dp, 1)))
@ -1516,7 +1516,7 @@ interp_reply(netdissect_options *ndo,
break;
if (!er) {
ND_TCHECK(dp[0]);
ND_PRINT((ndo, " c %04x", EXTRACT_BE_32BITS(&dp[0])));
ND_PRINT((ndo, " c %04x", EXTRACT_BE_32BITS(dp)));
}
return;
@ -1538,8 +1538,8 @@ interp_reply(netdissect_options *ndo,
return;
if (ndo->ndo_vflag) {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(&dp[0])));
if (EXTRACT_BE_32BITS(&dp[1]))
ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(dp)));
if (EXTRACT_BE_32BITS(dp + 1))
ND_PRINT((ndo, " EOF"));
}
return;
@ -1561,12 +1561,12 @@ interp_reply(netdissect_options *ndo,
return;
if (ndo->ndo_vflag) {
ND_TCHECK(dp[0]);
ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(&dp[0])));
ND_PRINT((ndo, " %u bytes", EXTRACT_BE_32BITS(dp)));
if (ndo->ndo_vflag > 1) {
ND_TCHECK(dp[1]);
ND_PRINT((ndo, " <%s>",
tok2str(nfsv3_writemodes,
NULL, EXTRACT_BE_32BITS(&dp[1]))));
NULL, EXTRACT_BE_32BITS(dp + 1))));
}
return;
}

View File

@ -148,11 +148,11 @@ pimv1_join_prune_print(netdissect_options *ndo,
/* If it's a single group and a single source, use 1-line output. */
if (ND_TTEST2(bp[0], 30) && bp[11] == 1 &&
((njoin = EXTRACT_BE_16BITS(&bp[20])) + EXTRACT_BE_16BITS(&bp[22])) == 1) {
((njoin = EXTRACT_BE_16BITS(bp + 20)) + EXTRACT_BE_16BITS(bp + 22)) == 1) {
int hold;
ND_PRINT((ndo, " RPF %s ", ipaddr_string(ndo, bp)));
hold = EXTRACT_BE_16BITS(&bp[6]);
hold = EXTRACT_BE_16BITS(bp + 6);
if (hold != 180) {
ND_PRINT((ndo, "Hold "));
unsigned_relts_print(ndo, hold);
@ -160,7 +160,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune",
ipaddr_string(ndo, &bp[26]), bp[25] & 0x3f,
ipaddr_string(ndo, &bp[12])));
if (EXTRACT_BE_32BITS(&bp[16]) != 0xffffffff)
if (EXTRACT_BE_32BITS(bp + 16) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[16])));
ND_PRINT((ndo, ") %s%s %s",
(bp[24] & 0x01) ? "Sparse" : "Dense",
@ -183,7 +183,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, "\n"));
ND_PRINT((ndo, " Hold time: "));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2]));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2));
if (ndo->ndo_vflag < 2)
return;
bp += 4;
@ -209,15 +209,15 @@ pimv1_join_prune_print(netdissect_options *ndo,
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], sizeof(struct in_addr));
if (EXTRACT_BE_32BITS(&bp[0]) != 0xffffffff)
if (EXTRACT_BE_32BITS(bp) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[0])));
bp += 4;
len -= 4;
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], 4);
njoin = EXTRACT_BE_16BITS(&bp[0]);
nprune = EXTRACT_BE_16BITS(&bp[2]);
njoin = EXTRACT_BE_16BITS(bp);
nprune = EXTRACT_BE_16BITS(bp + 2);
ND_PRINT((ndo, " joined: %d pruned: %d", njoin, nprune));
bp += 4;
len -= 4;
@ -278,7 +278,7 @@ pimv1_print(netdissect_options *ndo,
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[10],2);
ND_PRINT((ndo, " (Hold-time "));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[10]));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 10));
ND_PRINT((ndo, ")"));
}
break;
@ -297,23 +297,23 @@ pimv1_print(netdissect_options *ndo,
if (ndo->ndo_vflag) {
ND_TCHECK2(bp[22], 2);
ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8])));
if (EXTRACT_BE_32BITS(&bp[12]) != 0xffffffff)
if (EXTRACT_BE_32BITS(bp + 12) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16])));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[22]));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 22));
}
break;
case PIMV1_TYPE_ASSERT:
ND_TCHECK2(bp[16], sizeof(struct in_addr));
ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]),
ipaddr_string(ndo, &bp[8])));
if (EXTRACT_BE_32BITS(&bp[12]) != 0xffffffff)
if (EXTRACT_BE_32BITS(bp + 12) != 0xffffffff)
ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
ND_TCHECK2(bp[24], 4);
ND_PRINT((ndo, " %s pref %d metric %d",
(bp[20] & 0x80) ? "RP-tree" : "SPT",
EXTRACT_BE_32BITS(&bp[20]) & 0x7fffffff,
EXTRACT_BE_32BITS(&bp[24])));
EXTRACT_BE_32BITS(bp + 20) & 0x7fffffff,
EXTRACT_BE_32BITS(bp + 24)));
break;
case PIMV1_TYPE_JOIN_PRUNE:
case PIMV1_TYPE_GRAFT:
@ -371,9 +371,9 @@ cisco_autorp_print(netdissect_options *ndo,
ND_TCHECK2(bp[2], 2);
ND_PRINT((ndo, " Hold "));
hold = EXTRACT_BE_16BITS(&bp[2]);
hold = EXTRACT_BE_16BITS(bp + 2);
if (hold)
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2]));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2));
else
ND_PRINT((ndo, "FOREVER"));
@ -760,8 +760,8 @@ pimv2_print(netdissect_options *ndo,
if (len < 4)
goto trunc;
ND_TCHECK2(bp[0], 4);
otype = EXTRACT_BE_16BITS(&bp[0]);
olen = EXTRACT_BE_16BITS(&bp[2]);
otype = EXTRACT_BE_16BITS(bp);
olen = EXTRACT_BE_16BITS(bp + 2);
ND_PRINT((ndo, "\n\t %s Option (%u), length %u, Value: ",
tok2str(pimv2_hello_option_values, "Unknown", otype),
otype,
@ -977,7 +977,7 @@ pimv2_print(netdissect_options *ndo,
goto trunc;
ND_TCHECK2(*bp, 4);
ngroup = bp[1];
holdtime = EXTRACT_BE_16BITS(&bp[2]);
holdtime = EXTRACT_BE_16BITS(bp + 2);
ND_PRINT((ndo, "\n\t %u group(s)", ngroup));
if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/
ND_PRINT((ndo, ", holdtime: "));
@ -995,8 +995,8 @@ pimv2_print(netdissect_options *ndo,
if (len < 4)
goto trunc;
ND_TCHECK2(*bp, 4);
njoin = EXTRACT_BE_16BITS(&bp[0]);
nprune = EXTRACT_BE_16BITS(&bp[2]);
njoin = EXTRACT_BE_16BITS(bp);
nprune = EXTRACT_BE_16BITS(bp + 2);
ND_PRINT((ndo, ", joined sources: %u, pruned sources: %u", njoin, nprune));
bp += 4; len -= 4;
for (j = 0; j < njoin; j++) {
@ -1110,8 +1110,8 @@ pimv2_print(netdissect_options *ndo,
ND_TCHECK2(*bp, 8);
if (bp[0] & 0x80)
ND_PRINT((ndo, " RPT"));
ND_PRINT((ndo, " pref=%u", EXTRACT_BE_32BITS(&bp[0]) & 0x7fffffff));
ND_PRINT((ndo, " metric=%u", EXTRACT_BE_32BITS(&bp[4])));
ND_PRINT((ndo, " pref=%u", EXTRACT_BE_32BITS(bp) & 0x7fffffff));
ND_PRINT((ndo, " metric=%u", EXTRACT_BE_32BITS(bp + 4)));
break;
case PIMV2_TYPE_CANDIDATE_RP:
@ -1132,7 +1132,7 @@ pimv2_print(netdissect_options *ndo,
goto trunc;
ND_TCHECK_16BITS(&bp[2]);
ND_PRINT((ndo, " holdtime="));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(&bp[2]));
unsigned_relts_print(ndo, EXTRACT_BE_16BITS(bp + 2));
bp += 4;
len -= 4;

View File

@ -821,7 +821,7 @@ print_smb(netdissect_options *ndo,
return;
ND_TCHECK_16BITS(&buf[10]);
flags2 = EXTRACT_LE_16BITS(&buf[10]);
flags2 = EXTRACT_LE_16BITS(buf + 10);
unicodestr = flags2 & 0x8000;
nterrcodes = flags2 & 0x4000;
@ -829,12 +829,12 @@ print_smb(netdissect_options *ndo,
smb_fdata(ndo, buf, fmt_smbheader, buf + 33, unicodestr);
if (nterrcodes) {
nterror = EXTRACT_LE_32BITS(&buf[5]);
nterror = EXTRACT_LE_32BITS(buf + 5);
if (nterror)
ND_PRINT((ndo, "NTError = %s\n", nt_errstr(nterror)));
} else {
if (buf[5])
ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_16BITS(&buf[7]))));
ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_16BITS(buf + 7))));
}
smboffset = 32;

View File

@ -96,7 +96,7 @@ sunatm_if_print(netdissect_options *ndo,
break;
}
vci = EXTRACT_BE_16BITS(&p[VCI_POS]);
vci = EXTRACT_BE_16BITS(p + VCI_POS);
vpi = p[VPI_POS];
p += PKT_BEGIN_POS;

View File

@ -144,7 +144,7 @@ vrrp_print(netdissect_options *ndo,
vec[0].len = len;
if (in_cksum(vec, 1))
ND_PRINT((ndo, ", (bad vrrp cksum %x)",
EXTRACT_BE_16BITS(&bp[6])));
EXTRACT_BE_16BITS(bp + 6)));
}
if (version == 3 && ND_TTEST2(bp[0], len)) {
@ -152,7 +152,7 @@ vrrp_print(netdissect_options *ndo,
len, len, IPPROTO_VRRP);
if (cksum)
ND_PRINT((ndo, ", (bad vrrp cksum %x)",
EXTRACT_BE_16BITS(&bp[6])));
EXTRACT_BE_16BITS(bp + 6)));
}
ND_PRINT((ndo, ", addrs"));