From e7e1561fbbf0d22a98677f34dd1f8a20fd6d42b5 Mon Sep 17 00:00:00 2001 From: mxyns Date: Tue, 26 Jul 2022 18:38:08 +0200 Subject: [PATCH] bgpd: fixed bmp vpnv4 monitoring are withdraws instead of updates fixes the recent support bmp monitor of VPNv4 afi/safi the bmp updates messages (MP_REACH_NLRI) are never sent for VPNv4 and bmp withdraws (MP_UNREACH_NRLI) are sent instead this is caused by bgp_node_lookup which fails to find VPNv4 bgp_node in the rib which results in NULL path info attributes passed to bmp_monitor using bgp_afi_node_lookup instead of bgp_node_lookup solves the problem Signed-off-by: Maxence Younsi --- bgpd/bgp_bmp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index e7b936233e..2b6e1c8ad3 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -1180,11 +1180,13 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr) if (!peer_established(peer)) goto out; - bn = bgp_node_lookup(bmp->targets->bgp->rib[afi][safi], &bqe->p); - struct prefix_rd *prd = NULL; - if ((bqe->afi == AFI_L2VPN && bqe->safi == SAFI_EVPN) || - (bqe->safi == SAFI_MPLS_VPN)) - prd = &bqe->rd; + bool is_vpn = (bqe->afi == AFI_L2VPN && bqe->safi == SAFI_EVPN) || + (bqe->safi == SAFI_MPLS_VPN); + + struct prefix_rd *prd = is_vpn ? &bqe->rd : NULL; + bn = bgp_afi_node_lookup(bmp->targets->bgp->rib[afi][safi], afi, safi, + &bqe->p, prd); + if (bmp->targets->afimon[afi][safi] & BMP_MON_POSTPOLICY) { struct bgp_path_info *bpi;