Re: [libvirt] [PATCH] network: write both lo and lo0 in dnsmasq configuration
On Thu, Dec 22, 2016 at 08:46:55PM +0100, Andrea Bolognani wrote: On Tue, 2016-12-06 at 09:41 +0100, Martin Kletzander wrote: > 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. Just so I know the reasoning behind this. Is this only because of the test suite failing? Or are we trying to fix some problem with it? Can't we get the interface name programmatically and then use that value? Not that I'd be running around adding bridges with name == "lo0" in libvirt's networks, but still... It would feel cleaner. I think it's just because of the test case, which by the way is still failing on FreeBSD. I've just posted an alternative approach that, while quite possibly not the cleanest out there, at least doesn't require us to bend the library code proper to the test suite needs: https://www.redhat.com/archives/libvir-list/2016-December/msg01123.html Me too: https://www.redhat.com/archives/libvir-list/2016-December/msg01187.html Feedback is welcome :) Same here. -- Andrea Bolognani / Red Hat / Virtualization signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: write both lo and lo0 in dnsmasq configuration
On Tue, 2016-12-06 at 09:41 +0100, Martin Kletzander wrote: > > 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. > > Just so I know the reasoning behind this. Is this only because of the > test suite failing? Or are we trying to fix some problem with it? > Can't we get the interface name programmatically and then use that > value? Not that I'd be running around adding bridges with name == "lo0" > in libvirt's networks, but still... It would feel cleaner. I think it's just because of the test case, which by the way is still failing on FreeBSD. I've just posted an alternative approach that, while quite possibly not the cleanest out there, at least doesn't require us to bend the library code proper to the test suite needs: https://www.redhat.com/archives/libvir-list/2016-December/msg01123.html Feedback is welcome :) -- Andrea Bolognani / Red Hat / Virtualization -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: write both lo and lo0 in dnsmasq configuration
On Thu, Dec 01, 2016 at 01:47:57PM +0100, Pino Toscano wrote: 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. Just so I know the reasoning behind this. Is this only because of the test suite failing? Or are we trying to fix some problem with it? Can't we get the interface name programmatically and then use that value? Not that I'd be running around adding bridges with name == "lo0" in libvirt's networks, but still... It would feel cleaner. signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: write both lo and lo0 in dnsmasq configuration
Pino Toscano wrote: > 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(-) Thanks, this indeed makes networkxml2conftest pass on FreeBSD. Basic run-time tests doesn't reveal any issues as well (though I'm not sure that I was ever able to reproduce the issue caused adding the except-interface thing). Roman Bogorodskiy signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] network: write both lo and lo0 in dnsmasq configuration
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(, "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(, "except-interface=lo\n"); -#else -/* BSD family OSes and Solaris call loopback interface as lo0 */ virBufferAddLit(, "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