summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-10-14 16:09:36 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-10-14 16:09:36 +0000
commit7336ccbf0d1f73a30bcd68c2eeecae8012e19ead (patch)
treea8722d0cccc73eaa921d6d9a8dbf84ce20bfdf66
parente34e314eb6ae60e06f2bcd61ce36b84c9abe2586 (diff)
bgpd: move assert out of error case
bgp_process_packets has an assert to make sure an appropriate amount of working space in the input buffer has been freed up for future reads. However, this assert shouldn't be made when we have encountered an error that's going to tear down the session, because in this case we may not be able to process the full contents of the input buffer. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
-rw-r--r--bgpd/bgp_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index c2d06a4b5a..c8b7e5155f 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -242,13 +242,13 @@ static int bgp_process_reads(struct thread *thread)
break;
}
- assert(ringbuf_space(peer->ibuf_work) >= BGP_MAX_PACKET_SIZE);
-
/* handle invalid header */
if (fatal) {
/* wipe buffer just in case someone screwed up */
ringbuf_wipe(peer->ibuf_work);
} else {
+ assert(ringbuf_space(peer->ibuf_work) >= BGP_MAX_PACKET_SIZE);
+
thread_add_read(fpt->master, bgp_process_reads, peer, peer->fd,
&peer->t_read);
if (added_pkt)