summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorPdoijode <pdoijode@nvidia.com>2022-09-29 15:28:38 -0700
committerMergify <37929162+mergify[bot]@users.noreply.github.com>2022-10-06 07:05:58 +0000
commitf8841e1047e959ad3d721e7ab29396897b17f61a (patch)
treee51b6c094ebb7d561f4141a5f9eb84a2a012ea88 /bgpd
parentb023c47eab70a34664e8e1eeb97387a0ab57ff16 (diff)
bgpd: BGP does not update next-hop when global V6 address is configured
When primary global v6 unicast address is configured on an unnumbered interface, BGP does not re-advertise updates out with the new global v6 address as the nexthop Signed-off-by: Pdoijode <pdoijode@nvidia.com> (cherry picked from commit bc6d1b151f45f93ac0cad8fd36f49321eaf56dc1)
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_zebra.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 7dfb5046dd..57a859c61d 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -307,6 +307,11 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *ifc;
struct bgp *bgp;
+ struct peer *peer;
+ struct prefix *addr;
+ struct listnode *node, *nnode;
+ afi_t afi;
+ safi_t safi;
bgp = bgp_lookup_by_vrf_id(vrf_id);
@@ -332,6 +337,48 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS)
if (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)
&& !list_isempty(ifc->ifp->nbr_connected))
bgp_start_interface_nbrs(bgp, ifc->ifp);
+ else {
+ addr = ifc->address;
+
+ for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) {
+ if (addr->family == AF_INET)
+ continue;
+
+ /*
+ * If the Peer's interface name matches the
+ * interface name for which BGP received the
+ * update and if the received interface address
+ * is a globalV6 and if the peer is currently
+ * using a v4-mapped-v6 addr or a link local
+ * address, then copy the Rxed global v6 addr
+ * into peer's v6_global and send updates out
+ * with new nexthop addr.
+ */
+ if ((peer->conf_if &&
+ (strcmp(peer->conf_if, ifc->ifp->name) ==
+ 0)) &&
+ !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix6) &&
+ ((IS_MAPPED_IPV6(
+ &peer->nexthop.v6_global)) ||
+ IN6_IS_ADDR_LINKLOCAL(
+ &peer->nexthop.v6_global))) {
+
+ if (bgp_debug_zebra(ifc->address)) {
+ zlog_debug(
+ "Update peer %pBP's current intf addr %pI6 and send updates",
+ peer,
+ &peer->nexthop
+ .v6_global);
+ }
+ memcpy(&peer->nexthop.v6_global,
+ &addr->u.prefix6,
+ IPV6_MAX_BYTELEN);
+ FOREACH_AFI_SAFI (afi, safi)
+ bgp_announce_route(peer, afi,
+ safi, true);
+ }
+ }
+ }
}
return 0;