]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: With io limit allow parsing to continue even if memory is low
authorDonald Sharp <sharpd@nvidia.com>
Mon, 24 Jul 2023 14:13:32 +0000 (10:13 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Tue, 25 Jul 2023 14:27:38 +0000 (14:27 +0000)
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 <sharpd@nvidia.com>
(cherry picked from commit 102bad0a9b65279358db787e2972a1711606d224)

bgpd/bgp_io.c

index 215554af3ead0245cfd95be2930cdddf26750387..a375bd6005889adeb431cadce66b8622b0a91664 100644 (file)
@@ -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)