summaryrefslogtreecommitdiffhomepage
path: root/server/peer.go
diff options
context:
space:
mode:
Diffstat (limited to 'server/peer.go')
-rw-r--r--server/peer.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/server/peer.go b/server/peer.go
index e9d0fe3e..ffbce86b 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -229,6 +229,22 @@ func (peer *Peer) filterpath(path *table.Path, withdrawals []*table.Path) *table
}
}
}
+
+ // only allow vpnv4 and vpnv6 paths to be advertised to VRFed neighbors.
+ // also check we can import this path using table.CanImportToVrf()
+ // if we can, make it local path by calling (*Path).ToLocal()
+ if path != nil && peer.fsm.pConf.Config.Vrf != "" {
+ if f := path.GetRouteFamily(); f != bgp.RF_IPv4_VPN && f != bgp.RF_IPv6_VPN {
+ return nil
+ }
+ vrf := peer.localRib.Vrfs[peer.fsm.pConf.Config.Vrf]
+ if table.CanImportToVrf(vrf, path) {
+ path = path.ToLocal()
+ } else {
+ return nil
+ }
+ }
+
if path = filterpath(peer, path, withdrawals); path == nil {
return nil
}