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) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index dfa5956ba1..28c1a9da6b 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1416,7 +1416,7 @@ struct peer *peer_new(struct bgp *bgp) pthread_mutex_init(&peer->io_mtx, NULL); peer->ibuf_work = - ringbuf_new(BGP_MAX_PACKET_SIZE * BGP_READ_PACKET_MAX); + ringbuf_new(BGP_MAX_PACKET_SIZE + BGP_MAX_PACKET_SIZE/2); /* Get service port number. */ sp = getservbyname("bgp", "tcp");