summaryrefslogtreecommitdiff
path: root/bgpd/bgp_io.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-04-22 11:04:52 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2022-05-19 12:14:40 +0200
commitbd9fb6f368049bd5f1f6a2b7bc97fbd51c9300cc (patch)
treef172dc19ee071f21387bc212197d4913b99a881a /bgpd/bgp_io.c
parent18028bdb9b5d0e5cd6081d8df387551c206ce7ab (diff)
bgpd: implement SendHoldTimer
As described by https://www.ietf.org/archive/id/draft-spaghetti-idr-bgp-sendholdtimer-04.html Since this replicates the HoldTime check on the receiver that is already part of the protocol, I do not believe it necessary to wait for IETF progress on this draft. It's just replicating an existing element of the protocol at the other side of the session. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_io.c')
-rw-r--r--bgpd/bgp_io.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index bd0dfb3a6d..75d34a84e0 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -298,6 +298,7 @@ static uint16_t bgp_write(struct peer *peer)
unsigned int iovsz;
unsigned int strmsz;
unsigned int total_written;
+ time_t now;
wpkt_quanta_old = atomic_load_explicit(&peer->bgp->wpkt_quanta,
memory_order_relaxed);
@@ -430,19 +431,22 @@ static uint16_t bgp_write(struct peer *peer)
}
done : {
+ now = bgp_clock();
/*
* Update last_update if UPDATEs were written.
* Note: that these are only updated at end,
* not per message (i.e., per loop)
*/
if (uo)
- atomic_store_explicit(&peer->last_update, bgp_clock(),
+ atomic_store_explicit(&peer->last_update, now,
memory_order_relaxed);
/* If we TXed any flavor of packet */
- if (update_last_write)
- atomic_store_explicit(&peer->last_write, bgp_clock(),
+ if (update_last_write) {
+ atomic_store_explicit(&peer->last_write, now,
memory_order_relaxed);
+ peer->last_sendq_ok = now;
+ }
}
return status;