summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2024-11-20 16:07:34 -0500
committerDonatas Abraitis <donatas@opensourcerouting.org>2025-02-13 20:44:18 +0200
commitd6c8c23635873ca26cd6837d2a8e0ad360a734c6 (patch)
tree66bc825be2d2ce4ff15f5290a375eace0a9cee5f /bgpd
parent5eb7047e2798e56c89c650434d3c6e7dc7533328 (diff)
bgpd: Allow bfd to work if peer known but interface address not yet
If bgp is coming up and bgp has not received the interface address yet but bgp has knowledge about a bfd peering, allow it to set the peering data appropriately. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_bfd.c8
-rw-r--r--bgpd/bgp_nexthop.c28
2 files changed, 23 insertions, 13 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 3a1459b8a5..b3221853bb 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -151,8 +151,8 @@ void bgp_peer_config_apply(struct peer *p, struct peer_group *pg)
void bgp_peer_bfd_update_source(struct peer *p)
{
- struct bfd_session_params *session = p->bfd_config->session;
- const union sockunion *source;
+ struct bfd_session_params *session;
+ const union sockunion *source = NULL;
bool changed = false;
int family;
union {
@@ -162,6 +162,10 @@ void bgp_peer_bfd_update_source(struct peer *p)
struct interface *ifp;
union sockunion addr;
+ if (!p->bfd_config)
+ return;
+
+ session = p->bfd_config->session;
/* Nothing to do for groups. */
if (CHECK_FLAG(p->sflags, PEER_STATUS_GROUP))
return;
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index d12dc22330..508b3528c4 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -32,6 +32,7 @@
#include "bgpd/bgp_vty.h"
#include "bgpd/bgp_rd.h"
#include "bgpd/bgp_mplsvpn.h"
+#include "bgpd/bgp_bfd.h"
DEFINE_MTYPE_STATIC(BGPD, MARTIAN_STRING, "BGP Martian Addr Intf String");
@@ -409,17 +410,6 @@ void bgp_connected_add(struct bgp *bgp, struct connected *ifc)
bgp_dest_set_bgp_connected_ref_info(dest, bc);
}
- for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
- if (peer->conf_if &&
- (strcmp(peer->conf_if, ifc->ifp->name) == 0) &&
- !peer_established(peer->connection) &&
- !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) {
- connection = peer->connection;
- if (peer_active(peer))
- BGP_EVENT_ADD(connection, BGP_Stop);
- BGP_EVENT_ADD(connection, BGP_Start);
- }
- }
} else if (addr->family == AF_INET6) {
apply_mask_ipv6((struct prefix_ipv6 *)&p);
@@ -443,6 +433,22 @@ void bgp_connected_add(struct bgp *bgp, struct connected *ifc)
bgp_dest_set_bgp_connected_ref_info(dest, bc);
}
}
+
+ /*
+ * Iterate over all the peers and attempt to set the bfd session
+ * data and if it's a bgp unnumbered get her flowing if necessary
+ */
+ for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
+ bgp_peer_bfd_update_source(peer);
+ if (peer->conf_if && (strcmp(peer->conf_if, ifc->ifp->name) == 0) &&
+ !peer_established(peer->connection) &&
+ !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) {
+ connection = peer->connection;
+ if (peer_active(peer))
+ BGP_EVENT_ADD(connection, BGP_Stop);
+ BGP_EVENT_ADD(connection, BGP_Start);
+ }
+ }
}
void bgp_connected_delete(struct bgp *bgp, struct connected *ifc)