summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-09 12:01:35 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-05-09 12:01:35 +0900
commitbcb6c38b472e4384df77fad7a2497e0c129336c6 (patch)
tree768397b02197f9434ab6fbeb4fd17bfa7dc0c3ff /server
parent5d7c1a00df4887558f261e2b284abed426aaa9db (diff)
server: immediately close newly accepted connection for non admin-state-up peer
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/server.go b/server/server.go
index 4c192a0c..495b5d4b 100644
--- a/server/server.go
+++ b/server/server.go
@@ -263,6 +263,11 @@ func (server *BgpServer) Serve() {
remoteAddr, _, _ := net.SplitHostPort(conn.RemoteAddr().String())
peer, found := server.neighborMap[remoteAddr]
if found {
+ if peer.fsm.adminState != ADMIN_STATE_UP {
+ log.Debug("new connection for non admin-state-up peer ", remoteAddr, peer.fsm.adminState)
+ conn.Close()
+ return
+ }
localAddrValid := func(laddr net.IP) bool {
if laddr == nil {
return true