Hi Natanael/Florian,

A couple of solutions for this are stated below.

The code is in src/VBox/Devices/Network/slirp/hostres.c:517

    if (   qtype != Type_A
        && qtype != Type_CNAME
        && qtype != Type_PTR
        && qtype != Type_ANY)
    {
        LogErr(("NAT: hostres: unsupported qtype %d\n", qtype));
        return refuse(res, RCode_NotImp);
    }

There are two possible fixes:

- Add a conditional above this code for Type_AAAA where the resolver returns RCode_NXDomain instead of RCode_NotImp:

if (qtype == Type_AAAA) {
    LogErr(("NAT: hostres: cannot resolve qtype %d\n", qtype));
    return refuse(res, RCode_NXDomain);
}

- Implement IPv6 resolution for AAAA records.  The resolve() function at line 574 would need to be updated.

I just came across ticket filed by Natanael with Virtual box at https://www.virtualbox.org/ticket/18171. Since one of us is already talking with them, could you propose the above solutions to them (and add me to the loop at well).

Thanks,
Tarun



From: "Natanael Copa" <ncopa@alpinelinux.org>
To: "Florian Weimer" <fweimer@redhat.com>
Cc: musl@lists.openwall.com, "Tarun Johar" <tjohar@totalphase.com>
Sent: Thursday, December 6, 2018 9:18:20 PM
Subject: Re: [musl] DNS resolver patch

On Thu, 06 Dec 2018 15:53:43 +0100
Florian Weimer <fweimer@redhat.com> wrote:

* Tarun Johar:
 
 > The VirtualBox --natdnsresolver does not support IPv6 AAAA address
 > queries.  It returns "NotImp" (code 4) for such queries.  
 
 I think that's not the only bug, and glibc fails to work around all of
 them.  We occasionally get bug reports about DNS resolution issues under
 VirtualBox, too.  Oracle really needs to fix this properly.
 
 Thanks,
 Florian

Problem is here:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Network/slirp/hostres.c?rev=59202#L408

402            if (   qtype != Type_A
403                && qtype != Type_CNAME
404                && qtype != Type_PTR
405                && qtype != Type_ANY)
406            {
407                LogErr(("NAT: hostres: unsupported qtype %d\n", qtype));
408                return refuse(pData, m, RCode_NotImp);
409            }


They should return RCode_NXDomain instead of RCode_NotImp. Seems like
they also have more of those invalid use of NotImp.

-nc