Currently the last_updown stat is not initalized and 0 when a peer is
initially added. If the peer is passive or is unable to establish a
connection last_updown remains 0 which is not ideal.
Initalize the last_updown timestamp in init_peer() which is called when a
new peer is added or cloned. With this the time is shown properly in
bgpctl outputs.
--
:wq Claudio
Index: session.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/session.c,v
retrieving revision 1.435
diff -u -p -r1.435 session.c
--- session.c 31 Aug 2022 15:51:44 -0000 1.435
+++ session.c 18 Oct 2022 10:59:39 -0000
@@ -582,6 +582,8 @@ init_peer(struct peer *p)
else
timer_set(&p->timers, Timer_IdleHold, 0); /* start ASAP */
+ p->stats.last_updown = getmonotime();
+
/*
* on startup, demote if requested.
* do not handle new peers. they must reach ESTABLISHED beforehands.