]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fixed bmp vpnv4 monitoring are withdraws instead of updates 11691/head
authormxyns <mx.yns@outlook.fr>
Tue, 26 Jul 2022 16:38:08 +0000 (18:38 +0200)
committermxyns <mx.yns@outlook.fr>
Fri, 29 Jul 2022 18:07:21 +0000 (20:07 +0200)
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 <mx.yns@outlook.fr>
bgpd/bgp_bmp.c

index e7b936233e5379f7bbbcd3442dfe62476da86fbc..2b6e1c8ad3a43271b843b3ff3adcb6826758a844 100644 (file)
@@ -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;