summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_io.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-11-06 07:41:27 +0100
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-11-30 22:18:06 +0100
commit5c075a907dee4776236d71c5c89eabf5e6e0f2b3 (patch)
tree97619e44997ce6ffcad20c1110cd89bd82a450ca /bgpd/bgp_io.c
parentbgpd: schedule packet job after connection xfer (diff)
downloadfrr-5c075a907dee4776236d71c5c89eabf5e6e0f2b3.tar.xz
frr-5c075a907dee4776236d71c5c89eabf5e6e0f2b3.zip
bgpd: properly set peer->last_update
Instead of checking whether the post-write number of updates sent was greater than the pre-write number of updates sent, it was comparing post to zero. In effect this meant every time we wrote a packet it was counted as an update for route advertisement timer purposes. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_io.c')
-rw-r--r--bgpd/bgp_io.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index 807f577a2..a2ce18fa0 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -370,10 +370,14 @@ static uint16_t bgp_write(struct peer *peer)
int num;
int update_last_write = 0;
unsigned int count = 0;
- unsigned int oc = 0;
+ uint32_t oc;
+ uint32_t uo;
uint16_t status = 0;
uint32_t wpkt_quanta_old;
+ // save current # updates sent
+ oc = atomic_load_explicit(&peer->update_out, memory_order_relaxed);
+
// cache current write quanta
wpkt_quanta_old =
atomic_load_explicit(&peer->bgp->wpkt_quanta, memory_order_relaxed);
@@ -449,11 +453,12 @@ static uint16_t bgp_write(struct peer *peer)
done : {
/* Update last_update if UPDATEs were written. */
- if (peer->update_out > oc)
+ uo = atomic_load_explicit(&peer->update_out, memory_order_relaxed);
+ if (uo > oc)
atomic_store_explicit(&peer->last_update, bgp_clock(),
memory_order_relaxed);
- /* If we TXed any flavor of packet update last_write */
+ /* If we TXed any flavor of packet */
if (update_last_write)
atomic_store_explicit(&peer->last_write, bgp_clock(),
memory_order_relaxed);