[PATCH] network: write both lo and lo0 in dnsmasq configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When generating a new configuration for dnsmasq, add except-interface
for both lo and lo0: this should make sure the configuration works,
and is always the same for every supported OS.

Adjust the data of networkxml2conftest to reflect the new dnsmasq
configuration, making networkxml2conftest pass on non-Linux OSes.

Followup of commit 478ddedc12b77313cbaf72328ab2236ce7c56ead.
---
 src/network/bridge_driver.c                                      | 9 ++++-----
 tests/networkxml2confdata/dhcp6-nat-network.conf                 | 1 +
 tests/networkxml2confdata/dhcp6-network.conf                     | 1 +
 tests/networkxml2confdata/dhcp6host-routed-network.conf          | 1 +
 tests/networkxml2confdata/isolated-network.conf                  | 1 +
 tests/networkxml2confdata/nat-network-dns-forward-plain.conf     | 1 +
 tests/networkxml2confdata/nat-network-dns-forwarders.conf        | 1 +
 tests/networkxml2confdata/nat-network-dns-hosts.conf             | 1 +
 tests/networkxml2confdata/nat-network-dns-local-domain.conf      | 1 +
 .../networkxml2confdata/nat-network-dns-srv-record-minimal.conf  | 1 +
 tests/networkxml2confdata/nat-network-dns-srv-record.conf        | 1 +
 tests/networkxml2confdata/nat-network-dns-txt-record.conf        | 1 +
 tests/networkxml2confdata/nat-network-name-with-quotes.conf      | 1 +
 tests/networkxml2confdata/nat-network.conf                       | 1 +
 tests/networkxml2confdata/netboot-network.conf                   | 1 +
 tests/networkxml2confdata/netboot-proxy-network.conf             | 1 +
 tests/networkxml2confdata/open-network.conf                      | 1 +
 tests/networkxml2confdata/routed-network-no-dns.conf             | 1 +
 tests/networkxml2confdata/routed-network.conf                    | 1 +
 19 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 9d94d65..feea35b 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1001,13 +1001,12 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
     if (pidfile)
         virBufferAsprintf(&configbuf, "pid-file=%s\n", pidfile);
 
-    /* dnsmasq will *always* listen on localhost unless told otherwise */
-#ifdef __linux__
+    /* dnsmasq will *always* listen on localhost unless told otherwise:
+     * - "lo" is the loopback interface on Linux
+     * - "lo0" is the loopback interface on BSD and Solaris
+     */
     virBufferAddLit(&configbuf, "except-interface=lo\n");
-#else
-    /* BSD family OSes and Solaris call loopback interface as lo0 */
     virBufferAddLit(&configbuf, "except-interface=lo0\n");
