TL;DR By default, it starts at 33000 and goes up.
You can observe it if you run a network trace at the same time:
tcpdump -i any -n host 8.8.8.8 &
mtr -u --report -c 1 8.8.8.8
21:21:50.777482 IP [redacted].31507 > 8.8.8.8.33000: UDP, length 36
21:21:50.877579 IP [redacted].31507 > 8.8.8.8.33001: UDP, length 36
21:21:50.977694 IP [redacted].31507 > 8.8.8.8.33002: UDP, length 36
21:21:51.077850 IP [redacted].31507 > 8.8.8.8.33003: UDP, length 36
21:21:51.177966 IP [redacted].31507 > 8.8.8.8.33004: UDP, length 36
21:21:51.278081 IP [redacted].31507 > 8.8.8.8.33005: UDP, length 36
21:21:51.378198 IP [redacted].31507 > 8.8.8.8.33006: UDP, length 36
21:21:51.478341 IP [redacted].31507 > 8.8.8.8.33007: UDP, length 36
21:21:51.578498 IP [redacted].31507 > 8.8.8.8.33008: UDP, length 36
21:21:51.678646 IP [redacted].31507 > 8.8.8.8.33009: UDP, length 36
21:21:51.778801 IP [redacted].31507 > 8.8.8.8.33010: UDP, length 36
21:21:51.878949 IP [redacted].31507 > 8.8.8.8.33011: UDP, length 36
21:21:51.979117 IP [redacted].31507 > 8.8.8.8.33012: UDP, length 36
Here is why in the code.
The source code is at https://github.com/traviscross/mtr
If you analyze it, you observe the different behavior between TCP and UDP during parsing of command line arguments:
case 'u':
if (ctl->mtrtype != IPPROTO_ICMP) {
error(EXIT_FAILURE, 0,
"-u , -T and -S are mutually exclusive");
}
ctl->mtrtype = IPPROTO_UDP;
break;
case 'T':
if (ctl->mtrtype != IPPROTO_ICMP) {
error(EXIT_FAILURE, 0,
"-u , -T and -S are mutually exclusive");
}
if (!ctl->remoteport) {
ctl->remoteport = 80;
}
ctl->mtrtype = IPPROTO_TCP;
So no port is set by default for UDP, where it is 80
by default for TCP.
mtr.h
has
#define MinPort 1024
#define MaxPort 65535
but this is misleading, the true stuff happens in ui/net.c
.
net_send_query
calls new_sequence
- and the results is passed among other things to
send_probe_command
new_sequence
in this file has static int next_sequence = MinSequence;
Now, after a lot of hops you arrive in set_udp_ports
which has:
if (param->dest_port) {
...
} else {
udp->dstport = htons(sequence);
In short, the "sequence" number is really the UDP destination port.
And if we go back at ui/net.c
we see it is defined as:
#define MinSequence 33000
#define MaxSequence 65536