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);
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);
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
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;
}
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;
}