-#endif
 
     if (dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC)) {
         /* using --bind-dynamic with only --interface (no
diff --git a/tests/networkxml2confdata/dhcp6-nat-network.conf b/tests/networkxml2confdata/dhcp6-nat-network.conf
index d1058df..a5d69b5 100644
--- a/tests/networkxml2confdata/dhcp6-nat-network.conf
+++ b/tests/networkxml2confdata/dhcp6-nat-network.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 dhcp-range=192.168.122.2,192.168.122.254
diff --git a/tests/networkxml2confdata/dhcp6-network.conf b/tests/networkxml2confdata/dhcp6-network.conf
index 8270690..f58a088 100644
--- a/tests/networkxml2confdata/dhcp6-network.conf
+++ b/tests/networkxml2confdata/dhcp6-network.conf
@@ -8,6 +8,7 @@ strict-order
 domain=mynet
 expand-hosts
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64
diff --git a/tests/networkxml2confdata/dhcp6host-routed-network.conf b/tests/networkxml2confdata/dhcp6host-routed-network.conf
index 87a1498..03ea9a6 100644
--- a/tests/networkxml2confdata/dhcp6host-routed-network.conf
+++ b/tests/networkxml2confdata/dhcp6host-routed-network.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr1
 dhcp-range=192.168.122.1,static
diff --git a/tests/networkxml2confdata/isolated-network.conf b/tests/networkxml2confdata/isolated-network.conf
index ce4a59f..b2b7ec2 100644
--- a/tests/networkxml2confdata/isolated-network.conf
+++ b/tests/networkxml2confdata/isolated-network.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-interfaces
 listen-address=192.168.152.1
 dhcp-option=3
diff --git a/tests/networkxml2confdata/nat-network-dns-forward-plain.conf b/tests/networkxml2confdata/nat-network-dns-forward-plain.conf
index 9a000b8..6e9a27a 100644
--- a/tests/networkxml2confdata/nat-network-dns-forward-plain.conf
+++ b/tests/networkxml2confdata/nat-network-dns-forward-plain.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/nat-network-dns-forwarders.conf b/tests/networkxml2confdata/nat-network-dns-forwarders.conf
index 0bd76bf..c3d351b 100644
--- a/tests/networkxml2confdata/nat-network-dns-forwarders.conf
+++ b/tests/networkxml2confdata/nat-network-dns-forwarders.conf
@@ -11,6 +11,7 @@ server=8.8.4.4
 server=/example.com/192.168.1.1
 server=/www.example.com/#
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/nat-network-dns-hosts.conf b/tests/networkxml2confdata/nat-network-dns-hosts.conf
index 021316f..16cc397 100644
--- a/tests/networkxml2confdata/nat-network-dns-hosts.conf
+++ b/tests/networkxml2confdata/nat-network-dns-hosts.conf
@@ -10,6 +10,7 @@ expand-hosts
 domain-needed
 local=//
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/nat-network-dns-local-domain.conf b/tests/networkxml2confdata/nat-network-dns-local-domain.conf
index 5f41b91..f9ffd3a 100644
--- a/tests/networkxml2confdata/nat-network-dns-local-domain.conf
+++ b/tests/networkxml2confdata/nat-network-dns-local-domain.conf
@@ -9,6 +9,7 @@ local=/example.com/
 domain=example.com
 expand-hosts
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
diff --git a/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf b/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
index f35ea1d..d15120d 100644
--- a/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
+++ b/tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-interfaces
 listen-address=192.168.122.1
 listen-address=192.168.123.1
diff --git a/tests/networkxml2confdata/nat-network-dns-srv-record.conf b/tests/networkxml2confdata/nat-network-dns-srv-record.conf
index af1ed70..07280da 100644
--- a/tests/networkxml2confdata/nat-network-dns-srv-record.conf
+++ b/tests/networkxml2confdata/nat-network-dns-srv-record.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 srv-host=_name._tcp.test-domain-name.com,test.example.com,1111,11,111
diff --git a/tests/networkxml2confdata/nat-network-dns-txt-record.conf b/tests/networkxml2confdata/nat-network-dns-txt-record.conf
index 7f560fb..ddc51be 100644
--- a/tests/networkxml2confdata/nat-network-dns-txt-record.conf
+++ b/tests/networkxml2confdata/nat-network-dns-txt-record.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 txt-record=example,example value
diff --git a/tests/networkxml2confdata/nat-network-name-with-quotes.conf b/tests/networkxml2confdata/nat-network-name-with-quotes.conf
index 36e11d1..fb2668c 100644
--- a/tests/networkxml2confdata/nat-network-name-with-quotes.conf
+++ b/tests/networkxml2confdata/nat-network-name-with-quotes.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-interfaces
 listen-address=192.168.122.1
 listen-address=192.168.123.1
diff --git a/tests/networkxml2confdata/nat-network.conf b/tests/networkxml2confdata/nat-network.conf
index a3c8b10..cf49e27 100644
--- a/tests/networkxml2confdata/nat-network.conf
+++ b/tests/networkxml2confdata/nat-network.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr0
 dhcp-range=192.168.122.2,192.168.122.254
diff --git a/tests/networkxml2confdata/netboot-network.conf b/tests/networkxml2confdata/netboot-network.conf
index b554a54..cd8c7e9 100644
--- a/tests/networkxml2confdata/netboot-network.conf
+++ b/tests/networkxml2confdata/netboot-network.conf
@@ -8,6 +8,7 @@ strict-order
 domain=example.com
 expand-hosts
 except-interface=lo
+except-interface=lo0
 bind-interfaces
 listen-address=192.168.122.1
 dhcp-range=192.168.122.2,192.168.122.254
diff --git a/tests/networkxml2confdata/netboot-proxy-network.conf b/tests/networkxml2confdata/netboot-proxy-network.conf
index afb4033..e91edb8 100644
--- a/tests/networkxml2confdata/netboot-proxy-network.conf
+++ b/tests/networkxml2confdata/netboot-proxy-network.conf
@@ -8,6 +8,7 @@ strict-order
 domain=example.com
 expand-hosts
 except-interface=lo
+except-interface=lo0
 bind-interfaces
 listen-address=192.168.122.1
 dhcp-range=192.168.122.2,192.168.122.254
diff --git a/tests/networkxml2confdata/open-network.conf b/tests/networkxml2confdata/open-network.conf
index ff09984..acf9440 100644
--- a/tests/networkxml2confdata/open-network.conf
+++ b/tests/networkxml2confdata/open-network.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr1
 addn-hosts=/var/lib/libvirt/dnsmasq/open.addnhosts
diff --git a/tests/networkxml2confdata/routed-network-no-dns.conf b/tests/networkxml2confdata/routed-network-no-dns.conf
index 83cc85e..ab687fa 100644
--- a/tests/networkxml2confdata/routed-network-no-dns.conf
+++ b/tests/networkxml2confdata/routed-network-no-dns.conf
@@ -7,5 +7,6 @@
 strict-order
 port=0
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr1
diff --git a/tests/networkxml2confdata/routed-network.conf b/tests/networkxml2confdata/routed-network.conf
index 970aa3c..ba0353c 100644
--- a/tests/networkxml2confdata/routed-network.conf
+++ b/tests/networkxml2confdata/routed-network.conf
@@ -6,6 +6,7 @@
 ## dnsmasq conf file created by libvirt
 strict-order
 except-interface=lo
+except-interface=lo0
 bind-dynamic
 interface=virbr1
 addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux