mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-27 03:53:53 +08:00
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (22/n)
In ND_PRINT() macro calls, *p++. Partial list.
This commit is contained in:
parent
6d78d5e47c
commit
01cd3621f1
12
print-cdp.c
12
print-cdp.c
@ -342,8 +342,10 @@ cdp_print_addr(netdissect_options *ndo,
|
||||
if (p + pl > endp)
|
||||
goto trunc;
|
||||
ND_PRINT((ndo, "pt=0x%02x, pl=%d, pb=", EXTRACT_8BITS((p - 2)), pl));
|
||||
while (pl-- > 0)
|
||||
ND_PRINT((ndo, " %02x", *p++));
|
||||
while (pl-- > 0) {
|
||||
ND_PRINT((ndo, " %02x", EXTRACT_8BITS(p)));
|
||||
p++;
|
||||
}
|
||||
ND_TCHECK2(*p, 2);
|
||||
if (p + 2 > endp)
|
||||
goto trunc;
|
||||
@ -352,8 +354,10 @@ cdp_print_addr(netdissect_options *ndo,
|
||||
ND_TCHECK2(*p, al);
|
||||
if (p + al > endp)
|
||||
goto trunc;
|
||||
while (al-- > 0)
|
||||
ND_PRINT((ndo, " %02x", *p++));
|
||||
while (al-- > 0) {
|
||||
ND_PRINT((ndo, " %02x", EXTRACT_8BITS(p)));
|
||||
p++;
|
||||
}
|
||||
}
|
||||
num--;
|
||||
if (num)
|
||||
|
@ -617,7 +617,8 @@ print_lladdr(netdissect_options *ndo, const uint8_t *p, size_t l)
|
||||
while (l > 0 && q < ep) {
|
||||
if (q > p)
|
||||
ND_PRINT((ndo,":"));
|
||||
ND_PRINT((ndo,"%02x", *q++));
|
||||
ND_PRINT((ndo,"%02x", EXTRACT_8BITS(q)));
|
||||
q++;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
|
@ -203,10 +203,12 @@ krb4_print(netdissect_options *ndo,
|
||||
case AUTH_MSG_APPL_REQUEST:
|
||||
cp += 2;
|
||||
ND_TCHECK(*cp);
|
||||
ND_PRINT((ndo, "v%d ", *cp++));
|
||||
ND_PRINT((ndo, "v%d ", EXTRACT_8BITS(cp)));
|
||||
cp++;
|
||||
PRINT;
|
||||
ND_TCHECK(*cp);
|
||||
ND_PRINT((ndo, " (%d)", *cp++));
|
||||
ND_PRINT((ndo, " (%d)", EXTRACT_8BITS(cp)));
|
||||
cp++;
|
||||
ND_TCHECK(*cp);
|
||||
ND_PRINT((ndo, " (%d)", *cp));
|
||||
break;
|
||||
|
@ -268,7 +268,8 @@ print_string(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
{
|
||||
u_int i;
|
||||
for (i=0; i<length; i++) {
|
||||
ND_PRINT((ndo, "%c", *dat++));
|
||||
ND_PRINT((ndo, "%c", EXTRACT_8BITS(dat)));
|
||||
dat++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,7 +278,8 @@ print_octets(netdissect_options *ndo, const u_char *dat, u_int length)
|
||||
{
|
||||
u_int i;
|
||||
for (i=0; i<length; i++) {
|
||||
ND_PRINT((ndo, "%02x", *dat++));
|
||||
ND_PRINT((ndo, "%02x", EXTRACT_8BITS(dat)));
|
||||
dat++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,8 +367,10 @@ remove_addr_print(netdissect_options *ndo,
|
||||
|
||||
opt_len -= 3;
|
||||
ND_PRINT((ndo, " id"));
|
||||
while (opt_len--)
|
||||
ND_PRINT((ndo, " %u", *addr_id++));
|
||||
while (opt_len--) {
|
||||
ND_PRINT((ndo, " %u", EXTRACT_8BITS(addr_id)));
|
||||
addr_id++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -883,7 +883,8 @@ handle_chap(netdissect_options *ndo,
|
||||
ND_PRINT((ndo, ", Value "));
|
||||
for (i = 0; i < val_size; i++) {
|
||||
ND_TCHECK(*p);
|
||||
ND_PRINT((ndo, "%02x", *p++));
|
||||
ND_PRINT((ndo, "%02x", EXTRACT_8BITS(p)));
|
||||
p++;
|
||||
}
|
||||
name_size = len - (p - p0);
|
||||
ND_PRINT((ndo, ", Name "));
|
||||
|
Loading…
Reference in New Issue
Block a user