summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2018-11-01 20:04:29 +0000
committerSami Kerola <kerolasa@iki.fi>2018-11-11 10:37:06 +0000
commit4df68046c86f343494fa285e949270d3a84be54d (patch)
tree949dcbc9b55f9045d94fb976af8604cbebaf85dd
parent01cb777d8a3b64dd754297e477f4eb7051392d40 (diff)
downloadiputils-4df68046c86f343494fa285e949270d3a84be54d.tar.gz
arping: use monotonic raw clock when measuring reply times
Raw clock is not subject of NTP or adjtime time changes that could distort measurements. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r--arping.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arping.c b/arping.c
index 63e2754..788933e 100644
--- a/arping.c
+++ b/arping.c
@@ -352,7 +352,7 @@ static int send_pack(struct run_state *ctl)
memcpy(p, &ctl->gdst, 4);
p += 4;
- clock_gettime(CLOCK_MONOTONIC, &now);
+ clock_gettime(CLOCK_MONOTONIC_RAW, &now);
err = sendto(ctl->socketfd, buf, p - buf, 0, (struct sockaddr *)HE, sll_len(ah->ar_hln));
if (err == p - buf) {
ctl->last = now;
@@ -407,7 +407,7 @@ static int recv_pack(struct run_state *ctl, unsigned char *buf, ssize_t len,
unsigned char *p = (unsigned char *)(ah + 1);
struct in_addr src_ip, dst_ip;
- clock_gettime(CLOCK_MONOTONIC, &ts);
+ clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
/* Filter out wild packets */
if (FROM->sll_pkttype != PACKET_HOST &&
@@ -955,7 +955,7 @@ static int event_loop(struct run_state *ctl)
perror("arping: timerfd_create failed");
return 1;
}
- if (clock_gettime(CLOCK_MONOTONIC, &now) == -1) {
+ if (clock_gettime(CLOCK_MONOTONIC_RAW, &now) == -1) {
perror("arping: clock_gettime failed");
return 1;
}