summaryrefslogtreecommitdiffhomepage
path: root/server/fsm.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-06 23:33:02 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-10 23:58:17 +0000
commit59420a4c4623492085348e07fb78eaae51182782 (patch)
treeea4ab75a0b39ca4ff049924edec59d7247ca0759 /server/fsm.go
parentaa79a4de21772f556450cfe7e55e6f400c3f9dec (diff)
server: support prefix-limit
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm.go')
-rw-r--r--server/fsm.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/server/fsm.go b/server/fsm.go
index 48f4e095..01587668 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -109,6 +109,7 @@ type AdminState int
const (
ADMIN_STATE_UP AdminState = iota
ADMIN_STATE_DOWN
+ ADMIN_STATE_PFX_CT
)
func (s AdminState) String() string {
@@ -117,6 +118,8 @@ func (s AdminState) String() string {
return "ADMIN_STATE_UP"
case ADMIN_STATE_DOWN:
return "ADMIN_STATE_DOWN"
+ case ADMIN_STATE_PFX_CT:
+ return "ADMIN_STATE_PFX_CT"
default:
return "Unknown"
}
@@ -1086,15 +1089,14 @@ func (h *FSMHandler) sendMessageloop() error {
}
}
if m.Notification != nil {
+ if m.StayIdle {
+ // current user is only prefix-limit
+ // fix me if this is not the case
+ h.changeAdminState(ADMIN_STATE_PFX_CT)
+ }
if err := send(m.Notification); err != nil {
return nil
}
- if m.StayIdle {
- select {
- case h.fsm.adminStateCh <- ADMIN_STATE_DOWN:
- default:
- }
- }
}
case <-ticker.C:
if err := send(bgp.NewBGPKeepAliveMessage()); err != nil {
@@ -1272,7 +1274,7 @@ func (h *FSMHandler) changeAdminState(s AdminState) error {
"State": fsm.state,
}).Info("Administrative start")
- case ADMIN_STATE_DOWN:
+ case ADMIN_STATE_DOWN, ADMIN_STATE_PFX_CT:
log.WithFields(log.Fields{
"Topic": "Peer",
"Key": fsm.pConf.Config.NeighborAddress,