diff options
-rw-r--r-- | server/peer.go | 17 | ||||
-rw-r--r-- | server/server.go | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/server/peer.go b/server/peer.go index d2b065e1..dfdfdc37 100644 --- a/server/peer.go +++ b/server/peer.go @@ -42,16 +42,17 @@ type Peer struct { outgoing chan *FsmOutgoingMsg policy *table.RoutingPolicy localRib *table.TableManager - prefixLimitWarned bool + prefixLimitWarned map[bgp.RouteFamily]bool } func NewPeer(g config.Global, conf config.Neighbor, loc *table.TableManager, policy *table.RoutingPolicy) *Peer { peer := &Peer{ - gConf: g, - conf: conf, - outgoing: make(chan *FsmOutgoingMsg, 128), - localRib: loc, - policy: policy, + gConf: g, + conf: conf, + outgoing: make(chan *FsmOutgoingMsg, 128), + localRib: loc, + policy: policy, + prefixLimitWarned: make(map[bgp.RouteFamily]bool), } tableId := table.GLOBAL_RIB_NAME if peer.isRouteServerClient() { @@ -249,8 +250,8 @@ func (peer *Peer) handleUpdate(e *FsmMsg) ([]*table.Path, []bgp.RouteFamily, *bg if maxPrefixes := int(family.PrefixLimit.Config.MaxPrefixes); maxPrefixes > 0 { count := peer.adjRibIn.Count([]bgp.RouteFamily{k}) pct := int(family.PrefixLimit.Config.ShutdownThresholdPct) - if pct > 0 && !peer.prefixLimitWarned && count > (maxPrefixes*pct/100) { - peer.prefixLimitWarned = true + if pct > 0 && !peer.prefixLimitWarned[k] && count > (maxPrefixes*pct/100) { + peer.prefixLimitWarned[k] = true log.WithFields(log.Fields{ "Topic": "Peer", "Key": peer.conf.Config.NeighborAddress, diff --git a/server/server.go b/server/server.go index efcb97bc..acb15932 100644 --- a/server/server.go +++ b/server/server.go @@ -776,7 +776,7 @@ func (server *BgpServer) handleFSMMessage(peer *Peer, e *FsmMsg) []*SenderMsg { } else { drop = peer.configuredRFlist() } - peer.prefixLimitWarned = false + peer.prefixLimitWarned = make(map[bgp.RouteFamily]bool) peer.DropAll(drop) msgs = server.dropPeerAllRoutes(peer, drop) } else if peer.fsm.pConf.GracefulRestart.State.PeerRestarting && nextState == bgp.BGP_FSM_IDLE { |