russor [Thu, 25 Feb 2016 22:31:58 +0000 (14:31 -0800)]
allow setting local and remote port for UDP probing
This allows for testing over a single network path in a load balanced
network where flows are hashed on the ips and ports (relatively common), the
default behavior is to use the destination port as the sequence number when
doing UDP probes, so you see (more or less) an average of all the paths.
If the remote port is set, we need to use the checksum field to store
sequence and adjust the paylod so the checksum is valid; therefore we need
to have the source address, as it's part of the checksum calculation. We
also need to increase the minimum packet size so we have at least 2 bytes of
payload.
Fix setting length field of UDP header to broken value on BSD systems.
As per http://stackoverflow.com/a/15881825 which references the manpage
ip(4) on *BSD and MacOSX:
"The ip_len and ip_off fields must be provided in host byte order.
All other fields must be provided in network byte order."
Before this commit, mtr would incorrectly set the length field of the UDP
header in host byte order after the first packet, as can be witnessed in
the following excerpt:
1st packet (TTL=1):
IP (tos 0x0, ttl 1, id 51530, offset 0, flags [none], proto UDP (17), length 64)
192.168.178.61.1143 > 8.8.8.8.33000: UDP, *** length 36 ***
IP (tos 0xc0, ttl 64, id 34040, offset 0, flags [none], proto ICMP (1), length 92)
192.168.178.1 > 192.168.178.61: ICMP time exceeded in-transit, length 72
IP (tos 0x0, ttl 1, id 51530, offset 0, flags [none], proto UDP (17), length 64)
192.168.178.61.1143 > 8.8.8.8.33000: UDP, length 36
2nd packet (TTL=2):
IP (tos 0x0, ttl 2, id 17256, offset 0, flags [none], proto UDP (17), length 64)
192.168.178.61.1143 > 8.8.8.8.33001: UDP, *** bad length 11256 > 36 ***
IP (tos 0xc0, ttl 254, id 6765, offset 0, flags [none], proto ICMP (1), length 56)
62.52.201.192 > 192.168.178.61: ICMP time exceeded in-transit, length 36
IP (tos 0x0, ttl 1, id 17256, offset 0, flags [none], proto UDP (17), length 64)
192.168.178.61.1143 > 8.8.8.8.33001: UDP, bad length 11256 > 36
3rd packet (TTL=3):
IP (tos 0x0, ttl 3, id 54343, offset 0, flags [none], proto UDP (17), length 64)
192.168.178.61.1143 > 8.8.8.8.33002: UDP, *** bad length 11256 > 36 ***
IP (tos 0x0, ttl 253, id 0, offset 0, flags [none], proto ICMP (1), length 56)
62.53.22.220 > 192.168.178.61: ICMP time exceeded in-transit, length 36
IP (tos 0x0, ttl 1, id 54343, offset 0, flags [none], proto UDP (17), length 64)
192.168.178.61.1143 > 8.8.8.8.33002: UDP, bad length 11256 > 36
Remove a warning message at compile time.
Warning was produced when running:
$ ./configure --without-gtk
$ make
display.c: In function ‘display_keyaction’:
display.c:169:5: warning: ‘return’ with no value, in function returning non-void [-Wreturn-type]
return mtr_curses_keyaction();
^
Gareth Randall [Tue, 9 Dec 2014 13:16:32 +0000 (13:16 +0000)]
Corrected the "without gtk" reference to "./configure --without-gtk", because the previous version "--WITHOUT_GTK" caused an error.
The error message was:
configure: error: unrecognized option: `--WITHOUT_GTK'
Also fixed a couple of README typos.
Colourize the ping graph in curses.
I've been thinking about making this an option (i.e. you can disable this on the command line).
Decision: No, set your terminal type to something that doesn't support colors if you don't want colors.
- generally improve the look of the man page and help message
- add missing command line options to the man page
- reorder command line options to be more consistent
- use the same order for command line options everywhere (man page, code, help message)
- add missing switches in getopt_long call (-M, -F)
- fix incorrect switch in getopt_long call (-Z)
Note that a few options were never documented (they are now marked as
"MISSING" in the man page).
Adam Borowski [Fri, 11 Jul 2014 19:47:03 +0000 (21:47 +0200)]
Colourize the ping graph in curses.
The display used, .123abc> is nearly completely unreadable at a glance.
We can use colours, as the only terminal from last 25 years I'm aware of
that did not support colours was Win3.1/95 telnet.exe, and even that did
degrade to monochrome rather than to garbage.
Add support for setting SO_MARK through --mark option.
This emulates the -m option for ping provided in iputils. When coupled
with iptables, this option provides a means of using source routing to
force probes through a consistent nexthop on multihomed systems.
aquerubin [Wed, 29 Jan 2014 00:50:06 +0000 (14:50 -1000)]
Restore the name resolver query order to their relative position in
/etc/resolv.conf (the IPv6 resolver patch I submitted earlier broke this
normal, expected behaviour). Ie. currently, IPv6 resolvers are always
queried before IPv4 resolvers regardless of their position in
resolv.conf.
Michal Sekletar [Tue, 24 Sep 2013 10:56:11 +0000 (12:56 +0200)]
dns: iterate over all configured nameservers
Previously if there were three nameservers configured and third one was
reachable via IPv6 we didn't sent query to it, since NSCOUNT6 was equal to
one. Clearly it was the original intention to sent query to all IPv6
nameservers.
core: introduce grace period
This patch was somehow lost. I wrote and included this for 0.81, but it was removed again in 0.82. This was before git, so things were a bit messy back then. Sorry.
Michal Sekletar [Tue, 17 Sep 2013 14:11:20 +0000 (16:11 +0200)]
core: introduce grace period
In report mode we break out from select loop immediately after we reach
maximum count of iterations. But we should wait for packets which are still on
the way.
In order to fix the issue we introduce grace period during which we don't send
out more packets but we just wait for responses which might be still on the way.