summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_vty.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-01-19 17:43:12 +0100
committerDonald Sharp <sharpd@nvidia.com>2023-01-19 17:48:01 +0100
commit963b7ee44845481197a1e04bf922a872041bec00 (patch)
tree1049e1db9257abb612ed9c66e54550a391db32bd /bgpd/bgp_vty.c
parentMerge pull request #12626 from opensourcerouting/fix/bgpd_neighbor_password_u... (diff)
downloadfrr-963b7ee44845481197a1e04bf922a872041bec00.tar.xz
frr-963b7ee44845481197a1e04bf922a872041bec00.zip
bgpd: Limit peer output queue length like input queue length
Consider this scenario: Lots of peers with a bunch of route information that is changing fast. One of the peers happens to be really slow for whatever reason. The way the output queue is filled is that bgpd puts 64 packets at a time and then reschedules itself to send more in the future. Now suppose that peer has hit it's input Queue limit and is slow. As such bgp will continue to add data to the output Queue, irrelevant if the other side is receiving this data. Let's limit the Output Queue to the same limit as the Input Queue. This should prevent bgp eating up large amounts of memory as stream data when under severe network trauma. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_vty.c')
-rw-r--r--bgpd/bgp_vty.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 4acf4f76a..878f2f796 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -17901,9 +17901,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)) {
@@ -18638,11 +18641,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)
{
@@ -18695,6 +18724,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);