From: Donald Sharp Date: Fri, 21 Jul 2023 16:23:23 +0000 (-0400) Subject: bgpd: Remove peer->obuf_work X-Git-Tag: docker/9.0.0~7^2~3 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=25f3e01dbbacd4d594a2ac3707ef0387457e5530;p=matthieu%2Ffrr.git bgpd: Remove peer->obuf_work This is never used. Free up another 65k of stream data never used per peer. Signed-off-by: Donald Sharp (cherry picked from commit acf4defcd80d7dd84e1fd4ed626e286eba41d848) --- diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index ad6906d092..09b35bc7e7 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -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); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 49c23ae861..14d231f313 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -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); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 09d6128f53..637f991c86 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -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 diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c index 67c70431bd..e5e3261f08 100644 --- a/bgpd/rfapi/rfapi.c +++ b/bgpd/rfapi/rfapi.c @@ -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; } diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index 4c55c2f633..f7de651c11 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -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; }