diff options
author | Esben Norby <norby@cvs.openbsd.org> | 2006-02-19 21:48:57 +0000 |
---|---|---|
committer | Esben Norby <norby@cvs.openbsd.org> | 2006-02-19 21:48:57 +0000 |
commit | 3a61b876ed54ba4e1ce03ecea21b28c40c4dce23 (patch) | |
tree | ae1caaefece4e0eaf1b6e67f0189d73cd221369a /usr.sbin/ospfd | |
parent | acd11f0a841e26b98d96e0d4bf0c332918a4c61f (diff) |
Keep track of the duration of our relationships with neighbors.
Displayed in "ospfctl show neighbor".
ok claudio@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r-- | usr.sbin/ospfd/neighbor.c | 11 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfd.h | 3 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfe.h | 3 |
3 files changed, 14 insertions, 3 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); } diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h index 869042bfff7..f5ba8cac402 100644 --- a/usr.sbin/ospfd/ospfd.h +++ b/usr.sbin/ospfd/ospfd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.h,v 1.44 2006/02/10 18:30:47 claudio Exp $ */ +/* $OpenBSD: ospfd.h,v 1.45 2006/02/19 21:48:56 norby Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -416,6 +416,7 @@ struct ctl_nbr { struct in_addr bdr; struct in_addr area; time_t dead_timer; + time_t uptime; u_int32_t db_sum_lst_cnt; u_int32_t ls_req_lst_cnt; u_int32_t ls_retrans_lst_cnt; diff --git a/usr.sbin/ospfd/ospfe.h b/usr.sbin/ospfd/ospfe.h index 7e21d84a4e7..e874edda521 100644 --- a/usr.sbin/ospfd/ospfe.h +++ b/usr.sbin/ospfd/ospfe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfe.h,v 1.23 2006/02/19 18:55:47 norby Exp $ */ +/* $OpenBSD: ospfe.h,v 1.24 2006/02/19 21:48:56 norby Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -136,6 +136,7 @@ struct nbr { u_int32_t ls_ret_cnt; u_int32_t crypt_seq_num; + time_t uptime; int state; u_int8_t priority; u_int8_t options; |