]> The Tcpdump Group git mirrors - tcpdump/commitdiff
bgp: Shutdown message can be up to 255 bytes length according to rfc9003
authorDonatas Abraitis <[email protected]>
Wed, 2 Feb 2022 12:28:21 +0000 (14:28 +0200)
committerGuy Harris <[email protected]>
Sun, 17 Jul 2022 05:37:39 +0000 (22:37 -0700)
Signed-off-by: Donatas Abraitis <[email protected]>
(cherry picked from commit 58f86cd1ac5e194a36627e6289733dadd3fea566)

print-bgp.c
tests/TESTLIST
tests/bgp-extended-shutdown-msg.out [new file with mode: 0644]
tests/bgp-extended-shutdown-msg.pcap [new file with mode: 0644]

index 26798af67ff8e32887c54586f7dc3f19cc9bd1e7..e3cde53d596565975993a1d8dcd3f765ef28573a 100644 (file)
@@ -268,7 +268,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"},
@@ -2988,8 +2987,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) {
index 9da69fa4583c1c1bf8fabcd0069141700cb98497..40ea8a9c6c71df16daa44755e422e81b6fbb6371 100644 (file)
@@ -35,6 +35,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
 
 # Broadcom tag tests
diff --git a/tests/bgp-extended-shutdown-msg.out b/tests/bgp-extended-shutdown-msg.out
new file mode 100644 (file)
index 0000000..709a467
--- /dev/null
@@ -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 (file)
index 0000000..dff19cf
Binary files /dev/null and b/tests/bgp-extended-shutdown-msg.pcap differ