mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-11-23 01:53:55 +08:00
Juniper: Use the ND_ICHECKMSG_U() macro for a length check
It displays the reason for the "invalid" case.
Before:
1 2015-05-19 13:34:16.720640 (invalid)
After:
1 2015-05-19 13:34:16.720640 [cookie length 10 > 8] (invalid)
This is a follow-up to 8c7221d39b
.
Add the poc test file from GitHub issue #783 (first packet).
Moreover:
Remove some extra blank lines.
This commit is contained in:
parent
6fa624334b
commit
07a730a6f5
@ -890,7 +890,6 @@ juniper_mlppp_if_print(netdissect_options *ndo,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DLT_JUNIPER_MFR
|
||||
void
|
||||
juniper_mfr_if_print(netdissect_options *ndo,
|
||||
@ -1272,12 +1271,10 @@ juniper_parse_header(netdissect_options *ndo,
|
||||
int tlv_value;
|
||||
const u_char *tptr;
|
||||
|
||||
|
||||
l2info->header_len = 0;
|
||||
l2info->cookie_len = 0;
|
||||
l2info->proto = 0;
|
||||
|
||||
|
||||
l2info->length = h->len;
|
||||
l2info->caplen = h->caplen;
|
||||
l2info->flags = GET_U_1(p + 3);
|
||||
@ -1429,7 +1426,6 @@ juniper_parse_header(netdissect_options *ndo,
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DLT_JUNIPER_MFR
|
||||
/* MFR child links don't carry cookies */
|
||||
if (l2info->pictype == DLT_JUNIPER_MFR &&
|
||||
@ -1447,10 +1443,7 @@ juniper_parse_header(netdissect_options *ndo,
|
||||
lp->s,
|
||||
l2info->cookie_len);
|
||||
|
||||
if (l2info->cookie_len > 8) {
|
||||
nd_print_invalid(ndo);
|
||||
return 0;
|
||||
}
|
||||
ND_ICHECKMSG_U("cookie length", l2info->cookie_len, >, 8);
|
||||
|
||||
if (l2info->cookie_len > 0) {
|
||||
ND_TCHECK_LEN(p, l2info->cookie_len);
|
||||
@ -1464,7 +1457,6 @@ juniper_parse_header(netdissect_options *ndo,
|
||||
|
||||
if (ndo->ndo_eflag) ND_PRINT(": "); /* print demarc b/w L2/L3*/
|
||||
|
||||
|
||||
l2info->proto = GET_BE_U_2(p + l2info->cookie_len);
|
||||
}
|
||||
p+=l2info->cookie_len;
|
||||
|
@ -984,3 +984,6 @@ bgp-ub bgp-ub.pcap bgp-ub.out -v
|
||||
|
||||
# AccECN tests
|
||||
accecn_handshake accecn_handshake.pcap accecn_handshake.out -v
|
||||
|
||||
# Juniper tests
|
||||
juniper_monitor_invalid_cookie_length juniper_monitor_invalid_cookie_length.pcap juniper_monitor_invalid_cookie_length.out
|
||||
|
1
tests/juniper_monitor_invalid_cookie_length.out
Normal file
1
tests/juniper_monitor_invalid_cookie_length.out
Normal file
@ -0,0 +1 @@
|
||||
1 2015-05-19 13:34:16.720640 [cookie length 10 > 8] (invalid)
|
BIN
tests/juniper_monitor_invalid_cookie_length.pcap
Normal file
BIN
tests/juniper_monitor_invalid_cookie_length.pcap
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user