diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-01-22 13:38:52 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-01-23 14:29:44 +0100 |
commit | c870c7af53f44a37814dfc76ceb8ad88e290fcd8 (patch) | |
tree | 82f0ceef7f1bb33d63774be97f432ed9b99d9ec3 /src/tools | |
parent | contrib: introduce simple highlighter library (diff) | |
download | wireguard-monolithic-historical-c870c7af53f44a37814dfc76ceb8ad88e290fcd8.tar.xz wireguard-monolithic-historical-c870c7af53f44a37814dfc76ceb8ad88e290fcd8.zip |
netlink: use __kernel_timespec for handshake time
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/containers.h | 8 | ||||
-rw-r--r-- | src/tools/ipc.c | 4 | ||||
-rw-r--r-- | src/tools/show.c | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/tools/containers.h b/src/tools/containers.h index 2144052..59a213e 100644 --- a/src/tools/containers.h +++ b/src/tools/containers.h @@ -15,6 +15,12 @@ #include "../uapi/wireguard.h" +/* Cross platform __kernel_timespec */ +struct timespec64 { + int64_t tv_sec; + int64_t tv_nsec; +}; + struct wgallowedip { uint16_t family; union { @@ -45,7 +51,7 @@ struct wgpeer { struct sockaddr_in6 addr6; } endpoint; - struct timespec last_handshake_time; + struct timespec64 last_handshake_time; uint64_t rx_bytes, tx_bytes; uint16_t persistent_keepalive_interval; diff --git a/src/tools/ipc.c b/src/tools/ipc.c index da31eff..7ab3a62 100644 --- a/src/tools/ipc.c +++ b/src/tools/ipc.c @@ -420,9 +420,9 @@ static int userspace_get_device(struct wgdevice **out, const char *interface) if (*end || allowedip->family == AF_UNSPEC || (allowedip->family == AF_INET6 && allowedip->cidr > 128) || (allowedip->family == AF_INET && allowedip->cidr > 32)) break; } else if (peer && !strcmp(key, "last_handshake_time_sec")) - peer->last_handshake_time.tv_sec = NUM(0xffffffffffffffffULL); + peer->last_handshake_time.tv_sec = NUM(0x7fffffffffffffffULL); else if (peer && !strcmp(key, "last_handshake_time_nsec")) - peer->last_handshake_time.tv_nsec = NUM(0xffffffffffffffffULL); + peer->last_handshake_time.tv_nsec = NUM(0x7fffffffffffffffULL); else if (peer && !strcmp(key, "rx_bytes")) peer->rx_bytes = NUM(0xffffffffffffffffULL); else if (peer && !strcmp(key, "tx_bytes")) diff --git a/src/tools/show.c b/src/tools/show.c index ba6f115..4cc34ab 100644 --- a/src/tools/show.c +++ b/src/tools/show.c @@ -155,7 +155,7 @@ static size_t pretty_time(char *buf, const size_t len, unsigned long long left) return offset; } -static char *ago(const struct timespec *t) +static char *ago(const struct timespec64 *t) { static char buf[1024]; size_t offset; |