]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
BGP: Fix crash when incoming connection for disabled protocol arrives
authorOndrej Zajicek <santiago@crfreenet.org>
Thu, 24 Apr 2025 01:01:19 +0000 (03:01 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Thu, 24 Apr 2025 01:01:19 +0000 (03:01 +0200)
The function bgp_find_proto() may return a protocol in DOWN state, but
ao.keys (as most protocol data) are only valid in non-DOWN state.

proto/bgp/bgp.c

index dcb76e05cd442eedfdb97e10c8f5e4b832d0e19f..f762e4a6299d02c11a85d2976c6598039b6674d8 100644 (file)
@@ -1702,7 +1702,7 @@ bgp_incoming_connection(sock *sk, uint dummy UNUSED)
     return 0;
   }
 
-  if (!EMPTY_LIST(p->ao.keys))
+  if ((p->p.proto_state != PS_DOWN) && !EMPTY_LIST(p->ao.keys))
   {
     int current = -1, rnext = -1;
     sk_get_active_ao_keys(sk, &current, &rnext);