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
This commit is contained in:
Alan Somers 2019-08-14 16:45:09 +00:00
parent 97be8b969d
commit 84633ef14a

View File

@ -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) {