summaryrefslogtreecommitdiffhomepage
path: root/pkg/server
diff options
context:
space:
mode:
authorwanghonghao <wanghonghao@bytedance.com>2018-10-08 18:47:15 +0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-10-23 10:49:35 +0900
commit8fc094cf6d8c531a559418b49f46d49998f56d09 (patch)
tree221544c8972ca387f440f752e4d53d3f6471d1b8 /pkg/server
parent2bd4afc53dd1fabdbcd0f45421f31ef5cb53d741 (diff)
server: deal with mac mobility seqence number in path from api
Diffstat (limited to 'pkg/server')
-rw-r--r--pkg/server/server.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go
index 0e96c73c..4aba3b50 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -1780,7 +1780,12 @@ func (server *BgpServer) fixupApiPath(vrfId string, pathList []*table.Path) erro
// MAC Mobility Extended Community
paths := server.globalRib.GetBestPathList(table.GLOBAL_RIB_NAME, 0, []bgp.RouteFamily{bgp.RF_EVPN})
if m := getMacMobilityExtendedCommunity(r.ETag, r.MacAddress, paths); m != nil {
- path.SetExtCommunities([]bgp.ExtendedCommunityInterface{m}, false)
+ pm := getMacMobilityExtendedCommunity(r.ETag, r.MacAddress, []*table.Path{path})
+ if pm == nil {
+ path.SetExtCommunities([]bgp.ExtendedCommunityInterface{m}, false)
+ } else if pm != nil && pm.Sequence < m.Sequence {
+ return fmt.Errorf("Invalid MAC mobility sequence number")
+ }
}
case *bgp.EVPNEthernetSegmentRoute:
// RFC7432: BGP MPLS-Based Ethernet VPN