[PATCH 01/11] batctl: traceroute: return EXIT_NOSUCCESS when destination not reached
Sven Eckelmann <[email protected]> Tue, 07 Jul 2026 20:46:43 +0200
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <[email protected]> |
traceroute sets ret to EXIT_SUCCESS unconditionally once the probe loop
finishes. dst_reached is only set on an actual echo reply, so when the
target never answers within TTL_MAX hops, it is unreachable or all
probes time out. But this information is ignored when traceroute exits. A
script will not be able to distinguish a failed and working traceroute.
Use the same error codes as the ping but make it depend on the dst_reached
variable.
Fixes: e1c83d9260e8 ("[batctl] traceroute utility updated to latest batman adv")
Signed-off-by: Sven Eckelmann <[email protected]>
---
traceroute.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/traceroute.c b/traceroute.c
index 441cd77..94443d7 100644
--- a/traceroute.c
+++ b/traceroute.c
@@ -212,7 +212,10 @@ static int traceroute(struct state *state, int argc, char **argv)
printf("\n");
}
- ret = EXIT_SUCCESS;
+ if (dst_reached)
+ ret = EXIT_SUCCESS;
+ else
+ ret = EXIT_NOSUCCESS;
out:
icmp_interfaces_clean();
--
2.47.3