From 95002ded3edc5694c7826558ed40b9dd0188c78c Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 2 Aug 2023 21:15:02 -0400 Subject: [PATCH] bgpd: Do not allow a peer to come up on v6 if we have no ability to route Modify bgp to not allow a v6 peer to come up if the v6 afi is negotiated and the outgoing interface has no v6 address as well as zebra does not support the v6 with v4 nexthop capabilities that some dataplanes allow. Signed-off-by: Donald Sharp --- bgpd/bgp_packet.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 2d1fc103bc..3e3e1b9431 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1735,11 +1735,14 @@ static int bgp_open_receive(struct peer *peer, bgp_size_t size) || peer->afc_nego[AFI_IP6][SAFI_MULTICAST] || peer->afc_nego[AFI_IP6][SAFI_MPLS_VPN] || peer->afc_nego[AFI_IP6][SAFI_ENCAP]) { - if (IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_global)) { -#if defined(HAVE_CUMULUS) - zlog_warn("%s: No local IPv6 address, BGP routing may not work", - peer->host); -#endif + if (IN6_IS_ADDR_UNSPECIFIED(&peer->nexthop.v6_global) && + !bm->v6_with_v4_nexthops) { + flog_err(EC_BGP_SND_FAIL, +"%s: No local IPv6 address, and zebra does not support V6 routing with v4 nexthops, BGP routing for V6 will not work", + peer->host); + bgp_notify_send(peer, BGP_NOTIFY_CEASE, + BGP_NOTIFY_SUBCODE_UNSPECIFIC); + return BGP_Stop; } } peer->rtt = sockopt_tcp_rtt(peer->fd);