[PATCH 05/11] batctl: traceroute: probe the advertised maximum number of hops

Sven Eckelmann <[email protected]> Tue, 07 Jul 2026 20:46:47 +0200
Newsgroups org.open-mesh.lists.batman
Message-ID <[email protected]>
The hop loop stops when the TTL reaches TTL_MAX, so only 49 hops are probed
while the header line announces "50 hops max". A destination which is
exactly TTL_MAX hops away is reported as unreachable even though the last
probe was never sent.

Run the loop up to and including TTL_MAX.

Fixes: e1c83d9260e8 ("[batctl] traceroute utility updated to latest batman adv")
Signed-off-by: Sven Eckelmann <[email protected]>
---
 traceroute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/traceroute.c b/traceroute.c
index 975c9ff..76f0f80 100644
--- a/traceroute.c
+++ b/traceroute.c
@@ -123,7 +123,7 @@ static int traceroute(struct state *state, int argc, char **argv)
 	       dst_string, mac_string, TTL_MAX, sizeof(icmp_packet_out));
 
 	for (icmp_packet_out.ttl = 1;
-	     !dst_reached && icmp_packet_out.ttl < TTL_MAX;
+	     !dst_reached && icmp_packet_out.ttl <= TTL_MAX;
 	     icmp_packet_out.ttl++) {
 		return_mac = NULL;
 		bat_host = NULL;

-- 
2.47.3