diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-27 22:22:23 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-27 22:22:23 +0900 |
commit | a8cf76d39c46546376756416991d7583970beec1 (patch) | |
tree | 32432479ecebf754006fe7f4ae8667a3cc5bc4c7 /server/peer.go | |
parent | a231a9e274fc66d1a7763a4d1d143f0563409c6a (diff) |
server: set #Advertised to zero when peer is down
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go index 51893421..ff75d354 100644 --- a/server/peer.go +++ b/server/peer.go @@ -409,6 +409,11 @@ func (peer *Peer) MarshalJSON() ([]byte, error) { downtime = time.Now().Sub(s.Downtime).Seconds() } + advertized := uint32(0) + if f.state == bgp.BGP_FSM_ESTABLISHED { + advertized = uint32(peer.adjRib.GetOutCount(peer.rf)) + } + p["info"] = struct { BgpState string `json:"bgp_state"` FsmEstablishedTransitions uint32 `json:"fsm_established_transitions"` @@ -452,7 +457,7 @@ func (peer *Peer) MarshalJSON() ([]byte, error) { Downtime: downtime, Received: uint32(peer.adjRib.GetInCount(peer.rf)), Accepted: uint32(peer.adjRib.GetInCount(peer.rf)), - Advertized: uint32(peer.adjRib.GetOutCount(peer.rf)), + Advertized: advertized, OutQ: len(peer.outgoing), Flops: s.Flops, } |