From e0d98cbb883d2789520a1c6d1a0f9dc66f4d390d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 24 Jul 2023 10:13:32 -0400 Subject: [PATCH] bgpd: With io limit allow parsing to continue even if memory is low Commit: a0b937de428e14e869b8541f0b7810113d619c2e Introduced the idea of a input Q packet limit. Say you read in 635000 bytes of data and the input Q is already at it's limit (currently 1000) then when bgp_process_reads runs it will assert because there is less then a BGP_MAX_PACKET_SIZE in ibuf_work. Don't assert as that it's irrelevant. Even if we can't read a full packet in let's let the whole system keep working as that as the input Q length comes down we will start pulling down the ibuf_work and it will be ok. Signed-off-by: Donald Sharp (cherry picked from commit 102bad0a9b65279358db787e2972a1711606d224) --- bgpd/bgp_io.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 215554af3e..a375bd6005 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -218,7 +218,6 @@ static void bgp_process_reads(struct event *thread) bool fatal = false; /* whether fatal error occurred */ bool added_pkt = false; /* whether we pushed onto ->ibuf */ int code = 0; /* FSM code if error occurred */ - bool ibuf_full = false; /* Is peer fifo IN Buffer full */ static bool ibuf_full_logged; /* Have we logged full already */ int ret = 1; /* clang-format on */ @@ -265,7 +264,6 @@ static void bgp_process_reads(struct event *thread) fatal = true; break; case -ENOMEM: - ibuf_full = true; if (!ibuf_full_logged) { if (bgp_debug_neighbor_events(peer)) zlog_debug( @@ -288,10 +286,6 @@ done: return; } - /* ringbuf should be fully drained unless ibuf is full */ - if (!ibuf_full) - assert(ringbuf_space(peer->ibuf_work) >= peer->max_packet_size); - event_add_read(fpt->master, bgp_process_reads, peer, peer->fd, &peer->t_read); if (added_pkt) -- 2.39.5