From: Donatas Abraitis Date: Wed, 2 Feb 2022 12:28:21 +0000 (+0200) Subject: bgp: Shutdown message can be up to 255 bytes length according to rfc9003 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/58f86cd1ac5e194a36627e6289733dadd3fea566 bgp: Shutdown message can be up to 255 bytes length according to rfc9003 Signed-off-by: Donatas Abraitis --- diff --git a/print-bgp.c b/print-bgp.c index b580646f..f5c3dfad 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -278,7 +278,6 @@ static const struct tok bgp_notify_major_values[] = { /* draft-ietf-idr-shutdown-07 */ #define BGP_NOTIFY_MINOR_CEASE_SHUT 2 #define BGP_NOTIFY_MINOR_CEASE_RESET 4 -#define BGP_NOTIFY_MINOR_CEASE_ADMIN_SHUTDOWN_LEN 128 static const struct tok bgp_notify_minor_cease_values[] = { { BGP_NOTIFY_MINOR_CEASE_MAXPRFX, "Maximum Number of Prefixes Reached"}, { BGP_NOTIFY_MINOR_CEASE_SHUT, "Administrative Shutdown"}, @@ -3017,8 +3016,7 @@ bgp_notification_print(netdissect_options *ndo, shutdown_comm_length = GET_U_1(tptr); remainder_offset = 0; /* garbage, hexdump it all */ - if (shutdown_comm_length > BGP_NOTIFY_MINOR_CEASE_ADMIN_SHUTDOWN_LEN || - shutdown_comm_length > length - (BGP_NOTIFICATION_SIZE + 1)) { + if (shutdown_comm_length > length - (BGP_NOTIFICATION_SIZE + 1)) { ND_PRINT(", invalid Shutdown Communication length"); } else if (shutdown_comm_length == 0) { diff --git a/tests/TESTLIST b/tests/TESTLIST index 540f5122..91fedcd4 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -59,6 +59,7 @@ bgp-evpn bgp-evpn.pcap bgp-evpn.out -v bgp-llgr bgp-evpn.pcap bgp-llgr.out -v bgp-encap bgp-encap.pcap bgp-encap.out -v bgp-rt-prefix bgp-rt-prefix.pcap bgp-rt-prefix.out -v +bgp-extended-shutdown-msg bgp-extended-shutdown-msg.pcap bgp-extended-shutdown-msg.out -v bgp-link-bw-extcommunity bgp-link-bw-extcommunity.pcapng bgp-link-bw-extcommunity.out -v bgp-extended-msg bgp-extended-msg.pcapng bgp-extended-msg.out -v bgp-enhanced-route-refresh bgp-enhanced-route-refresh.pcapng bgp-enhanced-route-refresh.out -v diff --git a/tests/bgp-extended-shutdown-msg.out b/tests/bgp-extended-shutdown-msg.out new file mode 100644 index 00000000..709a467d --- /dev/null +++ b/tests/bgp-extended-shutdown-msg.out @@ -0,0 +1,3 @@ + 1 08:40:34.846110 IP (tos 0xc0, ttl 1, id 27458, offset 0, flags [DF], proto TCP (6), length 284) + 192.168.10.123.36208 > 192.168.10.17.179: Flags [P.], cksum 0x415a (correct), seq 496762307:496762539, ack 691810051, win 502, options [nop,nop,TS val 822562185 ecr 4289027422], length 232: BGP + Notification Message (3), length: 232, Cease (6), subcode Administrative Shutdown (2), Shutdown Communication (length: 210): "[TICKET-1-1438367390] software upgrade; Expected downtime for 2 hours;[TICKET-1-1438367390] software upgrade; Expected downtime for 2 hours;[TICKET-1-1438367390] software upgrade; Expected downtime for 2 hours;" diff --git a/tests/bgp-extended-shutdown-msg.pcap b/tests/bgp-extended-shutdown-msg.pcap new file mode 100644 index 00000000..dff19cf2 Binary files /dev/null and b/tests/bgp-extended-shutdown-msg.pcap differ