summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/interface.c
diff options
context:
space:
mode:
authorEsben Norby <norby@cvs.openbsd.org>2006-03-09 18:11:35 +0000
committerEsben Norby <norby@cvs.openbsd.org>2006-03-09 18:11:35 +0000
commit36b32be082b3a821442bae3180bb6f9a98d4a6e3 (patch)
treed8ab358e01d3e0097e011b3c138e546fc46030d0 /usr.sbin/ospfd/interface.c
parent859c243f8c81031ff33af109cd87ba1bb79453d1 (diff)
Track interface uptime.
ok claudio@
Diffstat (limited to 'usr.sbin/ospfd/interface.c')
-rw-r--r--usr.sbin/ospfd/interface.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/interface.c b/usr.sbin/ospfd/interface.c
index 7bee9a1b0d9..7060c7d21ae 100644
--- a/usr.sbin/ospfd/interface.c
+++ b/usr.sbin/ospfd/interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: interface.c,v 1.45 2006/03/09 15:43:21 claudio Exp $ */
+/* $OpenBSD: interface.c,v 1.46 2006/03/09 18:11:34 norby Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -321,6 +321,7 @@ int
if_act_start(struct iface *iface)
{
struct in_addr addr;
+ struct timeval now;
if (!((iface->flags & IFF_UP) &&
(iface->linkstate == LINK_STATE_UP ||
@@ -344,6 +345,9 @@ if_act_start(struct iface *iface)
return (0);
}
+ gettimeofday(&now, NULL);
+ iface->uptime = now.tv_sec;
+
switch (iface->type) {
case IF_TYPE_POINTOPOINT:
inet_aton(AllSPFRouters, &addr);
@@ -669,6 +673,11 @@ if_to_ctl(struct iface *iface)
} else
ictl.hello_timer = -1;
+ if (iface->state != IF_STA_DOWN) {
+ ictl.uptime = now.tv_sec - iface->uptime;
+ } else
+ ictl.uptime = 0;
+
LIST_FOREACH(nbr, &iface->nbr_list, entry) {
if (nbr == iface->self)
continue;