From bbac44ace545066d0d43370e63baa77ceade9242 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Mon, 12 Jun 2017 21:16:40 +0000 Subject: [PATCH] bgpd: be more promiscuous with updgrp packets Slightly incorrect trigger for generating update group packets. In order to match semantics of previous bgp_write() we need to trigger update-group packet generation after every write operation, even if no packets were written. Of course if we're tearing down the session we can still skip this operation. Signed-off-by: Quentin Young --- bgpd/bgp_io.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 0e557ec205..78a421bd83 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -191,6 +191,7 @@ static int bgp_process_writes(struct thread *thread) peer = THREAD_ARG(thread); uint16_t status; bool reschedule; + bool fatal = false; if (peer->fd < 0) return -1; @@ -207,12 +208,17 @@ static int bgp_process_writes(struct thread *thread) if (CHECK_FLAG(status, BGP_IO_TRANS_ERR)) { /* no problem */ } - if (CHECK_FLAG(status, BGP_IO_FATAL_ERR)) + if (CHECK_FLAG(status, BGP_IO_FATAL_ERR)) { reschedule = false; /* problem */ + fatal = true; + } if (reschedule) { thread_add_write(fpt->master, bgp_process_writes, peer, peer->fd, &peer->t_write); + } + + if (!fatal) { thread_add_timer_msec(bm->master, bgp_generate_updgrp_packets, peer, 0, &peer->t_generate_updgrp_packets); -- 2.39.5