diff options
author | Esben Norby <norby@cvs.openbsd.org> | 2006-06-28 10:53:40 +0000 |
---|---|---|
committer | Esben Norby <norby@cvs.openbsd.org> | 2006-06-28 10:53:40 +0000 |
commit | c8a16f45926300991328908f6b6f4f6f5113023d (patch) | |
tree | f701928b2983f6728ebd9bf5160f33b8fcacdb1a /usr.sbin/ospfd | |
parent | f48e7b1fb09ad3b1d0849e70bb2162b4c5d6747e (diff) |
Track the uptime of the ospfd daemon itself.
It is possible to read the uptime of the daemon with the "ospfctl show"
command.
ok claudio@
Diffstat (limited to 'usr.sbin/ospfd')
-rw-r--r-- | usr.sbin/ospfd/ospfd.h | 4 | ||||
-rw-r--r-- | usr.sbin/ospfd/rde.c | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h index 408d842ecdd..b8039d357d3 100644 --- a/usr.sbin/ospfd/ospfd.h +++ b/usr.sbin/ospfd/ospfd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.h,v 1.59 2006/05/31 03:24:06 claudio Exp $ */ +/* $OpenBSD: ospfd.h,v 1.60 2006/06/28 10:53:39 norby Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -388,6 +388,7 @@ struct ospfd_conf { #define OSPFD_OPT_NOACTION 0x00000004 u_int32_t spf_delay; u_int32_t spf_hold_time; + time_t uptime; int spf_state; int ospf_socket; int flags; @@ -491,6 +492,7 @@ struct ctl_sum { u_int32_t spf_hold_time; u_int32_t num_ext_lsa; u_int32_t num_area; + time_t uptime; u_int8_t rfc1583compat; }; diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c index 9ef7fc6e195..06d8a1bebb5 100644 --- a/usr.sbin/ospfd/rde.c +++ b/usr.sbin/ospfd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.46 2006/05/30 22:06:14 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.47 2006/06/28 10:53:39 norby Exp $ */ /* * Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org> @@ -91,6 +91,7 @@ pid_t rde(struct ospfd_conf *xconf, int pipe_parent2rde[2], int pipe_ospfe2rde[2], int pipe_parent2ospfe[2]) { + struct timeval now; struct passwd *pw; struct redistribute *r; struct event ev_sigint, ev_sigterm; @@ -166,6 +167,9 @@ rde(struct ospfd_conf *xconf, int pipe_parent2rde[2], int pipe_ospfe2rde[2], free(r); } + gettimeofday(&now, NULL); + rdeconf->uptime = now.tv_sec; + event_dispatch(); rde_shutdown(); @@ -695,6 +699,7 @@ void rde_send_summary(pid_t pid) { static struct ctl_sum sumctl; + struct timeval now; struct area *area; struct vertex *v; @@ -710,6 +715,12 @@ rde_send_summary(pid_t pid) RB_FOREACH(v, lsa_tree, &asext_tree) sumctl.num_ext_lsa++; + gettimeofday(&now, NULL); + if (rdeconf->uptime < now.tv_sec) + sumctl.uptime = now.tv_sec - rdeconf->uptime; + else + sumctl.uptime = 0; + sumctl.rfc1583compat = rdeconf->rfc1583compat; rde_imsg_compose_ospfe(IMSG_CTL_SHOW_SUM, 0, pid, &sumctl, |