]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: fix shutdown crash when dynamic peer is just connected
authorMaria Matejka <mq@ucw.cz>
Mon, 13 Jan 2025 21:15:52 +0000 (22:15 +0100)
committerMaria Matejka <mq@ucw.cz>
Mon, 13 Jan 2025 21:15:52 +0000 (22:15 +0100)
In some edge cases, the dynamic BGP starts but doesn't yet pick up
the socket from the peer, when it gets shut down, typically on
a complete shutdown. Fixing this to just close the socket, not assert
it being already picked up.

proto/bgp/bgp.c

index 3170e3a42fab9856846f04f8f6664b04e89e5fa7..859f7bc167712d67c0c9fd156fe93f63f580a8a0 100644 (file)
@@ -581,8 +581,10 @@ bgp_graceful_close_conn(struct bgp_conn *conn, int subcode, byte *data, uint len
 static void
 bgp_down(struct bgp_proto *p)
 {
-  /* Check that the dynamic BGP socket has been picked up */
-  ASSERT_DIE(p->postponed_sk == NULL);
+  /* Close the possibly unpicked dynamic BGP socket */
+  if (p->postponed_sk)
+    sk_close(p->postponed_sk);
+  p->postponed_sk = NULL;
 
   if (bgp_start_state(p) > BSS_PREPARE)
   {