summaryrefslogtreecommitdiff
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index b35cbeb21f..2fd747a113 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1773,12 +1773,10 @@ static void bgp_peer_remove_private_as(struct bgp *bgp, afi_t afi, safi_t safi,
static void bgp_peer_as_override(struct bgp *bgp, afi_t afi, safi_t safi,
struct peer *peer, struct attr *attr)
{
- if (peer->sort == BGP_PEER_EBGP
- && peer_af_flag_check(peer, afi, safi, PEER_FLAG_AS_OVERRIDE)) {
- if (aspath_single_asn_check(attr->aspath, peer->as))
- attr->aspath = aspath_replace_specific_asn(
- attr->aspath, peer->as, bgp->as);
- }
+ if (peer->sort == BGP_PEER_EBGP &&
+ peer_af_flag_check(peer, afi, safi, PEER_FLAG_AS_OVERRIDE))
+ attr->aspath = aspath_replace_specific_asn(attr->aspath,
+ peer->as, bgp->as);
}
void bgp_attr_add_llgr_community(struct attr *attr)
@@ -3204,7 +3202,7 @@ int bgp_best_path_select_defer(struct bgp *bgp, afi_t afi, safi_t safi)
thread_info = THREAD_ARG(t);
XFREE(MTYPE_TMP, thread_info);
- BGP_TIMER_OFF(bgp->gr_info[afi][safi].t_route_select);
+ THREAD_OFF(bgp->gr_info[afi][safi].t_route_select);
}
if (BGP_DEBUG(update, UPDATE_OUT)) {
@@ -3785,6 +3783,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
uint8_t pi_sub_type = 0;
bool force_evpn_import = false;
safi_t orig_safi = safi;
+ bool leak_success = true;
if (frrtrace_enabled(frr_bgp, process_update)) {
char pfxprint[PREFIX2STR_BUFFER];
@@ -4410,7 +4409,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
- vpn_leak_to_vrf_update(bgp, pi);
+ leak_success = vpn_leak_to_vrf_update(bgp, pi);
}
#ifdef ENABLE_BGP_VNC
@@ -4425,7 +4424,13 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
type, sub_type, NULL);
}
#endif
-
+ if ((safi == SAFI_MPLS_VPN) &&
+ !CHECK_FLAG(bgp->af_flags[afi][safi],
+ BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL) &&
+ !leak_success) {
+ bgp_unlink_nexthop(pi);
+ bgp_path_info_delete(dest, pi);
+ }
return 0;
} // End of implicit withdraw
@@ -4559,8 +4564,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
}
if ((SAFI_MPLS_VPN == safi)
&& (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT)) {
-
- vpn_leak_to_vrf_update(bgp, new);
+ leak_success = vpn_leak_to_vrf_update(bgp, new);
}
#ifdef ENABLE_BGP_VNC
if (SAFI_MPLS_VPN == safi) {
@@ -4574,6 +4578,13 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
sub_type, NULL);
}
#endif
+ if ((safi == SAFI_MPLS_VPN) &&
+ !CHECK_FLAG(bgp->af_flags[afi][safi],
+ BGP_VPNVX_RETAIN_ROUTE_TARGET_ALL) &&
+ !leak_success) {
+ bgp_unlink_nexthop(new);
+ bgp_path_info_delete(dest, new);
+ }
return 0;
@@ -4744,7 +4755,7 @@ void bgp_stop_announce_route_timer(struct peer_af *paf)
if (!paf->t_announce_route)
return;
- thread_cancel(&paf->t_announce_route);
+ THREAD_OFF(paf->t_announce_route);
}
/*
@@ -5042,7 +5053,7 @@ void bgp_soft_reconfig_table_task_cancel(const struct bgp *bgp,
list_delete(&ntable->soft_reconfig_peers);
bgp_soft_reconfig_table_flag(ntable, false);
- BGP_TIMER_OFF(ntable->soft_reconfig_thread);
+ THREAD_OFF(ntable->soft_reconfig_thread);
}
}
@@ -14189,9 +14200,9 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
IP_STR
BGP_STR
BGP_INSTANCE_HELP_STR
- "Address Family\n"
- "Address Family\n"
- "Address Family modifier\n"
+ BGP_AF_STR
+ BGP_AF_STR
+ BGP_AF_MODIFIER_STR
"Detailed information on TCP and BGP neighbor connections\n"
"Neighbor to display information about\n"
"Neighbor to display information about\n"
@@ -14377,7 +14388,7 @@ DEFUN (show_bgp_afi_vpn_rd_route,
SHOW_STR
BGP_STR
BGP_AFI_HELP_STR
- "Address Family modifier\n"
+ BGP_AF_MODIFIER_STR
"Display information for a route distinguisher\n"
"Route Distinguisher\n"
"All Route Distinguishers\n"