aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2019-08-14 16:45:09 +0000
committerAlan Somers <asomers@FreeBSD.org>2019-08-14 16:45:09 +0000
commit84633ef14a7a76ae2325f814d01ceadeae96753d (patch)
treef2f9ebbb5ec023f84c8a29d395fae557edb4848c /sbin
parent97be8b969d2930b8c56da49e1d871d0a0cb4a6bc (diff)
downloadsrc-84633ef14a7a76ae2325f814d01ceadeae96753d.tar.gz
src-84633ef14a7a76ae2325f814d01ceadeae96753d.zip
ping: fix triptime calculation after r350998
That revision changed the internal clock to the monotonic, but neglected to change the datagram's timestamp source. Reported by: Oliver Hartmann, Michael Butler Reviewed by: Ján Sučan <sucanjan@gmail.com>, allanjude MFC after: 2 weeks MFC-With: r350998 Differential Revision: https://reviews.freebsd.org/D21258
Notes
Notes: svn path=/head/; revision=351030
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ping/ping.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index e39b1520a017..3ad92ad2da96 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -760,9 +760,15 @@ main(int argc, char *const *argv)
}
}
#ifdef SO_TIMESTAMP
- { int on = 1;
- if (setsockopt(srecv, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on)) < 0)
- err(EX_OSERR, "setsockopt SO_TIMESTAMP");
+ {
+ int on = 1;
+ int ts_clock = SO_TS_MONOTONIC;
+ if (setsockopt(srecv, SOL_SOCKET, SO_TIMESTAMP, &on,
+ sizeof(on)) < 0)
+ err(EX_OSERR, "setsockopt SO_TIMESTAMP");
+ if (setsockopt(srecv, SOL_SOCKET, SO_TS_CLOCK, &ts_clock,
+ sizeof(ts_clock)) < 0)
+ err(EX_OSERR, "setsockopt SO_TS_CLOCK");
}
#endif
if (sweepmax) {