Skip to content

fix: replace busybox traceroute with APK version#208

Merged
thespad merged 1 commit intolinuxserver:masterfrom
MattKobayashi:fix/install-traceroute
Dec 26, 2025
Merged

fix: replace busybox traceroute with APK version#208
thespad merged 1 commit intolinuxserver:masterfrom
MattKobayashi:fix/install-traceroute

Conversation

@MattKobayashi
Copy link
Contributor

@MattKobayashi MattKobayashi commented Dec 17, 2025

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

Replace the busybox traceroute binary with the more fully-featured one available in the community APK repository.

Benefits of this PR and context:

This allows the tcpping script to leverage traceroute instead of falling back to tcptraceroute. tcptraceroute has some strange issues with certain types of responses, notably an unexplained delay in processing responses from specific targets:

$ docker compose exec --user abc smokeping time /usr/bin/tcpping -Czx 25 speedtest.qld.edgeix.net.au 8080
traceroute does not support -M parameter, switching to tcptraceroute
/usr/bin/tcptraceroute -f 255 -m 255 -q 1 -w 1  speedtest.qld.edgeix.net.au 8080
speedtest.qld.edgeix.net.au : 4.045 7.251 13.231 9.323 11.507 10.339 8.279 8.171 4.429 5.751 5.520 8.590 4.451 11.315 11.588 5.221 5.022 4.892 6.489 4.892 4.753 4.527 10.546 5.053 10.615

real	4m 29.37s
user	0m 0.16s
sys	0m 0.11s

Running tcptraceroute directly with the -d flag reveals that each execution of tcptraceroute against this target takes 10 seconds, although the response is received much faster than that:

$ docker compose exec --user abc smokeping time /usr/bin/tcptraceroute -f 255 -m 255 -q 1 -w 1 -d -A speedtest.qld.edgeix.net.au 8080
debug: tcptraceroute 1.5beta7, x86_64-alpine-linux-musl
debug: Compiled with libpcap 1.10.5, libnet 1.3 (API 110)
debug: o_ack set
debug: entering getinterfaces()
debug: ifreq buffer set to 32
debug: Successfully retrieved interface list
debug: Discovered interface lo with address 127.0.0.1
debug: Discovered interface eth0 with address 10.5.1.25
debug: Discovered interface eth1 with address 192.168.0.25
debug: leaving getinterfaces()
debug: Determined source address of 192.168.0.25 to reach 103.215.15.11
debug: entering finddev()
debug: finddev() returning eth1
debug: debugoptions():
debug:         TEXTSIZE: 1024        SNAPLEN: 92     IPTOSBUFFERS: 12
debug: ALLOCATEID_CACHE: 512        datalink: 1    datalinkoffset: 14
debug:         o_minttl: 255         o_maxttl: 255        o_timeout: 1
debug:          o_debug: 1         o_numeric: 0          o_pktlen: 0
debug:       o_nqueries: 1        o_dontfrag: 0             o_tos: 0
debug:      o_forceport: 0             o_syn: 0             o_ack: 1
debug:            o_ecn: 0        o_nofilter: 0 o_nogetinterfaces: 0
debug:      o_trackport: 0      datalinkname: ETHERNET     device: eth1
debug:       o_noselect: 0            o_dnat: 0               isn: 1019473394
Selected device eth1, address 192.168.0.25, port 42173 for outgoing packets
debug: pcap filter is:
		(tcp and src host 103.215.15.11 and src port 8080 and dst host 192.168.0.25)
		or ((icmp[0] == 11 or icmp[0] == 3) and dst host 192.168.0.25)
Tracing the path to speedtest.qld.edgeix.net.au (103.215.15.11) on TCP port 8080 (http-alt), 255 hops max
debug: Generating a new batch of 512 IP ID's
debug: Sent probe 1 of 1 for hop 255, IP ID 39778, source port 42173, ACK
debug: received 46 byte IP packet from pcap_next()
debug: Received TCP packet
debug: Received TCP packet 103.215.15.11:8080 -> 192.168.0.25:42173, flags RST
debug: displayed hop
255  103.215.15.11 [closed]  5.529 ms

real	0m 10.10s
user	0m 0.00s
sys	0m 0.00s

tcptraceroute is also effectively unmaintained. The latest release (and the one available in the image) is v1.5beta7, released in 2006, and there have been no commits to the repository since 2017, so I'm not expecting any bugs to be fixed any time soon. I've elected to keep the installation of tcptraceroute in the Dockerfile despite this, to avoid breaking any configurations in the wild that explicitly rely on its presence.

How Has This Been Tested?

I installed the updated traceroute binary in an existing docker-smokeping container using apk -U add traceroute and gave the binary setuid access with chmod a+s /usr/bin/traceroute. A test of tcpping using the -z flag shows the correct binary and flags being used:

$ docker compose exec --user abc smokeping time /usr/bin/tcpping -Czx 25 speedtest.qld.edgeix.net.au 8080
/usr/bin/traceroute -M tcp -f 255 -m 255 -q 1 -w 1  -p 8080 speedtest.qld.edgeix.net.au
speedtest.qld.edgeix.net.au : 10.830 6.358 9.224 6.599 5.644 12.996 9.713 4.803 4.589 4.373 4.332 6.743 5.734 6.043 10.443 5.303 13.648 14.440 4.685 4.452 4.590 5.220 9.463 9.294 5.290

