summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/server.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/server/server.go b/server/server.go
index 2b32e1ce..0a39674d 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1344,27 +1344,29 @@ func (s *BgpServer) DeletePath(uuid []byte, f bgp.RouteFamily, vrfId string, pat
return s.mgmtOperation(func() error {
deletePathList := make([]*table.Path, 0)
if len(uuid) > 0 {
+ // Delete locally generated path which has the given UUID
path := func() *table.Path {
for _, path := range s.globalRib.GetPathList(table.GLOBAL_RIB_NAME, s.globalRib.GetRFlist()) {
- if len(path.UUID()) > 0 && bytes.Equal(path.UUID().Bytes(), uuid) {
+ if path.IsLocal() && len(path.UUID()) > 0 && bytes.Equal(path.UUID().Bytes(), uuid) {
return path
}
}
return nil
}()
- if path != nil {
- deletePathList = append(deletePathList, path.Clone(true))
- } else {
+ if path == nil {
return fmt.Errorf("Can't find a specified path")
}
+ deletePathList = append(deletePathList, path.Clone(true))
} else if len(pathList) == 0 {
- // delete all paths
+ // Delete all locally generated paths
families := s.globalRib.GetRFlist()
if f != 0 {
families = []bgp.RouteFamily{f}
}
for _, path := range s.globalRib.GetPathList(table.GLOBAL_RIB_NAME, families) {
- deletePathList = append(deletePathList, path.Clone(true))
+ if path.IsLocal() {
+ deletePathList = append(deletePathList, path.Clone(true))
+ }
}
} else {
if err := s.fixupApiPath(vrfId, pathList); err != nil {