summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-12-20 17:08:49 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-12-20 17:08:49 +0000
commit59addf3f2cac6e5d34e1b468839a462b36206b79 (patch)
treecfc790506e4edbf21b1a9170041db1ad4097401a /usr.sbin/bgpctl
parent888aea4de980d9769f870057dbd8365d84417047 (diff)
rework timers.
stop changing tienmr values directly, always use new timer_(get/set/stop/running) functions. preparation for more to come :) ok claudio
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/Makefile4
-rw-r--r--usr.sbin/bgpctl/bgpctl.c20
2 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/bgpctl/Makefile b/usr.sbin/bgpctl/Makefile
index 71ace1ba13f..575a423e570 100644
--- a/usr.sbin/bgpctl/Makefile
+++ b/usr.sbin/bgpctl/Makefile
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile,v 1.9 2007/03/03 11:45:30 henning Exp $
+# $OpenBSD: Makefile,v 1.10 2007/12/20 17:08:48 henning Exp $
.PATH: ${.CURDIR}/../bgpd
PROG= bgpctl
-SRCS= bgpctl.c parser.c buffer.c imsg.c util.c
+SRCS= bgpctl.c parser.c buffer.c imsg.c util.c timer.c
SRCS+= irrfilter.c whois.c irr_asset.c irr_prefix.c irr_output.c
SRCS+= irr_parser.c
CFLAGS+= -Wall
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index c19df54bf06..83cb3e101e9 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.128 2007/10/15 02:16:35 deraadt Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.129 2007/12/20 17:08:48 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -54,7 +54,7 @@ int show_neighbor_msg(struct imsg *, enum neighbor_views);
void print_neighbor_capa_mp_safi(u_int8_t);
void print_neighbor_msgstats(struct peer *);
void print_neighbor_timers(struct peer *);
-void print_timer(const char *, time_t, u_int);
+void print_timer(const char *, struct peer *, enum Timer, u_int);
static char *fmt_timeframe(time_t t);
static char *fmt_timeframe_core(time_t t);
void show_fib_head(void);
@@ -681,22 +681,22 @@ print_neighbor_msgstats(struct peer *p)
void
print_neighbor_timers(struct peer *p)
{
- print_timer("IdleHoldTimer:", p->IdleHoldTimer, p->IdleHoldTime);
- print_timer("ConnectRetryTimer:", p->ConnectRetryTimer,
+ print_timer("IdleHoldTimer:", p, Timer_IdleHold, p->IdleHoldTime);
+ print_timer("ConnectRetryTimer:", p, Timer_ConnectRetry,
INTERVAL_CONNECTRETRY);
- print_timer("HoldTimer:", p->HoldTimer, (u_int)p->holdtime);
- print_timer("KeepaliveTimer:", p->KeepaliveTimer, (u_int)p->holdtime/3);
+ print_timer("HoldTimer:", p, Timer_Hold, (u_int)p->holdtime);
+ print_timer("KeepaliveTimer:", p, Timer_Keepalive, (u_int)p->holdtime/3);
}
void
-print_timer(const char *name, time_t val, u_int interval)
+print_timer(const char *name, struct peer *p, enum Timer timer, u_int interval)
{
- int d;
+ time_t d;
+ int running = timer_running(p, timer, &d);
- d = val - time(NULL);
printf(" %-20s ", name);
- if (val == 0)
+ if (running == 0)
printf("%-20s", "not running");
else if (d <= 0)
printf("%-20s", "due");