diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-15 09:14:04 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-04-19 06:23:42 +0000 |
commit | 642270bb32db2a0a55badf6a53076aeac2dfb215 (patch) | |
tree | 3d92957e525c31935f8844ac8aa5f02d0e052283 /server/peer.go | |
parent | 00039df8275b0af2f4be9be3844ec6d130fe0add (diff) |
cli: show prefix-limit configuration by `gobgp neighbor <neighbor-addr>`
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/peer.go b/server/peer.go index 0f6b37ec..d2b065e1 100644 --- a/server/peer.go +++ b/server/peer.go @@ -333,6 +333,18 @@ func (peer *Peer) ToApiStruct() *api.Peer { localCap = append(localCap, buf) } + prefixLimits := make([]*api.PrefixLimit, 0, len(peer.fsm.pConf.AfiSafis)) + for _, family := range peer.fsm.pConf.AfiSafis { + if c := family.PrefixLimit.Config; c.MaxPrefixes > 0 { + k, _ := bgp.GetRouteFamily(string(family.AfiSafiName)) + prefixLimits = append(prefixLimits, &api.PrefixLimit{ + Family: uint32(k), + MaxPrefixes: c.MaxPrefixes, + ShutdownThresholdPct: uint32(c.ShutdownThresholdPct), + }) + } + } + conf := &api.PeerConf{ NeighborAddress: c.Config.NeighborAddress, Id: peer.fsm.peerInfo.ID.To4().String(), @@ -347,6 +359,7 @@ func (peer *Peer) ToApiStruct() *api.Peer { PeerGroup: c.Config.PeerGroup, RemoteCap: remoteCap, LocalCap: localCap, + PrefixLimits: prefixLimits, } timer := c.Timers |