summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2019-07-09 19:59:44 +0200
committerMatthew Smith <mgsmith@netgate.com>2019-07-10 14:53:05 +0200
commit497b686a49452c0ed51b377eefbc0bd987e1b5a7 (patch)
treeb195f0ebc40838150203ba6b00777ecd179edb6e
parentMerge pull request #4619 from opensourcerouting/eigrpd-yang (diff)
downloadfrr-497b686a49452c0ed51b377eefbc0bd987e1b5a7.tar.xz
frr-497b686a49452c0ed51b377eefbc0bd987e1b5a7.zip
bgpd: honor max prefix timer on inbound sessions
When using the maximum-prefix restart option with a BGP peer, if the peer exceeds the limit of prefixes, bgpd causes the connection to be closed and sets a timer. It will not attempt to connect to that peer until the timer expires. But if the peer attempts to connect to it before the timer expires, it accepts the connection and starts exchanging routes again. When accepting a connection from a peer, reject the connection if the max prefix restart timer is set. Signed-off-by: Matthew Smith <mgsmith@netgate.com>
-rw-r--r--bgpd/bgp_network.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c
index 8e18ed752..1dadf00e8 100644
--- a/bgpd/bgp_network.c
+++ b/bgpd/bgp_network.c
@@ -440,6 +440,17 @@ static int bgp_accept(struct thread *thread)
return -1;
}
+ /* Check whether max prefix restart timer is set for the peer */
+ if (peer1->t_pmax_restart) {
+ if (bgp_debug_neighbor_events(peer1))
+ zlog_debug(
+ "%s - incoming conn rejected - "
+ "peer max prefix timer is active",
+ peer1->host);
+ close(bgp_sock);
+ return -1;
+ }
+
if (bgp_debug_neighbor_events(peer1))
zlog_debug("[Event] BGP connection from host %s fd %d",
inet_sutop(&su, buf), bgp_sock);