iputils/backport-tracepath-Dont-assume-tv_sec-0-means-unset.patch
2025-02-13 06:19:15 +00:00

33 lines
1.1 KiB
Diff

From c64bcd8d8eca5c7f66e75e0bc9d42828bc09ba1b Mon Sep 17 00:00:00 2001
From: Josh Triplett <josh@joshtriplett.org>
Date: Mon, 20 Nov 2023 19:15:40 -0800
Subject: [PATCH] tracepath: Don't assume tv_sec == 0 means unset
A CLOCK_MONOTONIC timespec's tv_sec value can legitimately be 0 during
the second after booting. Check tv_nsec as well before assuming an unset
timestamp.
Closes: https://github.com/iputils/iputils/pull/499
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Conflict:NA
Reference:https://github.com/iputils/iputils/commit/c64bcd8d8eca5c7f66e75e0bc9d42828bc09ba1b
---
tracepath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tracepath.c b/tracepath.c
index 04d77b83..046dc332 100644
--- a/tracepath.c
+++ b/tracepath.c
@@ -192,7 +192,7 @@ static int recverr(struct run_state *const ctl)
ctl->his[slot].hops = 0;
}
if (recv_size == sizeof(rcvbuf)) {
- if (rcvbuf.ttl == 0 || rcvbuf.ts.tv_sec == 0)
+ if (rcvbuf.ttl == 0 || (rcvbuf.ts.tv_sec == 0 && rcvbuf.ts.tv_nsec == 0))
broken_router = 1;
else {
sndhops = rcvbuf.ttl;