The problem is that, without interface=, bind-interfaces does not
work. Bind-interfaces uses SO_BINDTODEVICE. Unless this in
in effect, there is no guarantee that the kernel will route
DHCP (v4 or v6) packets to the correct instance of dnsmasq,
when there is more than one.
**NOTE** This patch assumes that the patch to put dnsmasq parameters
into a file instead of the command line, has been applied.
---
src/network/bridge_driver.c | 6 ++++++
tests/networkxml2argvdata/isolated-network.argv | 1 +
tests/networkxml2argvdata/nat-network-dns-hosts.argv | 1 +
tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv | 1 +
tests/networkxml2argvdata/nat-network-dns-srv-record.argv | 1 +
tests/networkxml2argvdata/nat-network-dns-txt-record.argv | 1 +
tests/networkxml2argvdata/nat-network.argv | 1 +
tests/networkxml2argvdata/netboot-network.argv | 1 +
tests/networkxml2argvdata/netboot-proxy-network.argv | 1 +
tests/networkxml2argvdata/routed-network.argv | 1 +
10 files changed, 15 insertions(+)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index ab13df5..6e5d9da 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -693,6 +693,12 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
}
}
+ /* This must be defined so that the kernel knows which dnsmasq to route
+ * packets to when more than one instance if running
+ */
+ if (network->def->bridge != NULL)
+ virBufferAsprintf(&configbuf, "interface=%s\n",
network->def->bridge);
+
for (ii = 0;
(tmpipdef = virNetworkDefGetIpByIndex(network->def, AF_UNSPEC, ii));
ii++)
diff --git a/tests/networkxml2argvdata/isolated-network.argv
b/tests/networkxml2argvdata/isolated-network.argv
index 042158b..abcde93 100644
--- a/tests/networkxml2argvdata/isolated-network.argv
+++ b/tests/networkxml2argvdata/isolated-network.argv
@@ -6,6 +6,7 @@ domain-needed
local=//
dhcp-option=3
no-resolv
+interface=virbr2
listen-address=192.168.152.1
dhcp-range=192.168.152.2,192.168.152.254
dhcp-leasefile=/var/lib/libvirt/dnsmasq/private.leases
diff --git a/tests/networkxml2argvdata/nat-network-dns-hosts.argv
b/tests/networkxml2argvdata/nat-network-dns-hosts.argv
index 91eb682..7dce6f9 100644
--- a/tests/networkxml2argvdata/nat-network-dns-hosts.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-hosts.argv
@@ -6,5 +6,6 @@ domain-needed
local=/example.com/
domain=example.com
expand-hosts
+interface=virbr0
listen-address=192.168.122.1
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
index d92497b..d87d438 100644
--- a/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv
@@ -5,6 +5,7 @@ except-interface=lo
domain-needed
local=//
srv-host=name.tcp.,,,,
+interface=virbr0
listen-address=192.168.122.1
listen-address=192.168.123.1
listen-address=2001:db8:ac10:fe01::1
diff --git a/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
b/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
index d8846c2..53882fe 100644
--- a/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-srv-record.argv
@@ -5,6 +5,7 @@ except-interface=lo
domain-needed
local=//
srv-host=name.tcp.test-domain-name,.,1024,10,10
+interface=virbr0
listen-address=192.168.122.1
listen-address=192.168.123.1
listen-address=2001:db8:ac10:fe01::1
diff --git a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
index bf00513..cc3ed28 100644
--- a/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
+++ b/tests/networkxml2argvdata/nat-network-dns-txt-record.argv
@@ -5,6 +5,7 @@ except-interface=lo
domain-needed
local=//
txt-record=example,example value
+interface=virbr0
listen-address=192.168.122.1
listen-address=192.168.123.1
listen-address=2001:db8:ac10:fe01::1
diff --git a/tests/networkxml2argvdata/nat-network.argv
b/tests/networkxml2argvdata/nat-network.argv
index d542bbc..431fffb 100644
--- a/tests/networkxml2argvdata/nat-network.argv
+++ b/tests/networkxml2argvdata/nat-network.argv
@@ -4,6 +4,7 @@ bind-interfaces
except-interface=lo
domain-needed
local=//
+interface=virbr0
listen-address=192.168.122.1
listen-address=192.168.123.1
listen-address=2001:db8:ac10:fe01::1
diff --git a/tests/networkxml2argvdata/netboot-network.argv
b/tests/networkxml2argvdata/netboot-network.argv
index 4f5fedd..8405095 100644
--- a/tests/networkxml2argvdata/netboot-network.argv
+++ b/tests/networkxml2argvdata/netboot-network.argv
@@ -6,6 +6,7 @@ domain-needed
local=/example.com/
domain=example.com
expand-hosts
+interface=virbr1
listen-address=192.168.122.1
dhcp-range=192.168.122.2,192.168.122.254
dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases
diff --git a/tests/networkxml2argvdata/netboot-proxy-network.argv
b/tests/networkxml2argvdata/netboot-proxy-network.argv
index 8b9c03a..d7c8966 100644
--- a/tests/networkxml2argvdata/netboot-proxy-network.argv
+++ b/tests/networkxml2argvdata/netboot-proxy-network.argv
@@ -6,6 +6,7 @@ domain-needed
local=/example.com/
domain=example.com
expand-hosts
+interface=virbr1
listen-address=192.168.122.1
dhcp-range=192.168.122.2,192.168.122.254
dhcp-leasefile=/var/lib/libvirt/dnsmasq/netboot.leases
diff --git a/tests/networkxml2argvdata/routed-network.argv
b/tests/networkxml2argvdata/routed-network.argv
index ad9e121..771240f 100644
--- a/tests/networkxml2argvdata/routed-network.argv
+++ b/tests/networkxml2argvdata/routed-network.argv
@@ -4,5 +4,6 @@ bind-interfaces
except-interface=lo
domain-needed
local=//
+interface=virbr1
listen-address=192.168.122.1
addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
--
1.7.11.7