summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/server/server.go')
-rw-r--r--pkg/server/server.go33
1 files changed, 23 insertions, 10 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go
index c5dd18f3..4fbb76ff 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -698,26 +698,39 @@ func clonePathList(pathList []*table.Path) []*table.Path {
return l
}
+func (s *BgpServer) setPathVrfIdMap(paths []*table.Path, m map[uint32]bool) {
+ for _, p := range paths {
+ switch p.GetRouteFamily() {
+ case bgp.RF_IPv4_VPN, bgp.RF_IPv6_VPN:
+ for _, vrf := range s.globalRib.Vrfs {
+ if vrf.Id != 0 && table.CanImportToVrf(vrf, p) {
+ m[uint32(vrf.Id)] = true
+ }
+ }
+ default:
+ m[zebra.VRF_DEFAULT] = true
+ }
+ }
+}
+
+// Note: the destination would be the same for all the paths passed here
+// The wather (only zapi) needs a unique list of vrf IDs
func (s *BgpServer) notifyBestWatcher(best []*table.Path, multipath [][]*table.Path) {
if table.SelectionOptions.DisableBestPathSelection {
// Note: If best path selection disabled, no best path to notify.
return
}
+ m := make(map[uint32]bool)
clonedM := make([][]*table.Path, len(multipath))
for i, pathList := range multipath {
clonedM[i] = clonePathList(pathList)
+ if table.UseMultiplePaths.Enabled {
+ s.setPathVrfIdMap(clonedM[i], m)
+ }
}
clonedB := clonePathList(best)
- m := make(map[uint32]bool)
- for _, p := range clonedB {
- switch p.GetRouteFamily() {
- case bgp.RF_IPv4_VPN, bgp.RF_IPv6_VPN:
- for _, vrf := range s.globalRib.Vrfs {
- if vrf.Id != 0 && table.CanImportToVrf(vrf, p) {
- m[uint32(vrf.Id)] = true
- }
- }
- }
+ if !table.UseMultiplePaths.Enabled {
+ s.setPathVrfIdMap(clonedB, m)
}
w := &watchEventBestPath{PathList: clonedB, MultiPathList: clonedM}
if len(m) > 0 {