m-lab / traceroute-caller

A sidecar service which runs traceroute after a connection closes
Apache License 2.0
18 stars 5 forks source link

Add fast-mda-traceroute to the Docker image #145

Closed maxmouchet closed 2 years ago

maxmouchet commented 2 years ago

This adds fast-mda-traceroute to the Docker image so that it can be called by traceroute-caller. @SaiedKazemi please let me know if this works for you!

This relies on caracal's precompiled binaries hosted on PyPI, so it should work out-of-the-box on x86_64 and aarch64 systems.

docker run --entrypoint fast-mda-traceroute traceroute-caller google.com
# [2022-04-01 16:50:57,106] [INFO] [fast_mda_traceroute] dst_addr=142.250.178.142 interface=eth0 probing_rate=100 buffer_size=1048576 instance_id=15406 integrity_check=True version=0.1.10
# [2022-04-01 16:50:57.107] [info] Resolving the gateway MAC address...
# [2022-04-01 16:50:57.145] [info] dst_mac=02:42:e5:36:74:22
# [2022-04-01 16:50:57.145] [info] src_ip_v4=172.17.0.2 src_ip_v6=::
# [2022-04-01 16:50:57.177] [info] sniffer_filter=(dst 172.17.0.2) and (icmp or icmp6) and (icmp[icmptype] = icmp-echoreply or icmp[icmptype] = icmp-timxceed or icmp[icmptype] = icmp-unreach or icmp6[icmp6type] = icmp6-echoreply or icmp6[icmp6type] = icmp6-timeexceeded or icmp6[icmp6type] = icmp6-destinationunreach)
# [2022-04-01 16:50:57,263] [INFO] [fast_mda_traceroute] round=1 links_found=0 probes=32 expected_time=0.3s
# [2022-04-01 16:50:58,595] [INFO] [fast_mda_traceroute] round=2 links_found=10 probes=50 expected_time=0.5s
# [2022-04-01 16:51:00,100] [INFO] [fast_mda_traceroute] round=3 links_found=10 probes=0 expected_time=0.0s
#   TTL    Src. port    Dst. port  Probe IP         Reply IP         RTT     MPLS label stack
# -----  -----------  -----------  ---------------  ---------------  ------  ------------------
#     1        24000            0  142.250.178.142  172.17.0.1       0.1ms   []
#     1        24004            0  142.250.178.142  172.17.0.1       0.1ms   []
#     1        24005            0  142.250.178.142  172.17.0.1       0.0ms   []
#     1        24002            0  142.250.178.142  172.17.0.1       0.0ms   []
#     1        24003            0  142.250.178.142  172.17.0.1       0.1ms   []
#     1        24001            0  142.250.178.142  172.17.0.1       0.1ms   []
#     ...
#    10        24000            0  142.250.178.142  108.170.244.193  1.3ms   []
#    10        24005            0  142.250.178.142  108.170.244.193  1.3ms   []
#    10        24002            0  142.250.178.142  108.170.244.193  1.5ms   []
#    10        24003            0  142.250.178.142  108.170.244.193  1.3ms   []
#    10        24001            0  142.250.178.142  108.170.244.193  1.2ms   []
#    10        24004            0  142.250.178.142  108.170.244.193  1.2ms   []
#    11        24000            0  142.250.178.142  142.251.64.129   1.2ms   []

This change is Reviewable

coveralls commented 2 years ago

Pull Request Test Coverage Report for Build 485


Totals Coverage Status
Change from base Build 484: 0.0%
Covered Lines: 626
Relevant Lines: 646

💛 - Coveralls
SaiedKazemi commented 2 years ago

@maxmouchet Thank you for the PR. I will review and comment soon.

SaiedKazemi commented 2 years ago

@maxmouchet I did a quick hack to run fast-mda-traceroute instead of scamper and the result is very promising :)

scamper.go:171: context 0xc0000b2000: command started: /usr/local/bin/fast-mda-traceroute --format scamper-json 91.189.91.38
scamper.go:171: context 0xc0000b2cc0: command started: /usr/local/bin/fast-mda-traceroute --format scamper-json 185.125.190.36
scamper.go:175: context 0xc0000b2000: command finished in 3.107314684 seconds 
scamper.go:191: context 0xc0000b2000: command succeeded 
scamper.go:175: context 0xc0000b2cc0: command finished in 3.111992665 seconds 
scamper.go:191: context 0xc0000b2cc0: command succeeded 

I need to discuss including python3-pip and pre-built binaries in the traceroute-caller image with @stephen-soltesz and decide the next steps.

maxmouchet commented 2 years ago

@SaiedKazemi super ! :-)

Regarding caracal's Python extension, it's possible to build it in a separate stage but this can take some time (caracal/runs/5481874842 suggests around 5 minutes without caching).

See caracal/Dockerfile to get an idea of the build dependencies (for the main binary, but they are similar for the Python extension).

SaiedKazemi commented 2 years ago

Sorry for the delay (due to other priorities) in any updates for this PR.

We will discuss the next steps when we meet in person next week.

maxmouchet commented 2 years ago

@SaiedKazemi I updated the Dockerfile to build caracal's Python extension from source, instead of pulling the precompiled binary from PyPI. Image build time is around 3 minutes.

SaiedKazemi commented 2 years ago

@maxmouchet Thank you for this PR. As we discussed offline, I will be out the next two weeks and will work on this as soon as I am back.

SaiedKazemi commented 2 years ago

@maxmouchet I have prepared traceroute-caller source code for merging this PR. Can you please rebase this PR? Should rebase without any issues.

maxmouchet commented 2 years ago

Done!