summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2019-11-28 10:40:29 +0000
committerflorian <florian@openbsd.org>2019-11-28 10:40:29 +0000
commitcc7bf8581cd6ae53e54aea7cc8c423e83d46c635 (patch)
tree7d4061765a03d2265eb64e2199dcb856bf041f96
parentParse out DA features. (diff)
downloadwireguard-openbsd-cc7bf8581cd6ae53e54aea7cc8c423e83d46c635.tar.xz
wireguard-openbsd-cc7bf8581cd6ae53e54aea7cc8c423e83d46c635.zip
show median RTT in unwindctl status
-rw-r--r--sbin/unwind/resolver.c3
-rw-r--r--sbin/unwind/resolver.h3
-rw-r--r--usr.sbin/unwindctl/unwindctl.c8
3 files changed, 10 insertions, 4 deletions
diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c
index ff1bf870ac6..b029c5ac897 100644
--- a/sbin/unwind/resolver.c
+++ b/sbin/unwind/resolver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.c,v 1.81 2019/11/28 10:02:44 florian Exp $ */
+/* $OpenBSD: resolver.c,v 1.82 2019/11/28 10:40:29 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -1691,6 +1691,7 @@ send_resolver_info(struct uw_resolver *res, pid_t pid)
cri.state = res->state;
cri.type = res->type;
cri.oppdot = res->oppdot;
+ cri.median = histogram_median(res->latest_histogram);
resolver_imsg_compose_frontend(IMSG_CTL_RESOLVER_INFO, pid, &cri,
sizeof(cri));
}
diff --git a/sbin/unwind/resolver.h b/sbin/unwind/resolver.h
index 12f8e7c79e5..27c712fe8ad 100644
--- a/sbin/unwind/resolver.h
+++ b/sbin/unwind/resolver.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.h,v 1.13 2019/11/28 10:02:44 florian Exp $ */
+/* $OpenBSD: resolver.h,v 1.14 2019/11/28 10:40:29 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -49,6 +49,7 @@ static const int64_t histogram_limits[] = {
struct ctl_resolver_info {
enum uw_resolver_state state;
enum uw_resolver_type type;
+ int64_t median;
int oppdot;
};
diff --git a/usr.sbin/unwindctl/unwindctl.c b/usr.sbin/unwindctl/unwindctl.c
index 9d4791bd795..680afd571aa 100644
--- a/usr.sbin/unwindctl/unwindctl.c
+++ b/usr.sbin/unwindctl/unwindctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unwindctl.c,v 1.17 2019/11/28 10:02:44 florian Exp $ */
+/* $OpenBSD: unwindctl.c,v 1.18 2019/11/28 10:40:29 florian Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -227,9 +227,13 @@ show_status_msg(struct imsg *imsg)
switch (imsg->hdr.type) {
case IMSG_CTL_RESOLVER_INFO:
cri = imsg->data;
- printf("%-10s %s%s\n", uw_resolver_type_str[cri->type],
+ printf("%-10s %s%s", uw_resolver_type_str[cri->type],
uw_resolver_state_str[cri->state],
cri->oppdot ? " (opportunistic DoT)" : "");
+ if (cri->median != INT64_MAX)
+ printf(" median RTT: %lldms\n", cri->median);
+ else
+ printf(" median RTT: N.A\n");
break;
case IMSG_CTL_AUTOCONF_RESOLVER_INFO:
cfi = imsg->data;