summaryrefslogtreecommitdiff
path: root/bgpd/bgp_mplsvpn.h
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2022-07-01 14:50:40 +0200
committerPhilippe Guibert <philippe.guibert@6wind.com>2022-07-18 08:57:19 +0200
commita486300b2679ff80a13d800ed76e1236edfcaa2b (patch)
tree86d6b6c5483616c5a10a95191f20f17c9a745bb4 /bgpd/bgp_mplsvpn.h
parent1004137bf3ac8c71fdddba6c1a4dc1f37646ac40 (diff)
bgpd: implement retain route-target all behaviour
A new command is available under SAFI_MPLS_VPN: With this command, the BGP vpnvx prefixes received are not kept, if there are no VRF interested in importing those vpn entries. A soft refresh is performed if there is a change of configuration: retain cmd, vrf import settings, or route-map change. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_mplsvpn.h')
-rw-r--r--bgpd/bgp_mplsvpn.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h
index fcabb16435..8b081807df 100644
--- a/bgpd/bgp_mplsvpn.h
+++ b/bgpd/bgp_mplsvpn.h
@@ -25,6 +25,7 @@
#include "bgpd/bgp_route.h"
#include "bgpd/bgp_rd.h"
#include "bgpd/bgp_zebra.h"
+#include "bgpd/bgp_vty.h"
#define MPLS_LABEL_IS_SPECIAL(label) ((label) <= MPLS_LABEL_EXTENSION)
#define MPLS_LABEL_IS_NULL(label) \
@@ -70,7 +71,7 @@ extern void vpn_leak_to_vrf_withdraw_all(struct bgp *to_bgp, afi_t afi);
extern void vpn_leak_to_vrf_update_all(struct bgp *to_bgp, struct bgp *from_bgp,
afi_t afi);
-extern void vpn_leak_to_vrf_update(struct bgp *from_bgp,
+extern bool vpn_leak_to_vrf_update(struct bgp *from_bgp,
struct bgp_path_info *path_vpn);
extern void vpn_leak_to_vrf_withdraw(struct bgp *from_bgp,
@@ -233,8 +234,14 @@ static inline void vpn_leak_postchange(enum vpn_policy_direction direction,
if (!bgp_vpn)
return;
- if (direction == BGP_VPN_POLICY_DIR_FROMVPN)
- vpn_leak_to_vrf_update_all(bgp_vrf, bgp_vpn, afi);
+ if (direction == BGP_VPN_POLICY_DIR_FROMVPN) {
+ /* trigger a flush to re-sync with ADJ-RIB-in */
+ if (!CHECK_FLAG(bgp_vpn->af_flags[afi][SAFI_MPLS_VPN],
+ BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL))
+ bgp_clear_soft_in(bgp_vpn, afi, SAFI_MPLS_VPN);
+ else
+ vpn_leak_to_vrf_update_all(bgp_vrf, bgp_vpn, afi);
+ }
if (direction == BGP_VPN_POLICY_DIR_TOVPN) {
if (bgp_vrf->vpn_policy[afi].tovpn_label !=