real	0m 17.85s
user	0m 0.14s
sys	0m 0.10s

Source / References:

@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/smokeping/2.9.0-r0-pkg-351919b3-dev-d76908f9d1f3aa8926ab898010777ce6cd1ac017-pr-208/index.html
https://ci-tests.linuxserver.io/lspipepr/smokeping/2.9.0-r0-pkg-351919b3-dev-d76908f9d1f3aa8926ab898010777ce6cd1ac017-pr-208/shellcheck-result.xml

Tag Passed
amd64-2.9.0-r0-pkg-351919b3-dev-d76908f9d1f3aa8926ab898010777ce6cd1ac017-pr-208
arm64v8-2.9.0-r0-pkg-351919b3-dev-d76908f9d1f3aa8926ab898010777ce6cd1ac017-pr-208

@LinuxServer-CI
Copy link
Collaborator

I am a bot, here are the test results for this PR:
https://ci-tests.linuxserver.io/lspipepr/smokeping/2.9.0-r0-pkg-351919b3-dev-464fdf5b2d920d58e353732bf1cde533d16d6379-pr-208/index.html
https://ci-tests.linuxserver.io/lspipepr/smokeping/2.9.0-r0-pkg-351919b3-dev-464fdf5b2d920d58e353732bf1cde533d16d6379-pr-208/shellcheck-result.xml

Tag Passed
amd64-2.9.0-r0-pkg-351919b3-dev-464fdf5b2d920d58e353732bf1cde533d16d6379-pr-208
arm64v8-2.9.0-r0-pkg-351919b3-dev-464fdf5b2d920d58e353732bf1cde533d16d6379-pr-208

@nasaboy
Copy link

nasaboy commented Dec 20, 2025

My tests still show some problems, although there has been some improvement.

root@KR-SEOUL:/# traceroute -V
Modern traceroute for Linux, version 2.1.6
Copyright (c) 2016  Dmitry Butskoy,   License: GPL v2 or any later

root@KR-SEOUL:/# time /usr/bin/tcpping -Czx 25 speedtest.qld.edgeix.net.au 8080
/usr/bin/traceroute -M tcp -f 255 -m 255 -q 1 -w 1  -p 8080 speedtest.qld.edgeix.net.au
speedtest.qld.edgeix.net.au : 170.601 167.238 170.701 170.659 170.691 170.502 171.038 170.537 170.836 170.667 170.674 170.892 167.140 170.804 167.249 170.808 170.547 167.301 170.518 166.747 166.978 167.204 170.697 167.203 167.086
real    2m27.076s
user    0m0.252s
sys     0m0.575s

@MattKobayashi
Copy link
Contributor Author

@nasaboy could you please elaborate on what you perceive the remaining problem(s) to be? I'm not seeing anything wrong with your output.

@nasaboy
Copy link

nasaboy commented Dec 20, 2025

@MattKobayashi The time taken for 25 tests shouldn't be as long as 2m27.076s,I see your 25 tests only took 17 seconds.

@MattKobayashi
Copy link
Contributor Author

@nasaboy my 25 tests were also a much lower RTT than yours. Please take the time to educate yourself on how this tool works before commenting, thank you.

@nasaboy
Copy link

nasaboy commented Dec 20, 2025

Okay, you're absolutely right; this tool does exhibit this behavior. However, using tcping works correctly.Hopefully, this pull request will be merged soon.

@nasaboy
Copy link

nasaboy commented Dec 26, 2025

@thespad Please take some time to review this pull request.

@github-project-automation github-project-automation bot moved this from PRs to PRs Approved in Issue & PR Tracker Dec 26, 2025
@thespad
Copy link
Member

thespad commented Dec 26, 2025

Provisionally merging this, but will need to monitor for any issues.

@thespad thespad merged commit c17001a into linuxserver:master Dec 26, 2025
3 checks passed
@LinuxServer-CI LinuxServer-CI moved this from PRs Approved to Done in Issue & PR Tracker Dec 26, 2025
@r2ixuz
Copy link

r2ixuz commented Dec 26, 2025

Just add -n as default to the traceroute. There is no need for reverse lookup every single hop...

@nasaboy
Copy link

nasaboy commented Dec 27, 2025

Just add -n as default to the traceroute. There is no need for reverse lookup every single hop...

Amazing, it really works! The time taken was reduced from 2 minutes to 22 seconds.

root@KR-SEOUL:/# time tcpping -z -C -x 25 speedtest.qld.edgeix.net.au 8080
/usr/bin/traceroute -n -M tcp -f 255 -m 255 -q 1 -w 1  -p 8080 speedtest.qld.edgeix.net.au
speedtest.qld.edgeix.net.au : 192.190 200.244 200.352 200.137 192.297 202.917 194.470 192.181 192.171 192.177 194.593 202.456 194.679 202.806 200.306 200.221 192.022 202.943 200.187 191.961 194.489 200.464 192.098 200.194 200.538
real    0m22.751s
user    0m0.320s
sys     0m0.625s

@nasaboy
Copy link

nasaboy commented Dec 27, 2025

I tested tcpping v2.7 and found that it actually includes the -n parameter, it just wasn't displayed in the help message (-h). With this parameter added, the test time using tcptraceroute will be normal.

@MattKobayashi MattKobayashi deleted the fix/install-traceroute branch December 28, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants

Comments