Local DNS queries forwarded incorrectly
Software environment
- Operating system: archlinux
- Architecture: x86_64
- kernel version: 6.7.4-arch1-1
- libvirt version: 10.0.0
- Hypervisor and version: qemu 8.2.1
Description of problem
According to documentation, and to comments in the code, setting dns forwarder domain only (no address) is supposed to never forward queries for that domain. However the generated dnsmasq options are not correct to do that.
Steps to reproduce
-
Use virsh net-edit default to add
<domain name='internal'/> <dns> <forwarder domain='internal'/> </dns>
-
Update or restart the network
-
Use wireshark to monitor all interfaces port 53
-
Query with
host bogus.internal 192.168.122.1
-
Observe DNS query of bogus.internal on system configured (in /etc/resolv.conf) name server.
-
cat /var/lib/libvirt/dnsmasq/default.conf
and note lineserver=/internal/#
Additional information
'#' as the address part of the server option is wrong here. According to the dnsmasq documentation:
The special server address '#' means, "use the standard servers"
The problem is in libvirt/src/network/bridge_driver.c
Arguably it would be good to accept '#' as a valid address so that anyone who wants that behavior can have it.