diff options
author | 2006-02-19 21:48:56 +0000 | |
---|---|---|
committer | 2006-02-19 21:48:56 +0000 | |
commit | 129e6b5ffda15408cdf1d40a494801f4862d494c (patch) | |
tree | d30517aa667a8189eb8822ffd8741a7c5b8fca0a /usr.sbin/ospfd/neighbor.c | |
parent | Added code for aml_notify GPE notification callback (diff) | |
download | wireguard-openbsd-129e6b5ffda15408cdf1d40a494801f4862d494c.tar.xz wireguard-openbsd-129e6b5ffda15408cdf1d40a494801f4862d494c.zip |
Keep track of the duration of our relationships with neighbors.
Displayed in "ospfctl show neighbor".
ok claudio@
Diffstat (limited to 'usr.sbin/ospfd/neighbor.c')
-rw-r--r-- | usr.sbin/ospfd/neighbor.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/neighbor.c b/usr.sbin/ospfd/neighbor.c index da9755dcea4..b703e7da138 100644 --- a/usr.sbin/ospfd/neighbor.c +++ b/usr.sbin/ospfd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.29 2006/02/19 19:23:17 norby Exp $ */ +/* $OpenBSD: neighbor.c,v 1.30 2006/02/19 21:48:56 norby Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -117,6 +117,7 @@ const char * const nbr_action_names[] = { int nbr_fsm(struct nbr *nbr, enum nbr_event event) { + struct timeval now; int old_state; int new_state = 0; int i, ret = 0; @@ -206,6 +207,9 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event) orig_rtr_lsa(nbr->iface->area); if (nbr->iface->state & IF_STA_DR) orig_net_lsa(nbr->iface); + + gettimeofday(&now, NULL); + nbr->uptime = now.tv_sec; } /* bidirectional communication lost */ @@ -685,6 +689,11 @@ nbr_to_ctl(struct nbr *nbr) } else nctl.dead_timer = 0; + if (nbr->state == NBR_STA_FULL) { + nctl.uptime = now.tv_sec - nbr->uptime; + } else + nctl.uptime = 0; + return (&nctl); } |