summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bgpctl
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2019-12-31 14:09:27 +0000
committerclaudio <claudio@openbsd.org>2019-12-31 14:09:27 +0000
commitcc406fb9ef2fb69c377ad3a1b5e24b616ea418ab (patch)
tree8a0449518d3937f6eb6d184e07c8345539e47080 /usr.sbin/bgpctl
parentplug memory leak (diff)
downloadwireguard-openbsd-cc406fb9ef2fb69c377ad3a1b5e24b616ea418ab.tar.xz
wireguard-openbsd-cc406fb9ef2fb69c377ad3a1b5e24b616ea418ab.zip
Rename print_timer() to show_timer() and move it to output.c
Currently this needs a bit of a hack because fmt_timeframe() does not really print a timeframe but instead needs a timestamp relative to now. This needs to be adjusted but will be done later.
Diffstat (limited to 'usr.sbin/bgpctl')
-rw-r--r--usr.sbin/bgpctl/bgpctl.c16
-rw-r--r--usr.sbin/bgpctl/bgpctl.h1
-rw-r--r--usr.sbin/bgpctl/output.c13
3 files changed, 15 insertions, 15 deletions
diff --git a/usr.sbin/bgpctl/bgpctl.c b/usr.sbin/bgpctl/bgpctl.c
index 96527b41658..a4e12576d1c 100644
--- a/usr.sbin/bgpctl/bgpctl.c
+++ b/usr.sbin/bgpctl/bgpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpctl.c,v 1.254 2019/12/20 09:16:05 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.255 2019/12/31 14:09:27 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -46,7 +46,6 @@
int main(int, char *[]);
int show(struct imsg *, struct parse_result *);
-void print_timer(const char *, time_t);
void show_attr(void *, u_int16_t, int);
void show_communities(u_char *, size_t, int);
void show_community(u_char *, u_int16_t);
@@ -405,7 +404,7 @@ show(struct imsg *imsg, struct parse_result *res)
case IMSG_CTL_SHOW_TIMER:
t = imsg->data;
if (t->type > 0 && t->type < Timer_Max)
- print_timer(timernames[t->type], t->val);
+ show_timer(t);
break;
case IMSG_CTL_SHOW_INTERFACE:
iface = imsg->data;
@@ -645,17 +644,6 @@ fmt_timeframe(time_t t)
}
void
-print_timer(const char *name, time_t d)
-{
- printf(" %-20s ", name);
-
- if (d <= 0)
- printf("%-20s\n", "due");
- else
- printf("due in %-13s\n", fmt_timeframe_core(d));
-}
-
-void
show_fib_flags(u_int16_t flags)
{
if (flags & F_DOWN)
diff --git a/usr.sbin/bgpctl/bgpctl.h b/usr.sbin/bgpctl/bgpctl.h
index 59ed69b2b2e..7f25ffd892e 100644
--- a/usr.sbin/bgpctl/bgpctl.h
+++ b/usr.sbin/bgpctl/bgpctl.h
@@ -17,6 +17,7 @@
struct parse_result;
void show_head(struct parse_result *);
void show_neighbor(struct peer *, struct parse_result *);
+void show_timer(struct ctl_timer *);
void show_fib(struct kroute_full *);
void show_fib_table(struct ktable *);
void show_nexthop(struct ctl_show_nexthop *);
diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c
index 5033bb033fd..f18cb407775 100644
--- a/usr.sbin/bgpctl/output.c
+++ b/usr.sbin/bgpctl/output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: output.c,v 1.1 2019/12/20 09:16:05 claudio Exp $ */
+/* $OpenBSD: output.c,v 1.2 2019/12/31 14:09:27 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -281,6 +281,17 @@ show_neighbor(struct peer *p, struct parse_result *res)
}
void
+show_timer(struct ctl_timer *t)
+{
+ printf(" %-20s ", timernames[t->type]);
+
+ if (t->val <= 0)
+ printf("%-20s\n", "due");
+ else
+ printf("due in %-13s\n", fmt_timeframe(time(NULL) - t->val));
+}
+
+void
show_fib(struct kroute_full *kf)
{
char *p;