﻿id	summary	reporter	owner	description	type	status	component	version	resolution	keywords	cc	guest	host
18171	wrong RCODE from DNS AAAA query with --natdnshostresolver1 (with suggested fix) => Fixed in SVN	ncopa		"The natdnshostresolver returns NOTIMP (rcode 4) on AAAA queries. This causes 5 seconds delays with musl libc, which similar to Go's stupresolver does both A and AAAA queries on hostname lookups. Problem was reported to [https://bugs.alpinelinux.org/issues/6221 Alpine Linux] and to the musl libc [https://www.openwall.com/lists/musl/2018/12/06/4 mailing list], where the [https://www.openwall.com/lists/musl/2018/12/06/5 response] was that this is is a bug in [https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Network/slirp/hostres.c?rev=59202#L408 VirtualBox].


Example tcpdump:

{{{
22:34:45.724471 IP 10.0.2.15.52190 > 10.0.2.3.53: 27848+ A? www.google.com. (32)
22:34:45.724542 IP 10.0.2.15.52190 > 10.0.2.3.53: 28141+ AAAA? www.google.com. (32)
22:34:45.812045 IP 10.0.2.3.53 > 10.0.2.15.52190: 27848 1/0/0 A 216.58.194.164 (48)
22:34:45.812068 IP 10.0.2.3.53 > 10.0.2.15.52190: 28141 NotImp 0/0/0 (32)
22:34:48.228641 IP 10.0.2.15.52190 > 10.0.2.3.53: 28141+ AAAA? www.google.com. (32)
22:34:48.228965 IP 10.0.2.3.53 > 10.0.2.15.52190: 28141 NotImp 0/0/0 (32)
}}}

According RFC 1035:
> OPCODE          A four bit field that specifies '''kind of query''' in this message. 
>
> ...
>
> RCODE           Response code - this 4 bit field is set as part of responses.  The values have the following interpretation:
>
> ...
>
>                4               Not Implemented - The name server does not support the requested '''kind of query'''.



The fix is to return RCode_NXDomain instead of RCode_NotImp:

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	    }
}}}
"	defect	closed	network/NAT	VirtualBox 5.2.22	fixed			other	other
