summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-05-11 23:29:14 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-05-11 23:31:49 +0900
commitc5fdcad5727dee2411b5e4ad33fd249d3100880d (patch)
tree4f8d91cdae7be54280f3f02425acaa90e568623c
parent40eadd4a8e682379e4e2554ac3ae5ef140c2ae81 (diff)
fix add-path with vrf-neighbor
close #1661 Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--server/server.go13
-rw-r--r--table/path.go6
2 files changed, 18 insertions, 1 deletions
diff --git a/server/server.go b/server/server.go
index 251ce7cb..df0306b4 100644
--- a/server/server.go
+++ b/server/server.go
@@ -976,7 +976,18 @@ func (server *BgpServer) propagateUpdateToNeighbors(source *Peer, newPath *table
if (source == nil && targetPeer.isRouteServerClient()) || (source != nil && source.isRouteServerClient() != targetPeer.isRouteServerClient()) {
continue
}
- if targetPeer.isAddPathSendEnabled(family) {
+ f := func() bgp.RouteFamily {
+ if targetPeer.fsm.pConf.Config.Vrf != "" {
+ switch family {
+ case bgp.RF_IPv4_VPN:
+ return bgp.RF_IPv4_UC
+ case bgp.RF_IPv6_VPN:
+ return bgp.RF_IPv6_UC
+ }
+ }
+ return family
+ }()
+ if targetPeer.isAddPathSendEnabled(f) {
bestList = []*table.Path{newPath}
oldList = nil
} else if targetPeer.isRouteServerClient() {
diff --git a/table/path.go b/table/path.go
index 2020b2f5..3e4fbff3 100644
--- a/table/path.go
+++ b/table/path.go
@@ -1144,13 +1144,16 @@ func (v *Vrf) ToGlobalPath(path *Path) error {
func (p *Path) ToGlobal(vrf *Vrf) *Path {
nlri := p.GetNlri()
nh := p.GetNexthop()
+ pathId := nlri.PathIdentifier()
switch rf := p.GetRouteFamily(); rf {
case bgp.RF_IPv4_UC:
n := nlri.(*bgp.IPAddrPrefix)
nlri = bgp.NewLabeledVPNIPAddrPrefix(n.Length, n.Prefix.String(), *bgp.NewMPLSLabelStack(0), vrf.Rd)
+ nlri.SetPathIdentifier(pathId)
case bgp.RF_IPv6_UC:
n := nlri.(*bgp.IPv6AddrPrefix)
nlri = bgp.NewLabeledVPNIPv6AddrPrefix(n.Length, n.Prefix.String(), *bgp.NewMPLSLabelStack(0), vrf.Rd)
+ nlri.SetPathIdentifier(pathId)
case bgp.RF_EVPN:
n := nlri.(*bgp.EVPNNLRI)
switch n.RouteType {
@@ -1191,17 +1194,20 @@ func (p *Path) ToGlobal(vrf *Vrf) *Path {
func (p *Path) ToLocal() *Path {
nlri := p.GetNlri()
f := p.GetRouteFamily()
+ pathId := nlri.PathLocalIdentifier()
switch f {
case bgp.RF_IPv4_VPN:
n := nlri.(*bgp.LabeledVPNIPAddrPrefix)
_, c, _ := net.ParseCIDR(n.IPPrefix())
ones, _ := c.Mask.Size()
nlri = bgp.NewIPAddrPrefix(uint8(ones), c.IP.String())
+ nlri.SetPathLocalIdentifier(pathId)
case bgp.RF_IPv6_VPN:
n := nlri.(*bgp.LabeledVPNIPv6AddrPrefix)
_, c, _ := net.ParseCIDR(n.IPPrefix())
ones, _ := c.Mask.Size()
nlri = bgp.NewIPv6AddrPrefix(uint8(ones), c.IP.String())
+ nlri.SetPathLocalIdentifier(pathId)
default:
return p
}