summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-01-25 22:57:13 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-01-25 22:57:13 +0900
commit526bd67f5de4cf361aaab2d10456e5113899ca54 (patch)
tree51df734ec0201fd20060493df9bf8620c992d71e
parent318a91e31b8baed86bb66a3767525da68ae49a5d (diff)
server: dynamic neighbor deletion panic
https://github.com/osrg/gobgp/commit/318a91e31b8baed86bb66a3767525da68ae49a5d The above commit added a bug to close a closed channel; after deleting a dynamic neighbor, handleFSMMessage() must return. Otherwise cleanInfiniteChannel() is called twice. https://travis-ci.org/osrg/gobgp/jobs/483896487 Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
-rw-r--r--pkg/server/server.go23
1 files changed, 12 insertions, 11 deletions
diff --git a/pkg/server/server.go b/pkg/server/server.go
index c95ba700..3a7ab371 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -1151,15 +1151,12 @@ func (s *BgpServer) propagateUpdateToNeighbors(source *peer, newPath *table.Path
}
func (s *BgpServer) deleteDynamicNeighbor(peer *peer, oldState bgp.FSMState, e *fsmMsg) {
- if peer.isDynamicNeighbor() {
- peer.stopPeerRestarting()
- go peer.stopFSM()
- peer.fsm.lock.RLock()
- delete(s.neighborMap, peer.fsm.pConf.State.NeighborAddress)
- peer.fsm.lock.RUnlock()
- s.broadcastPeerState(peer, oldState, e)
- return
- }
+ peer.stopPeerRestarting()
+ go peer.stopFSM()
+ peer.fsm.lock.RLock()
+ delete(s.neighborMap, peer.fsm.pConf.State.NeighborAddress)
+ peer.fsm.lock.RUnlock()
+ s.broadcastPeerState(peer, oldState, e)
}
func (s *BgpServer) handleFSMMessage(peer *peer, e *fsmMsg) {
@@ -1208,8 +1205,9 @@ func (s *BgpServer) handleFSMMessage(peer *peer, e *fsmMsg) {
}
peer.fsm.lock.Unlock()
- if !graceful {
+ if !graceful && peer.isDynamicNeighbor() {
s.deleteDynamicNeighbor(peer, oldState, e)
+ return
}
} else if nextStateIdle {
@@ -1282,7 +1280,10 @@ func (s *BgpServer) handleFSMMessage(peer *peer, e *fsmMsg) {
peer.DropAll(peer.configuredRFlist())
s.dropPeerAllRoutes(peer, peer.configuredRFlist())
- s.deleteDynamicNeighbor(peer, oldState, e)
+ if peer.isDynamicNeighbor() {
+ s.deleteDynamicNeighbor(peer, oldState, e)
+ return
+ }
}
}