]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Send End-of-RIB not only if Graceful Restart capability is received
authorDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 31 May 2024 12:03:55 +0000 (15:03 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Fri, 31 May 2024 12:03:55 +0000 (15:03 +0300)
Before we checked for received Graceful Restart capability, but that was also
incorrect, because we SHOULD HAVE checked it per AFI/SAFI instead.

https://datatracker.ietf.org/doc/html/rfc4724 says:

Although the End-of-RIB marker is specified for the purpose of BGP
   graceful restart, it is noted that the generation of such a marker
   upon completion of the initial update would be useful for routing
   convergence in general, and thus the practice is recommended.

Thus, it might be reasonable to send EoR regardless of whether the Graceful Restart
capability is received or not from the peer.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_packet.c

index 86f85dd86662aecf985a50d70e469a339f852e2b..3f38790cbda3077170ab33666f6cc24ae91f9f54 100644 (file)
@@ -560,40 +560,37 @@ void bgp_generate_updgrp_packets(struct event *thread)
                                        }
                                }
 
-                               if (CHECK_FLAG(peer->cap,
-                                              PEER_CAP_RESTART_RCV)) {
-                                       if (!(PAF_SUBGRP(paf))->t_coalesce
-                                           && peer->afc_nego[afi][safi]
-                                           && peer->synctime
-                                           && !CHECK_FLAG(
-                                                   peer->af_sflags[afi][safi],
-                                                   PEER_STATUS_EOR_SEND)) {
-                                               /* If EOR is disabled,
-                                                * the message is  not sent
-                                                */
-                                               if (BGP_SEND_EOR(peer->bgp, afi,
-                                                                safi)) {
-                                                       SET_FLAG(
-                                                               peer->af_sflags
-                                                                       [afi]
-                                                                       [safi],
-                                                               PEER_STATUS_EOR_SEND);
-
-                                                       /* Update EOR
-                                                        * send time
-                                                        */
-                                                       peer->eor_stime[afi]
-                                                                      [safi] =
-                                                               monotime(NULL);
-
-                                                       BGP_UPDATE_EOR_PKT(
-                                                               peer, afi, safi,
-                                                               s);
-                                                       bgp_process_pending_refresh(
-                                                               peer, afi,
-                                                               safi);
-                                               }
-                                       }
+                               /* rfc4724 says:
+                                *   Although the End-of-RIB marker is
+                                *   specified for the purpose of BGP
+                                *   graceful restart, it is noted that
+                                *   the generation of such a marker upon
+                                *   completion of the initial update would
+                                *   be useful for routing convergence in
+                                *   general, and thus the practice is
+                                *   recommended.
+                                */
+                               if (!(PAF_SUBGRP(paf))->t_coalesce &&
+                                   peer->afc_nego[afi][safi] &&
+                                   peer->synctime &&
+                                   !CHECK_FLAG(peer->af_sflags[afi][safi],
+                                               PEER_STATUS_EOR_SEND)) {
+                                       /* If EOR is disabled, the message is
+                                        * not sent.
+                                        */
+                                       if (!BGP_SEND_EOR(peer->bgp, afi, safi))
+                                               continue;
+
+                                       SET_FLAG(peer->af_sflags[afi][safi],
+                                                PEER_STATUS_EOR_SEND);
+
+                                       /* Update EOR send time */
+                                       peer->eor_stime[afi][safi] =
+                                               monotime(NULL);
+
+                                       BGP_UPDATE_EOR_PKT(peer, afi, safi, s);
+                                       bgp_process_pending_refresh(peer, afi,
+                                                                   safi);
                                }
                                continue;
                        }