#521415 [mtr] DNS lookups broken with GUI and IPv6

Package:
mtr
Source:
mtr
Description:
Full screen ncurses and X11 traceroute tool
Submitter:
Ingo Juergensmann
Date:
2012-12-15 14:39:07 UTC
Severity:
minor
#521415#5
Date:
2009-03-27 12:36:39 UTC
From:
To:
--- Please enter the report below this line. ---

I just discovered that mtr has some problems with IPv6 enabled hosts
when using the GUI. Try the following:

1) enter "mtr ipv6-host" in shell -> works
2) enter then an IPv4 only host Hostname input line -> doesn't work

3) quit mtr

4) enter "mtr ipv4-host" in shell -> works
5) enter then an IPv6 enabled host in Hostname input line -> tracing
IPv4 part of IPv6 enabled host

So, something is broken, at least for 2). One could argue if 5) might be
OK or the expected behaviour, but I believe that mtr should query the
AAAA records and trace for the IPv6 hostname, regardless of whether you
started with an IPv4 only host first.

Regards,
Ingo

Debian Release: squeeze/sid
  500 unstable        ftp2.de.debian.org
--- Package information. ---
Depends                     (Version) | Installed
=====================================-+-====================
libatk1.0-0               (>= 1.20.0) | 1.24.0-2
libc6                      (>= 2.7-1) | 2.9-6
libcairo2                  (>= 1.2.4) | 1.8.6-2+b1
libglib2.0-0              (>= 2.12.0) | 2.20.0-2
libgtk2.0-0               (>= 2.12.0) | 2.14.7-5
libncurses5       (>= 5.6+20071006-3) | 5.7+20090314-1
libpango1.0-0             (>= 1.20.2) | 1.22.4-3

#521415#18
Date:
2012-12-15 14:25:42 UTC
From:
To:
The bug is still present in mtr 0.82.

The fundamental problem is that mtr does name to struct hostent
translations in two places in the code.
The first is only executed at startup and correctly uses getaddrinfo().
The second, dns_forward() is called from the gtk code, but uses
gethostbyname(), which doesn't support IPv6.

The fix is, of course, to use getaddrinfo() in dns_forward, and to
remove the duplicate code. There are further issues (the abuse of the
'af' global variable for example) complicating this somewhat.

Kristof