diff options
author | Francois Dumontet <francois.dumontet@6wind.com> | 2022-05-16 13:44:06 +0200 |
---|---|---|
committer | Francois Dumontet <francois.dumontet@6wind.com> | 2022-07-13 17:28:37 +0200 |
commit | 5dde29654e31189da06007ef4d6c6c7591e97275 (patch) | |
tree | 4b93bb7a95c31a70dfcba463a0716b346627e178 | |
parent | Merge pull request #11597 from opensourcerouting/pimd-packed-member (diff) | |
download | frr-5dde29654e31189da06007ef4d6c6c7591e97275.tar.xz frr-5dde29654e31189da06007ef4d6c6c7591e97275.zip |
bmp: add L3VPN support
Support for BMP L3VPN monitoring messages through SAFI_MPLS_VPN address
family.
Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
-rw-r--r-- | bgpd/bgp_bmp.c | 32 | ||||
-rw-r--r-- | doc/user/bmp.rst | 5 |
2 files changed, 27 insertions, 10 deletions
diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index ef985e08b..e7b936233 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -168,6 +168,16 @@ static int bmp_qhash_cmp(const struct bmp_queue_entry *a, else if (b->afi == AFI_L2VPN && b->safi == SAFI_EVPN) return -1; + if (a->afi == b->afi && a->safi == SAFI_MPLS_VPN && + b->safi == SAFI_MPLS_VPN) { + ret = prefix_cmp(&a->rd, &b->rd); + if (ret) + return ret; + } else if (a->safi == SAFI_MPLS_VPN) + return 1; + else if (b->safi == SAFI_MPLS_VPN) + return -1; + ret = prefix_cmp(&a->p, &b->p); if (ret) return ret; @@ -186,7 +196,8 @@ static uint32_t bmp_qhash_hkey(const struct bmp_queue_entry *e) offsetof(struct bmp_queue_entry, refcount) - offsetof(struct bmp_queue_entry, peerid), key); - if (e->afi == AFI_L2VPN && e->safi == SAFI_EVPN) + if ((e->afi == AFI_L2VPN && e->safi == SAFI_EVPN) || + (e->safi == SAFI_MPLS_VPN)) key = jhash(&e->rd, offsetof(struct bmp_queue_entry, rd) - offsetof(struct bmp_queue_entry, refcount) @@ -985,7 +996,8 @@ afibreak: struct bgp_path_info *bpi = NULL, *bpiter; struct bgp_adj_in *adjin = NULL, *adjiter; - if (afi == AFI_L2VPN && safi == SAFI_EVPN) { + if ((afi == AFI_L2VPN && safi == SAFI_EVPN) || + (safi == SAFI_MPLS_VPN)) { /* initialize syncrdpos to the first * mid-layer table entry */ @@ -1014,7 +1026,8 @@ afibreak: if (!bn) { bn = bgp_table_get_next(table, &bmp->syncpos); if (!bn) { - if (afi == AFI_L2VPN && safi == SAFI_EVPN) { + if ((afi == AFI_L2VPN && safi == SAFI_EVPN) || + (safi == SAFI_MPLS_VPN)) { /* reset bottom-layer pointer */ memset(&bmp->syncpos, 0, sizeof(bmp->syncpos)); @@ -1096,7 +1109,8 @@ afibreak: const struct prefix *bn_p = bgp_dest_get_prefix(bn); struct prefix_rd *prd = NULL; - if (afi == AFI_L2VPN && safi == SAFI_EVPN) + if (((afi == AFI_L2VPN) && (safi == SAFI_EVPN)) || + (safi == SAFI_MPLS_VPN)) prd = (struct prefix_rd *)bgp_dest_get_prefix(bmp->syncrdpos); if (bpi) @@ -1168,7 +1182,8 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr) 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) + if ((bqe->afi == AFI_L2VPN && bqe->safi == SAFI_EVPN) || + (bqe->safi == SAFI_MPLS_VPN)) prd = &bqe->rd; if (bmp->targets->afimon[afi][safi] & BMP_MON_POSTPOLICY) { @@ -1256,7 +1271,8 @@ static void bmp_process_one(struct bmp_targets *bt, struct bgp *bgp, afi_t afi, bqeref.afi = afi; bqeref.safi = safi; - if (afi == AFI_L2VPN && safi == SAFI_EVPN && bn->pdest) + if ((afi == AFI_L2VPN && safi == SAFI_EVPN && bn->pdest) || + (safi == SAFI_MPLS_VPN)) prefix_copy(&bqeref.rd, (struct prefix_rd *)bgp_dest_get_prefix(bn->pdest)); @@ -2195,12 +2211,12 @@ DEFPY(bmp_stats_cfg, DEFPY(bmp_monitor_cfg, bmp_monitor_cmd, - "[no] bmp monitor <ipv4|ipv6|l2vpn> <unicast|multicast|evpn> <pre-policy|post-policy>$policy", + "[no] bmp monitor <ipv4|ipv6|l2vpn> <unicast|multicast|evpn|vpn> <pre-policy|post-policy>$policy", NO_STR BMP_STR "Send BMP route monitoring messages\n" "Address Family\nAddress Family\nAddress Family\n" - "Address Family\nAddress Family\nAddress Family\n" + "Address Family\nAddress Family\nAddress Family\nAddress Family\n" "Send state before policy and filter processing\n" "Send state with policy and filters applied\n") { diff --git a/doc/user/bmp.rst b/doc/user/bmp.rst index 764584f89..1983995c1 100644 --- a/doc/user/bmp.rst +++ b/doc/user/bmp.rst @@ -149,8 +149,9 @@ associated with a particular ``bmp targets``: .. clicmd:: bmp monitor AFI SAFI <pre-policy|post-policy> Perform Route Monitoring for the specified AFI and SAFI. Only IPv4 and - IPv6 are currently valid for AFI, and only unicast and multicast are valid - for SAFI. Other AFI/SAFI combinations may be added in the future. + IPv6 are currently valid for AFI. SAFI valid values are currently + unicast, multicast, evpn and vpn. + Other AFI/SAFI combinations may be added in the future. All BGP neighbors are included in Route Monitoring. Options to select a subset of BGP sessions may be added in the future. |