summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-05-22 13:21:30 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-05-23 06:09:07 +0900
commit30e519ea8ec7dd19e46054971a06e5ce034f948b (patch)
treee5f75ea36f8e7ab4a112debeee1ff626828e2f80
parent9c8b20a2ef4b29dd94fcd35e7e16541dabef2330 (diff)
server: use negotiated family instead configured
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--server/peer.go8
-rw-r--r--server/server.go18
2 files changed, 17 insertions, 9 deletions
diff --git a/server/peer.go b/server/peer.go
index 80fc6a1b..13238e54 100644
--- a/server/peer.go
+++ b/server/peer.go
@@ -182,6 +182,14 @@ func (peer *Peer) configuredRFlist() []bgp.RouteFamily {
return rfs
}
+func (peer *Peer) negotiatedRFList() []bgp.RouteFamily {
+ l := make([]bgp.RouteFamily, 0, len(peer.fsm.rfMap))
+ for family, _ := range peer.fsm.rfMap {
+ l = append(l, family)
+ }
+ return l
+}
+
func (peer *Peer) toGlobalFamilies(families []bgp.RouteFamily) []bgp.RouteFamily {
if peer.fsm.pConf.Config.Vrf != "" {
fs := make([]bgp.RouteFamily, 0, len(families))
diff --git a/server/server.go b/server/server.go
index 87348a72..d86e51df 100644
--- a/server/server.go
+++ b/server/server.go
@@ -891,15 +891,15 @@ func (server *BgpServer) propagateUpdate(peer *Peer, pathList []*table.Path) {
// graph that is derived from Route Target membership information.
if peer != nil && path != nil && path.GetRouteFamily() == bgp.RF_RTC_UC {
rt := path.GetNlri().(*bgp.RouteTargetMembershipNLRI).RouteTarget
- fs := make([]bgp.RouteFamily, 0, len(peer.configuredRFlist()))
- for _, f := range peer.configuredRFlist() {
+ fs := make([]bgp.RouteFamily, 0, len(peer.negotiatedRFList()))
+ for _, f := range peer.negotiatedRFList() {
if f != bgp.RF_RTC_UC {
fs = append(fs, f)
}
}
var candidates []*table.Path
if path.IsWithdraw {
- candidates, _ = server.getBestFromLocal(peer, peer.configuredRFlist())
+ candidates, _ = server.getBestFromLocal(peer, fs)
} else {
candidates = server.globalRib.GetBestPathList(peer.TableID(), 0, fs)
}
@@ -1141,13 +1141,13 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *FsmMsg) {
if c := peer.fsm.pConf.GetAfiSafi(bgp.RF_RTC_UC); y && !peer.fsm.pConf.GracefulRestart.State.PeerRestarting && c.RouteTargetMembership.Config.DeferralTime > 0 {
pathList, _ = server.getBestFromLocal(peer, []bgp.RouteFamily{bgp.RF_RTC_UC})
t := c.RouteTargetMembership.Config.DeferralTime
- for _, f := range peer.configuredRFlist() {
+ for _, f := range peer.negotiatedRFList() {
if f != bgp.RF_RTC_UC {
time.AfterFunc(time.Second*time.Duration(t), deferralExpiredFunc(f))
}
}
} else {
- pathList, _ = server.getBestFromLocal(peer, peer.configuredRFlist())
+ pathList, _ = server.getBestFromLocal(peer, peer.negotiatedRFList())
}
if len(pathList) > 0 {
@@ -1283,7 +1283,7 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *FsmMsg) {
if !p.isGracefulRestartEnabled() {
continue
}
- paths, _ := server.getBestFromLocal(p, p.configuredRFlist())
+ paths, _ := server.getBestFromLocal(p, p.negotiatedRFList())
if len(paths) > 0 {
sendFsmOutgoingMsg(p, paths, nil, false)
}
@@ -1319,8 +1319,8 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *FsmMsg) {
"Topic": "Peer",
"Key": peer.ID(),
}).Debug("received route-target eor. flash non-route-target NLRIs")
- families := make([]bgp.RouteFamily, 0, len(peer.configuredRFlist()))
- for _, f := range peer.configuredRFlist() {
+ families := make([]bgp.RouteFamily, 0, len(peer.negotiatedRFList()))
+ for _, f := range peer.negotiatedRFList() {
if f != bgp.RF_RTC_UC {
families = append(families, f)
}
@@ -1750,7 +1750,7 @@ func (s *BgpServer) softResetOut(addr string, family bgp.RouteFamily, deferral b
families := []bgp.RouteFamily{family}
if family == bgp.RouteFamily(0) {
- families = peer.configuredRFlist()
+ families = peer.negotiatedRFList()
}
if deferral {