diff options
author | Pat Ruddy <pat@voltanet.io> | 2020-09-18 11:20:43 +0200 |
---|---|---|
committer | Pat Ruddy <pat@voltanet.io> | 2021-02-02 10:37:05 +0100 |
commit | 2fceba1fa7dea4e5ca628273a5ab01e2abf32b2c (patch) | |
tree | 8adc4b00238ac6436a527bbfa1e3768dc7600210 /bgpd/bgp_mplsvpn.h | |
parent | bgpd: add utility to check if a vrf is active (diff) | |
download | frr-2fceba1fa7dea4e5ca628273a5ab01e2abf32b2c.tar.xz frr-2fceba1fa7dea4e5ca628273a5ab01e2abf32b2c.zip |
bgpd: add utility to check if a vrf is MPLS VPN
If a vrf is exporting to a vpn table and/or importing to a vpn
table then it is assumed t be a MPLS VPN vrf.
Signed-off-by: Pat Ruddy <pat@voltanet.io>
Diffstat (limited to 'bgpd/bgp_mplsvpn.h')
-rw-r--r-- | bgpd/bgp_mplsvpn.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index df2544d60..91a073d5d 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -83,6 +83,21 @@ extern void vrf_import_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, void vrf_unimport_from_vrf(struct bgp *to_bgp, struct bgp *from_bgp, afi_t afi, safi_t safi); +static inline bool is_bgp_vrf_mplsvpn(struct bgp *bgp) +{ + afi_t afi; + + if (bgp->inst_type == BGP_INSTANCE_TYPE_VRF) + for (afi = 0; afi < AFI_MAX; ++afi) { + if (CHECK_FLAG(bgp->af_flags[afi][SAFI_UNICAST], + BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT) + || CHECK_FLAG(bgp->af_flags[afi][SAFI_UNICAST], + BGP_CONFIG_MPLSVPN_TO_VRF_IMPORT)) + return true; + } + return false; +} + static inline int vpn_leak_to_vpn_active(struct bgp *bgp_vrf, afi_t afi, const char **pmsg) { |