summaryrefslogtreecommitdiff
path: root/usr.sbin/slaacctl
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2017-05-28 09:35:57 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2017-05-28 09:35:57 +0000
commit854a882f1142bb4fee2882bb7f20d3a143d93c1a (patch)
treec4dcaf832e326cc7b84a16c3f3451d17931d9a2e /usr.sbin/slaacctl
parent72287614c427ec01dfccecc057a936574bb8933e (diff)
propose and configure default gateway
Diffstat (limited to 'usr.sbin/slaacctl')
-rw-r--r--usr.sbin/slaacctl/slaacctl.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/usr.sbin/slaacctl/slaacctl.c b/usr.sbin/slaacctl/slaacctl.c
index 5d2e8df619b..51b4e947f47 100644
--- a/usr.sbin/slaacctl/slaacctl.c
+++ b/usr.sbin/slaacctl/slaacctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slaacctl.c,v 1.5 2017/05/27 18:37:09 florian Exp $ */
+/* $OpenBSD: slaacctl.c,v 1.6 2017/05/28 09:35:56 florian Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -175,6 +175,7 @@ show_interface_msg(struct imsg *imsg)
struct ctl_engine_info_ra_rdns *cei_ra_rdns;
struct ctl_engine_info_ra_dnssl *cei_ra_dnssl;
struct ctl_engine_info_address_proposal *cei_addr_proposal;
+ struct ctl_engine_info_dfr_proposal *cei_dfr_proposal;
struct tm *t;
struct timespec now, diff;
char buf[IF_NAMESIZE], *bufp;
@@ -278,6 +279,34 @@ show_interface_msg(struct imsg *imsg)
&cei_addr_proposal->prefix, ntopbuf, INET6_ADDRSTRLEN),
cei_addr_proposal->prefix_len);
break;
+ case IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSALS:
+ printf("\tDefault router proposals\n");
+ break;
+ case IMSG_CTL_SHOW_INTERFACE_INFO_DFR_PROPOSAL:
+ cei_dfr_proposal = imsg->data;
+
+ if (getnameinfo((struct sockaddr *)&cei_dfr_proposal->addr,
+ cei_dfr_proposal->addr.sin6_len, hbuf, sizeof(hbuf),
+ NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV))
+ err(1, "cannot get router IP");
+
+ printf("\t\tid: %4lld, state: %15s\n",
+ cei_dfr_proposal->id, cei_dfr_proposal->state);
+ printf("\t\trouter lifetime: %10u\n",
+ cei_dfr_proposal->router_lifetime);
+ printf("\t\tPreference: %s\n", cei_dfr_proposal->rpref);
+ if (clock_gettime(CLOCK_MONOTONIC, &now))
+ err(1, "clock_gettime");
+
+ timespecsub(&now, &cei_dfr_proposal->uptime, &diff);
+
+ t = localtime(&cei_dfr_proposal->when.tv_sec);
+ strftime(whenbuf, sizeof(whenbuf), "%F %T", t);
+ printf("\t\tupdated: %s.%09ld; %lld.%09lds ago\n",
+ whenbuf, cei_dfr_proposal->when.tv_nsec, diff.tv_sec,
+ diff.tv_nsec);
+
+ break;
case IMSG_CTL_END:
printf("\n");
return (1);