For example bird can check that the hold timer proposed by a peer is
at least 2 times greater than the local keepalive timer as in the
attached patch.


On Mon, Apr 11, 2022 at 1:12 PM Alexander Zubkov <gr...@qrator.net> wrote:
>
> Hi,
>
> Found interesting thing. If I set "keepalive time" for a BGP session,
> this values is not modified after the hold time negotiations and as a
> result I can get a BGP session with hold timer less than keepalive
> timer and it will die due to hold timer expired after some time.
> https://gitlab.nic.cz/labs/bird/-/blob/692055e3df6cc9f0d428d3b0dd8cdd8e825eb6f4/proto/bgp/packets.c#L908
> I think more correct bahivour would be to close the BGP session with
> unacceptable hold timer error in such case.
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -820,7 +820,7 @@ bgp_rx_open(struct bgp_conn *conn, byte *pkt, uint len)
   if (bgp_read_options(conn, pkt+29, pkt[28], len-29) < 0)
     return;
 
-  if (hold > 0 && hold < 3)
+  if (hold > 0 && hold < 3 || p->cf->keepalive_time * 2 > hold)
   { bgp_error(conn, 2, 6, pkt+22, 2); return; }
 
   /* RFC 6286 2.2 - router ID is nonzero and AS-wide unique */

Reply via email to