When using host resolver, VirtualBox forwards a PTR query as an A query

Bug #1228955 reported by Bar Ziony
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
virtualbox (Ubuntu)
New
Undecided
Unassigned

Bug Description

Hello,

For some reason, when trying to resolve a PTR query (host -t PTR 8.8.8.8 for example) from a VirtualBox guest (Doesn't matter which OS), the resulting query on the host (Ubuntu 12.10) eth0 on wireshark is an A query for 8.8.8.8.in-addr.arpa, which of course fails.
This happens for all PTR queries, public and private.
When I stop using dnsmasq in my host (by commenting it out on /etc/NetworkManager/NetworkManager.conf), everything works as expected.

I know this is not a VirtualBox issue.

Resolving the same PTR queries exactly (with the same 'host' utility) on the host works great.

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: dnsmasq (not installed)
ProcVersionSignature: Ubuntu 3.5.0-40.62-generic 3.5.7.20
Uname: Linux 3.5.0-40-generic x86_64
ApportVersion: 2.6.1-0ubuntu12
Architecture: amd64
Date: Mon Sep 23 01:26:12 2013
InstallationDate: Installed on 2012-11-29 (297 days ago)
InstallationMedia: Xubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.1)
MarkForUpload: True
SourcePackage: dnsmasq
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Bar Ziony (bartzy) wrote :
Revision history for this message
Thomas Hood (jdthood) wrote :

How do you rule out this being VirtualBox's fault?

Revision history for this message
Bar Ziony (bartzy) wrote :

Hi Thomas,

Because when I disable dnsmasq from NetworkManager config, and I get the my regular DNS server into resolv.conf (of my host), the Virtualbox guests behave normal.

so I thought if the issue occurs with dnsmasq, and doesn't occur without it, then it's dnsmasq's fault and not Virtualbox (which can't really know if dnsmasq is even used or not).

Revision history for this message
Bar Ziony (bartzy) wrote :

Hi Thomas,

This is indeed not a dnsmasq issue.

It is Virtualbox, turning PTR queries into A queries when the name server on the host's resolv.conf file is from 127.0.0.0/8 segment.

I'm still investigating why.

Revision history for this message
Thomas Hood (jdthood) wrote :

Hi Bar,

I can reproduce the behavior: Debian 7 in VM with NATted network interface on VirtualBox 4.2.16 on Ubuntu 13.04 with the NetworkManager-controlled dnsmasq instance running. Using wireshark on the host I see 127.0.1.1 receiving an A query instead of a PTR query.

affects: dnsmasq (Ubuntu) → virtualbox (Ubuntu)
Revision history for this message
Bar Ziony (bartzy) wrote :

Hi Thomas.

Good to hear you can reproduce it.

Anything else I need to do?

Revision history for this message
Bar Ziony (bartzy) wrote :

Sorry for the double-post.

I believe this is the code that is causing Virtualbox to behave like this:
https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Network/slirp/slirp_dns.c#L283

I don't have any idea why it is there, but it says that it's specifically for "modern" Ubuntu releases which have 127.0.1.1 as the name server (Network-Manager-managed dnsmasq...)

Thanks!
Bar.

Revision history for this message
Thomas Hood (jdthood) wrote :

It looks to me as if the purpose of that code is to detect the host DNS configuration. The section labeled with the comment "Modern Ubuntu register 127.0.1.1 as DNS server" seems to be executed in case a loopback address other than the classic 127.0.0.1 is found on a "nameserver <ipaddr>" line in resolv.conf — which is the case in Ubuntu 12.10 and later — and the important thing for us is that it sets fUseHostResolver = 1.

I guess we need to look at the code that is activated by fUseHostResolver == 1.

Thomas Hood (jdthood)
summary: - dnsmasq changeds virtualbox guests PTR queries into A queries
+ When using host resolver, VirtualBox forwards a PTR query as an A query
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.