On 2014-04-28 14:26, Rogier Wolff wrote:
> On Mon, Apr 28, 2014 at 02:00:47PM +0200, Jeroen Massar wrote:
>> It is only a user-error from the perspective of disabling a current
>> protocol. If you disable IPv4 your host won't even boot, even if you
>> want it to be IPv6 only.
>>
>> Using IPv6 support of the networking API (getaddrinfo() and friends) is
>> a standard way of porting applications to support both IPv4 and IPv6.
> 
> mtr doesn't use "getaddrinfo". For a reason. Not a good reason, but
> for a reason.

Line ~418 of mtr.c (mtr-0.85 from a quick "apt-get source mtr-tiny"):
8<-------------------------------------------------------
#ifdef ENABLE_IPV6
  /* gethostbyname2() is deprecated so we'll use getaddrinfo() instead. */
  bzero( &hints, sizeof hints );
  hints.ai_family = af;
  hints.ai_socktype = SOCK_DGRAM;
  error = getaddrinfo( Hostname, NULL, &hints, &res );
------------------------------------------------------->8

also note that I stated "getaddrinfo() and friends", to spell it out, I
mean: RFC3493 (http://www.ietf.org/rfc/rfc3493.txt) which contains a set
of functions to support IPv6 along with IPv4 in a mixed environment.


But to get back to the original bug report:
8<---------------------------------------------------------
void dns_open(void)
{
  int option,i;

  if (!dns) return;
  MY_RES_INIT();
  if (!myres.nscount) {
    fprintf(stderr,"No nameservers defined.\n");
    exit(-1);
  }
  myres.options|= RES_RECURSE | RES_DEFNAMES | RES_DNSRCH;
  resfd = socket(AF_INET, SOCK_DGRAM, 0);
  if (resfd == -1) {
    fprintf(stderr,
            "Unable to allocate IPv4 socket for nameserver
communication: %s\n",
            strerror(errno));
    exit(-1);
  }
#ifdef ENABLE_IPV6
  resfd6 = socket(AF_INET6, SOCK_DGRAM, 0);
  if (resfd6 == -1) {
    fprintf(stderr,
            "Unable to allocate IPv6 socket for nameserver
communication: %s\n",
            strerror(errno));
    exit(-1);
  }
------------------------------------------------------>8

As such, defining ENABLED_IPV6, causes unconditionally that IPv6 support
is compiled in, but also that that resolver socket is always enabled and
required.

Hence, when your kernel is IPv6 disabled, you do not get that socket and
mtr aborts.

The question to that code becomes:
 a) is "-4" intended only to indicate the target to be traced
 b) does "-4" also mean "force reverse resolve through IPv4"

Like other tools that do similar things, I suggest it is a), as one
could have IPv4 traffic, while doing DNS over IPv6.

As such, keep your kernel IPv6 enabled.

As stated above in this thread already: patches are welcome!

Greets,
 Jeroen


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to