summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2021-11-05 22:31:29 +0100
committerGitHub <noreply@github.com>2021-11-05 22:31:29 +0100
commit208a07a8b8bb2531946b6d5f05cc13b5730f58dd (patch)
tree23aab172b7d61bac255b518eafaa5815119a7502 /bgpd
parentMerge pull request #9974 from donaldsharp/ldp_vpls_topo1_wait (diff)
parentbgpd: update BFD config on update-source change (diff)
downloadfrr-208a07a8b8bb2531946b6d5f05cc13b5730f58dd.tar.xz
frr-208a07a8b8bb2531946b6d5f05cc13b5730f58dd.zip
Merge pull request #9972 from opensourcerouting/bfd-bgp-fixes
bfdd,bgpd: fix some integration bugs
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_bfd.c34
-rw-r--r--bgpd/bgpd.c40
2 files changed, 58 insertions, 16 deletions
diff --git a/bgpd/bgp_bfd.c b/bgpd/bgp_bfd.c
index 4995f9a1f..f23e6b2e9 100644
--- a/bgpd/bgp_bfd.c
+++ b/bgpd/bgp_bfd.c
@@ -150,6 +150,7 @@ 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;
bool changed = false;
int family;
union {
@@ -161,44 +162,45 @@ void bgp_peer_bfd_update_source(struct peer *p)
if (CHECK_FLAG(p->sflags, PEER_STATUS_GROUP))
return;
+ /* Figure out the correct source to use. */
+ if (CHECK_FLAG(p->flags, PEER_FLAG_UPDATE_SOURCE))
+ source = p->update_source;
+ else
+ source = p->su_local;
+
/* Update peer's source/destination addresses. */
bfd_sess_addresses(session, &family, &src.v6, &dst.v6);
if (family == AF_INET) {
- if ((p->su_local
- && p->su_local->sin.sin_addr.s_addr != src.v4.s_addr)
+ if ((source && source->sin.sin_addr.s_addr != src.v4.s_addr)
|| p->su.sin.sin_addr.s_addr != dst.v4.s_addr) {
if (BGP_DEBUG(bfd, BFD_LIB))
zlog_debug(
"%s: address [%pI4->%pI4] to [%pI4->%pI4]",
__func__, &src.v4, &dst.v4,
- p->su_local ? &p->su_local->sin.sin_addr
- : &src.v4,
+ source ? &source->sin.sin_addr
+ : &src.v4,
&p->su.sin.sin_addr);
bfd_sess_set_ipv4_addrs(
- session,
- p->su_local ? &p->su_local->sin.sin_addr : NULL,
+ session, source ? &source->sin.sin_addr : NULL,
&p->su.sin.sin_addr);
changed = true;
}
} else {
- if ((p->su_local
- && memcmp(&p->su_local->sin6, &src.v6, sizeof(src.v6)))
+ if ((source && memcmp(&source->sin6, &src.v6, sizeof(src.v6)))
|| memcmp(&p->su.sin6, &dst.v6, sizeof(dst.v6))) {
if (BGP_DEBUG(bfd, BFD_LIB))
zlog_debug(
"%s: address [%pI6->%pI6] to [%pI6->%pI6]",
__func__, &src.v6, &dst.v6,
- p->su_local
- ? &p->su_local->sin6.sin6_addr
- : &src.v6,
+ source ? &source->sin6.sin6_addr
+ : &src.v6,
&p->su.sin6.sin6_addr);
- bfd_sess_set_ipv6_addrs(
- session,
- p->su_local ? &p->su_local->sin6.sin6_addr
- : NULL,
- &p->su.sin6.sin6_addr);
+ bfd_sess_set_ipv6_addrs(session,
+ source ? &source->sin6.sin6_addr
+ : NULL,
+ &p->su.sin6.sin6_addr);
changed = true;
}
}
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index ff2c0c8bd..9316d71ba 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -4753,6 +4753,10 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
+
+ /* Reconfigure BFD peer with new TTL. */
+ if (peer->bfd_config)
+ bgp_peer_bfd_update_source(peer);
}
} else {
group = peer->group;
@@ -4767,6 +4771,10 @@ int peer_ebgp_multihop_set(struct peer *peer, int ttl)
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
+
+ /* Reconfigure BFD peer with new TTL. */
+ if (peer->bfd_config)
+ bgp_peer_bfd_update_source(peer);
}
}
return 0;
@@ -4800,6 +4808,10 @@ int peer_ebgp_multihop_unset(struct peer *peer)
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
else
bgp_session_reset(peer);
+
+ /* Reconfigure BFD peer with new TTL. */
+ if (peer->bfd_config)
+ bgp_peer_bfd_update_source(peer);
} else {
group = peer->group;
for (ALL_LIST_ELEMENTS(group->peer, node, nnode, peer)) {
@@ -4816,6 +4828,10 @@ int peer_ebgp_multihop_unset(struct peer *peer)
else
bgp_session_reset(peer);
}
+
+ /* Reconfigure BFD peer with new TTL. */
+ if (peer->bfd_config)
+ bgp_peer_bfd_update_source(peer);
}
}
return 0;
@@ -4861,6 +4877,10 @@ int peer_update_source_if_set(struct peer *peer, const char *ifname)
} else
bgp_session_reset(peer);
+ /* Apply new source configuration to BFD session. */
+ if (peer->bfd_config)
+ bgp_peer_bfd_update_source(peer);
+
/* Skip peer-group mechanics for regular peers. */
return 0;
}
@@ -4894,6 +4914,10 @@ int peer_update_source_if_set(struct peer *peer, const char *ifname)
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(member);
+
+ /* Apply new source configuration to BFD session. */
+ if (member->bfd_config)
+ bgp_peer_bfd_update_source(member);
}
return 0;
@@ -4924,6 +4948,10 @@ int peer_update_source_addr_set(struct peer *peer, const union sockunion *su)
} else
bgp_session_reset(peer);
+ /* Apply new source configuration to BFD session. */
+ if (peer->bfd_config)
+ bgp_peer_bfd_update_source(peer);
+
/* Skip peer-group mechanics for regular peers. */
return 0;
}
@@ -4956,6 +4984,10 @@ int peer_update_source_addr_set(struct peer *peer, const union sockunion *su)
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(member);
+
+ /* Apply new source configuration to BFD session. */
+ if (member->bfd_config)
+ bgp_peer_bfd_update_source(member);
}
return 0;
@@ -4993,6 +5025,10 @@ int peer_update_source_unset(struct peer *peer)
} else
bgp_session_reset(peer);
+ /* Apply new source configuration to BFD session. */
+ if (peer->bfd_config)
+ bgp_peer_bfd_update_source(peer);
+
/* Skip peer-group mechanics for regular peers. */
return 0;
}
@@ -5024,6 +5060,10 @@ int peer_update_source_unset(struct peer *peer)
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
} else
bgp_session_reset(member);
+
+ /* Apply new source configuration to BFD session. */
+ if (member->bfd_config)
+ bgp_peer_bfd_update_source(member);
}
return 0;