summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-06-29 08:58:47 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-06-29 08:58:47 +0900
commitdb6683bfbfee3a6e04e78d6af40bbdb9f4fcd317 (patch)
tree1cb852253b2219363dd0db4513eff750f5d11d83 /server/server.go
parentf265c314af0ab82924da5ffba38b2f0e5428724d (diff)
server: exclude RTC for softreset if not specified
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/server/server.go b/server/server.go
index f642ece3..2293756d 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1762,16 +1762,28 @@ func (s *BgpServer) Stop() error {
}, true)
}
+func familiesForSoftreset(peer *Peer, family bgp.RouteFamily) []bgp.RouteFamily {
+ if family == bgp.RouteFamily(0) {
+ configured := peer.configuredRFlist()
+ families := make([]bgp.RouteFamily, 0, len(configured))
+ for _, f := range configured {
+ if f != bgp.RF_RTC_UC {
+ families = append(families, f)
+ }
+ }
+ return families
+ }
+ return []bgp.RouteFamily{family}
+}
+
func (s *BgpServer) softResetIn(addr string, family bgp.RouteFamily) error {
peers, err := s.addrToPeers(addr)
if err != nil {
return err
}
for _, peer := range peers {
- families := []bgp.RouteFamily{family}
- if family == bgp.RouteFamily(0) {
- families = peer.configuredRFlist()
- }
+ families := familiesForSoftreset(peer, family)
+
pathList := make([]*table.Path, 0, peer.adjRibIn.Count(families))
for _, path := range peer.adjRibIn.PathList(families, false) {
// RFC4271 9.1.2 Phase 2: Route Selection
@@ -1807,11 +1819,7 @@ func (s *BgpServer) softResetOut(addr string, family bgp.RouteFamily, deferral b
if peer.fsm.state != bgp.BGP_FSM_ESTABLISHED {
continue
}
-
- families := []bgp.RouteFamily{family}
- if family == bgp.RouteFamily(0) {
- families = peer.negotiatedRFList()
- }
+ families := familiesForSoftreset(peer, family)
if deferral {
_, y := peer.fsm.rfMap[bgp.RF_RTC_UC]