Re: [PATCH] BGP: Do not start connect retry timer if connect immediately succeeds

Maria Matejka maria.matejka at nic.cz
Fri Oct 17 16:57:45 CEST 2025


Hello Ze Xia,

this looks like a real bug, yet I'm not sure whether we happen to observe it in real world often. Please, do you have any instructions how to trigger it reliably so that we can add it to our CI?

Thanks,
Maria


On October 17, 2025 3:43:26 PM GMT+02:00, Ze Xia <billxia135 at gmail.com> wrote:
>BGP connect retry timer is unconditionally started in bgp_connect(),
>which will be stopped by bgp_send_open() in bgp_connected() with
>successful connection. However, if the sk_connect() in sk_open()
>immediately succeeds, this code path will be immediately called.
>This happens before the timer is even started, thus the timer will
>never be stopped again.
>
>Signed-off-by: Ze Xia <billxia135 at gmail.com>
>---
> proto/bgp/bgp.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c
>index ad51e626..6358afc6 100644
>--- a/proto/bgp/bgp.c
>+++ b/proto/bgp/bgp.c
>@@ -1628,8 +1628,10 @@ bgp_connect(struct bgp_proto *p)	/* Enter Connect state and start establishing c
>   s->ao_keys_num = 0;
>   s->ao_keys_init = NULL;
> 
>-  DBG("BGP: Waiting for connect success\n");
>-  bgp_start_timer(conn->connect_timer, p->cf->connect_retry_time);
>+  if (s->type == SK_TCP_ACTIVE) {
>+    DBG("BGP: Waiting for connect success\n");
>+    bgp_start_timer(p, conn->connect_timer, p->cf->connect_retry_time);
>+  }
>   return;
> 
> err:
>-- 
>2.45.2
>

-- 
Maria Matejka (she/her) | BIRD Team Leader | CZ.NIC, z.s.p.o.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20251017/42d3f5bc/attachment.htm>


More information about the Bird-users mailing list