]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Remove peer->obuf_work
authorDonald Sharp <sharpd@nvidia.com>
Fri, 21 Jul 2023 16:23:23 +0000 (12:23 -0400)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 21 Jul 2023 20:15:17 +0000 (20:15 +0000)
This is never used.  Free up another 65k of stream data
never used per peer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit acf4defcd80d7dd84e1fd4ed626e286eba41d848)

bgpd/bgp_fsm.c
bgpd/bgpd.c
bgpd/bgpd.h
bgpd/rfapi/rfapi.c
bgpd/rfapi/vnc_zebra.c

index ad6906d092e99252fc1e0877edb54c12768a956b..09b35bc7e7f92eda53abd7a6805876cc6e56a6e0 100644 (file)
@@ -1524,8 +1524,6 @@ enum bgp_fsm_state_progress bgp_stop(struct peer *peer)
 
                if (peer->ibuf_work)
                        ringbuf_wipe(peer->ibuf_work);
-               if (peer->obuf_work)
-                       stream_reset(peer->obuf_work);
 
                if (peer->curr) {
                        stream_free(peer->curr);
index 49c23ae8613cc270402db3ab149e632a35471919..14d231f313212eaf9fc1cf781dbdc62e356a77d3 100644 (file)
@@ -1415,20 +1415,6 @@ struct peer *peer_new(struct bgp *bgp)
        peer->obuf = stream_fifo_new();
        pthread_mutex_init(&peer->io_mtx, NULL);
 
-       /* We use a larger buffer for peer->obuf_work in the event that:
-        * - We RX a BGP_UPDATE where the attributes alone are just
-        *   under BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE.
-        * - The user configures an outbound route-map that does many as-path
-        *   prepends or adds many communities. At most they can have
-        *   CMD_ARGC_MAX args in a route-map so there is a finite limit on how
-        *   large they can make the attributes.
-        *
-        * Having a buffer with BGP_MAX_PACKET_SIZE_OVERFLOW allows us to avoid
-        * bounds checking for every single attribute as we construct an
-        * UPDATE.
-        */
-       peer->obuf_work =
-               stream_new(BGP_MAX_PACKET_SIZE + BGP_MAX_PACKET_SIZE_OVERFLOW);
        peer->ibuf_work =
                ringbuf_new(BGP_MAX_PACKET_SIZE * BGP_READ_PACKET_MAX);
 
@@ -2609,11 +2595,6 @@ int peer_delete(struct peer *peer)
                peer->ibuf_work = NULL;
        }
 
-       if (peer->obuf_work) {
-               stream_free(peer->obuf_work);
-               peer->obuf_work = NULL;
-       }
-
        /* Local and remote addresses. */
        if (peer->su_local) {
                sockunion_free(peer->su_local);
index 09d6128f53cf1af4caa8c70881b0fe1abc098beb..637f991c86113d9731b298a1aa806d213eef5284 100644 (file)
@@ -1154,7 +1154,6 @@ struct peer {
        uint8_t ibuf_scratch[BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE
                             * BGP_READ_PACKET_MAX];
        struct ringbuf *ibuf_work; // WiP buffer used by bgp_read() only
-       struct stream *obuf_work;  // WiP buffer used to construct packets
 
        struct stream *curr; // the current packet being parsed
 
index 67c70431bd19537f1b0ded50c0ee73b23755e7e4..e5e3261f086803ad22d66337fcbf132fbf22901a 100644 (file)
@@ -1252,12 +1252,9 @@ static int rfapi_open_inner(struct rfapi_descriptor *rfd, struct bgp *bgp,
 
                if (rfd->peer->ibuf_work)
                        ringbuf_del(rfd->peer->ibuf_work);
-               if (rfd->peer->obuf_work)
-                       stream_free(rfd->peer->obuf_work);
 
                rfd->peer->ibuf = NULL;
                rfd->peer->obuf = NULL;
-               rfd->peer->obuf_work = NULL;
                rfd->peer->ibuf_work = NULL;
        }
 
index 4c55c2f633c4de01594c70e8578edea3b9777b84..f7de651c11c58c0dc46d71b9c36d1ee0ab1f8ac8 100644 (file)
@@ -189,12 +189,9 @@ static void vnc_redistribute_add(struct prefix *p, uint32_t metric,
 
                                if (vncHD1VR.peer->ibuf_work)
                                        ringbuf_del(vncHD1VR.peer->ibuf_work);
-                               if (vncHD1VR.peer->obuf_work)
-                                       stream_free(vncHD1VR.peer->obuf_work);
 
                                vncHD1VR.peer->ibuf = NULL;
                                vncHD1VR.peer->obuf = NULL;
-                               vncHD1VR.peer->obuf_work = NULL;
                                vncHD1VR.peer->ibuf_work = NULL;
                        }