Re: initialize peer last_updown when peer is created

2022-10-18 Thread Theo Buehler
On Tue, Oct 18, 2022 at 01:13:27PM +0200, Claudio Jeker wrote:
> 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.

ok tb

> 
> -- 
> :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 -  1.435
> +++ session.c 18 Oct 2022 10:59:39 -
> @@ -582,6 +582,8 @@ init_peer(struct peer *p)
>   else
>   timer_set(>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.
> 



initialize peer last_updown when peer is created

2022-10-18 Thread Claudio Jeker
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 -  1.435
+++ session.c   18 Oct 2022 10:59:39 -
@@ -582,6 +582,8 @@ init_peer(struct peer *p)
else
timer_set(>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.