summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_mplsvpn.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index b55e8968b9..6a8df3b68e 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -1137,6 +1137,7 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,
struct bgp_path_info *new;
struct bgp_path_info_extra *extra;
struct bgp_labels bgp_labels = {};
+ struct bgp *bgp_nexthop;
bool labelssame;
uint8_t i;
@@ -1182,6 +1183,16 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,
labelssame = bgp_path_info_labels_same(bpi, bgp_labels.label,
bgp_labels.num_labels);
+ bgp_nexthop = bpi->extra->vrfleak->bgp_orig ?: bgp_orig;
+ if (bgp_nexthop->vrf_id == VRF_UNKNOWN) {
+ if (debug) {
+ zlog_debug("%s: ->%s(s_flags: 0x%x b_flags: 0x%x): %pFX: Found route, origin VRF does not exist, not leaking",
+ __func__, to_bgp->name_pretty, source_bpi->flags,
+ bpi->flags, p);
+ }
+ return NULL;
+ }
+
if (CHECK_FLAG(source_bpi->flags, BGP_PATH_REMOVED)
&& CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
if (debug) {
@@ -1284,6 +1295,14 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,
return NULL;
}
+ if (bgp_orig->vrf_id == VRF_UNKNOWN) {
+ if (debug) {
+ zlog_debug("%s: ->%s(s_flags: 0x%x): %pFX: New route, origin VRF does not exist, not leaking",
+ __func__, to_bgp->name_pretty, source_bpi->flags, p);
+ }
+ return NULL;
+ }
+
new = info_make(ZEBRA_ROUTE_BGP, BGP_ROUTE_IMPORTED, 0,
to_bgp->peer_self, new_attr, bn);