fujiapple852 / trippy

A network diagnostic tool
https://trippy.cli.rs
Apache License 2.0
3.2k stars 67 forks source link

Change default port for udp tracing #1203

Open fujiapple852 opened 1 week ago

fujiapple852 commented 1 week ago

For udp tracing, by default Trippy uses a fixed src port which is set from the process id and a variable dest port which is set from the sequence number, starting from 33000 and incremented for each probe, eventually wrapping at 64511 (which is u16::MAX - 2x the maximum sequence per round, gives 65535 - (512 * 2) = 64511).

By convention, many devices on the internet allow probes to ports in the range (33434..=33534) and will return an DestinationUnreachable ICMP error which can be used by traceroute to confirm that the target has ben reached.

Therefore, given Trippy does not by default use dest ports in this range for udp probes, they do not respond with any ICMP error and so Trippy cannot see that the target was reached and must therefore show the hop as unknown.

The options here are:

Note: a probe "re-issue" occurs when a probe cannot be dispatched as the socket cannot be bound to a given local socket address, typically as the port is already in use. In such cases Trippy will "skip" the problematic port and "re-issue" the probe with the next sequence number. In reality this is only an issue for tcp probes (which use variable src ports that must be bound to the socket) but may also effect udp for non-raw mode.