summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/neighbor.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ospfd/neighbor.c')
-rw-r--r--usr.sbin/ospfd/neighbor.c11
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);
}