summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_packet.c13
-rw-r--r--bgpd/bgp_vty.c39
-rw-r--r--bgpd/bgpd.c3
-rw-r--r--bgpd/bgpd.h3
-rw-r--r--doc/user/bgp.rst5
5 files changed, 54 insertions, 9 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 5d4cf2a6aa..9e7c75318e 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -487,6 +487,16 @@ void bgp_generate_updgrp_packets(struct thread *thread)
if (peer->t_routeadv)
return;
+ /*
+ * Since the following is a do while loop
+ * let's stop adding to the outq if we are
+ * already at the limit.
+ */
+ if (peer->obuf->count >= bm->outq_limit) {
+ bgp_write_proceed_actions(peer);
+ return;
+ }
+
do {
enum bgp_af_index index;
@@ -609,7 +619,8 @@ void bgp_generate_updgrp_packets(struct thread *thread)
bgp_packet_add(peer, s);
bpacket_queue_advance_peer(paf);
}
- } while (s && (++generated < wpq));
+ } while (s && (++generated < wpq) &&
+ (peer->obuf->count <= bm->outq_limit));
if (generated)
bgp_writes_on(peer);
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 5371718e9f..5772900ce4 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -17882,9 +17882,12 @@ int bgp_config_write(struct vty *vty)
vty_out(vty, "bgp session-dscp %u\n", bm->tcp_dscp >> 2);
/* BGP InQ limit */
- if (bm->inq_limit != BM_DEFAULT_INQ_LIMIT)
+ if (bm->inq_limit != BM_DEFAULT_Q_LIMIT)
vty_out(vty, "bgp input-queue-limit %u\n", bm->inq_limit);
+ if (bm->outq_limit != BM_DEFAULT_Q_LIMIT)
+ vty_out(vty, "bgp output-queue-limit %u\n", bm->outq_limit);
+
/* BGP configuration. */
for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) {
@@ -18619,11 +18622,37 @@ DEFPY (no_bgp_inq_limit,
"Set the BGP Input Queue limit for all peers when message parsing\n"
"Input-Queue limit\n")
{
- bm->inq_limit = BM_DEFAULT_INQ_LIMIT;
+ bm->inq_limit = BM_DEFAULT_Q_LIMIT;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (bgp_outq_limit,
+ bgp_outq_limit_cmd,
+ "bgp output-queue-limit (1-4294967295)$limit",
+ BGP_STR
+ "Set the BGP Output Queue limit for all peers when message parsing\n"
+ "Output-Queue limit\n")
+{
+ bm->outq_limit = limit;
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (no_bgp_outq_limit,
+ no_bgp_outq_limit_cmd,
+ "no bgp output-queue-limit [(1-4294967295)$limit]",
+ NO_STR
+ BGP_STR
+ "Set the BGP Output Queue limit for all peers when message parsing\n"
+ "Output-Queue limit\n")
+{
+ bm->outq_limit = BM_DEFAULT_Q_LIMIT;
return CMD_SUCCESS;
}
+
/* Initialization of BGP interface. */
static void bgp_vty_if_init(void)
{
@@ -18676,6 +18705,8 @@ void bgp_vty_init(void)
/* "global bgp inq-limit command */
install_element(CONFIG_NODE, &bgp_inq_limit_cmd);
install_element(CONFIG_NODE, &no_bgp_inq_limit_cmd);
+ install_element(CONFIG_NODE, &bgp_outq_limit_cmd);
+ install_element(CONFIG_NODE, &no_bgp_outq_limit_cmd);
/* "bgp local-mac" hidden commands. */
install_element(CONFIG_NODE, &bgp_local_mac_cmd);
@@ -18878,10 +18909,6 @@ void bgp_vty_init(void)
install_element(BGP_NODE, &bgp_graceful_restart_rib_stale_time_cmd);
install_element(BGP_NODE, &no_bgp_graceful_restart_rib_stale_time_cmd);
- /* "bgp inq-limit command */
- install_element(BGP_NODE, &bgp_inq_limit_cmd);
- install_element(BGP_NODE, &no_bgp_inq_limit_cmd);
-
/* "bgp graceful-shutdown" commands */
install_element(BGP_NODE, &bgp_graceful_shutdown_cmd);
install_element(BGP_NODE, &no_bgp_graceful_shutdown_cmd);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 8facf1d3fa..1fd394a849 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -7944,7 +7944,8 @@ void bgp_master_init(struct thread_master *master, const int buffer_size,
bm->socket_buffer = buffer_size;
bm->wait_for_fib = false;
bm->tcp_dscp = IPTOS_PREC_INTERNETCONTROL;
- bm->inq_limit = BM_DEFAULT_INQ_LIMIT;
+ bm->inq_limit = BM_DEFAULT_Q_LIMIT;
+ bm->outq_limit = BM_DEFAULT_Q_LIMIT;
bgp_mac_init();
/* init the rd id space.
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 91e41901a6..4c4c81f997 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -176,8 +176,9 @@ struct bgp_master {
/* DSCP value for TCP sessions */
uint8_t tcp_dscp;
-#define BM_DEFAULT_INQ_LIMIT 10000
+#define BM_DEFAULT_Q_LIMIT 10000
uint32_t inq_limit;
+ uint32_t outq_limit;
QOBJ_FIELDS;
};
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index 27e1744ef5..9c69848258 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -3755,6 +3755,11 @@ The following command is available in ``config`` mode as well as in the
Set the BGP Input Queue limit for all peers when messaging parsing. Increase
this only if you have the memory to handle large queues of messages at once.
+.. clicmd:: bgp output-queue-limit (1-4294967295)
+
+ Set the BGP Output Queue limit for all peers when messaging parsing. Increase
+ this only if you have the memory to handle large queues of messages at once.
+
.. _bgp-displaying-bgp-information:
Displaying BGP Information