yvs [Fri, 8 May 2026 13:24:47 +0000 (17:24 +0400)]
curses: keep bit pattern range consistent
Port the interactive bitpattern validation from yvs2014/mtr085 so the curses b command matches the command-line --bitpattern range. Only -1 selects random mode; other negative values and values above 255 are rejected.
yvs [Fri, 8 May 2026 13:20:38 +0000 (17:20 +0400)]
options: reject invalid bit patterns
Port the bitpattern validation from yvs2014/mtr085. Only -1 selects a random payload pattern; other negative values and values above 255 are rejected instead of silently enabling random mode.
Roger Wolff [Sun, 26 Apr 2026 13:38:30 +0000 (15:38 +0200)]
Merge pull request #568 from mayconrcmello/fix/cygwin-braille
ui: fix braille display mode on Cygwin
I would find it neater to add a check for the header that cygwin uses, instead of checking for cygwin and just including that. This involves messing with the autoconf stuff which I'm not familiar with. So that's an item for the "todo list".
Three issues prevented the braille display from rendering correctly
when mtr is built with Cygwin:
1. Wrong ncurses header: Cygwin ships <ncurses.h> as the non-wide
variant, which does not declare addwstr() or add_wch(). Include
<ncursesw/ncurses.h> instead when building with braille support.
2. Wrong output function: printw("%ls", wstr) relies on the C library
wide-to-multibyte conversion path, which can misbehave when the
locale is not fully set up before ncurses initialises. Use
addwstr(), the proper ncursesw API, instead.
3. Locale and console codepage: setlocale(LC_ALL, "") on Cygwin
inherits the Windows ANSI codepage (e.g. CP1252), breaking UTF-8
output. Explicitly request C.UTF-8 and set the Windows console
output codepage to 65001 (UTF-8) before initscr().
ui: replace non-BMP braille char U+1FB10 with U+28FF
🮐 (U+1FB10) lives outside the Basic Multilingual Plane and requires
a UTF-16 surrogate pair when wchar_t is 16 bits (Windows, Cygwin).
Passing a surrogate pair to wide-char ncurses functions produces
corrupted output on those platforms.
Replace all three uses with ⣿ (U+28FF), the filled braille pattern,
which is the visually closest BMP character and avoids the issue on
any platform where sizeof(wchar_t) == 2.
Petr Sumbera [Thu, 19 Mar 2026 09:34:32 +0000 (10:34 +0100)]
packet: skip bind() on Solaris raw ICMPv4 sockets
Commit d529dbeefc6d ("Change UDP and ICMP sockets binding to accept a
source IP from the -a CLI option") started binding the shared IPv4 raw
ICMP send socket in construct_ip4_packet().
On Solaris/illumos this breaks default ICMP probes: bind() on that raw
socket can fail with EINVAL, and mtr exits with:
mtr: mtr-packet reported invalid argument
This does not affect TCP or UDP probes, and mtr 0.95 worked because the
raw ICMPv4 path did not bind the socket.
Keep the pre-0.96 behavior on __sun by skipping bind() for raw ICMPv4
sockets. This restores default ICMP probing on Solaris/illumos without
changing Linux behavior.
Note that -a source address selection is not enforced for raw ICMPv4 on
Solaris/illumos, since those platforms cannot reliably use bind() on the
shared raw ICMP socket in this code path.
bluPhy [Sat, 24 Jan 2026 05:10:35 +0000 (00:10 -0500)]
Fix typos in comments and docstrings across codebase
Corrected several spelling errors such as 'unparseable' to 'unparsable', 'paramters' to 'parameters', 'virutal' to 'virtual', 'withing' to 'within', and 'non-existant' to 'non-existent' in both source and test files to improve code clarity and documentation accuracy.
- numhosts did not take fstTTL into account when calculating the number of hosts in a batch.
- maxUnknown or maxTTL values are now taken into account after the set TTL value is reached,
when the -D (--due-ttl) option is enabled.
Before OS X 10.6, defining BIND_8_COMPAT included arpa/nameser8_compat.h
which was removed in 10.6 and from then on included arpa/nameser_compat.h
until BIND_8_COMPAT was removed somewhere between macOS 10.13 & 10.15.
On systems before 10.6 this causes the build to break due to conflicts.
Raw pings output time in usec. Correct args and docs.
(An alternate solution is to correct https://github.com/traviscross/mtr/blob/master/ui/net.c#L319, but that would potentially break workflows for users, so this is likely a more acceptable fix)