diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-04-13 19:50:41 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-05-07 21:18:04 +0900 |
commit | 8347c6c94c441e6a2ec4869890a8808208610273 (patch) | |
tree | 1308721425963e629492cddd8767e24e845f09ce /server/server.go | |
parent | 6110fad59441454c8a6f534874ae29b770098b73 (diff) |
table: remove VrfIds member in Path structure
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r-- | server/server.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/server/server.go b/server/server.go index 51346da9..d533dc60 100644 --- a/server/server.go +++ b/server/server.go @@ -480,17 +480,22 @@ func (server *BgpServer) notifyBestWatcher(best []*table.Path, multipath [][]*ta clonedM[i] = clonePathList(pathList) } clonedB := clonePathList(best) + m := make(map[string]uint16) for _, p := range clonedB { switch p.GetRouteFamily() { case bgp.RF_IPv4_VPN, bgp.RF_IPv6_VPN: for _, vrf := range server.globalRib.Vrfs { if vrf.Id != 0 && table.CanImportToVrf(vrf, p) { - p.VrfIds = append(p.VrfIds, uint16(vrf.Id)) + m[p.GetNlri().String()] = uint16(vrf.Id) } } } } - server.notifyWatcher(WATCH_EVENT_TYPE_BEST_PATH, &WatchEventBestPath{PathList: clonedB, MultiPathList: clonedM}) + w := &WatchEventBestPath{PathList: clonedB, MultiPathList: clonedM} + if len(m) > 0 { + w.Vrf = m + } + server.notifyWatcher(WATCH_EVENT_TYPE_BEST_PATH, w) } func (server *BgpServer) notifyPrePolicyUpdateWatcher(peer *Peer, pathList []*table.Path, msg *bgp.BGPMessage, timestamp time.Time, payload []byte) { @@ -2369,6 +2374,7 @@ type WatchEventTable struct { type WatchEventBestPath struct { PathList []*table.Path MultiPathList [][]*table.Path + Vrf map[string]uint16 } type WatchEventMessage struct { |