From 8fc094cf6d8c531a559418b49f46d49998f56d09 Mon Sep 17 00:00:00 2001 From: wanghonghao Date: Mon, 8 Oct 2018 18:47:15 +0800 Subject: server: deal with mac mobility seqence number in path from api --- pkg/server/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3