]> xenbits.xensource.com Git - libvirt.git/commitdiff
network: add dnsmasq option 'dhcp-authoritative'
authorMartin Wilck <mwilck@suse.de>
Wed, 21 Sep 2016 08:49:41 +0000 (10:49 +0200)
committerLaine Stump <laine@laine.org>
Mon, 10 Oct 2016 19:15:11 +0000 (15:15 -0400)
The dnsmasq man page recommends that dhcp-authoritative "should be
set when dnsmasq is definitely the only DHCP server on a network".
This is the case for libvirt-managed virtual networks.

The effect of this is that VMs that fail to renew their DHCP lease
in time (e.g. if the VM or host is suspended) will be able to
re-acquire the lease even if it's expired, unless the IP address has
been taken by some other host. This avoids various annoyances caused
by changing VM IP addresses.

src/network/bridge_driver.c
tests/networkxml2confdata/dhcp6-nat-network.conf
tests/networkxml2confdata/dhcp6host-routed-network.conf
tests/networkxml2confdata/isolated-network.conf
tests/networkxml2confdata/nat-network-dns-srv-record-minimal.conf
tests/networkxml2confdata/nat-network-dns-srv-record.conf
tests/networkxml2confdata/nat-network-dns-txt-record.conf
tests/networkxml2confdata/nat-network-name-with-quotes.conf
tests/networkxml2confdata/nat-network.conf
tests/networkxml2confdata/netboot-network.conf
tests/networkxml2confdata/netboot-proxy-network.conf

index 7b99acafa8ba348eee819a7e75fd850b3122ebfa..72687dc227a53f4b6dd2f8132277e1f356f09800 100644 (file)
@@ -1258,8 +1258,10 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
 
         /* Note: the following is IPv4 only */
         if (VIR_SOCKET_ADDR_IS_FAMILY(&ipdef->address, AF_INET)) {
-            if (ipdef->nranges || ipdef->nhosts)
+            if (ipdef->nranges || ipdef->nhosts) {
                 virBufferAddLit(&configbuf, "dhcp-no-override\n");
+                virBufferAddLit(&configbuf, "dhcp-authoritative\n");
+            }
 
             if (ipdef->tftproot) {
                 virBufferAddLit(&configbuf, "enable-tftp\n");
index 17076b89d9d43fa5aecaf07ff321c8fefdc4f14f..d1058df3b65e17e2345a35148b7c1385e9c5a4d9 100644 (file)
@@ -10,6 +10,7 @@ bind-dynamic
 interface=virbr0
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-range=2001:db8:ac10:fd01::1:10,2001:db8:ac10:fd01::1:ff,64
 dhcp-lease-max=493
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
index 5728ee43087c146d635b2506d066f7f8139e3fcc..87a149880992da909765c6a091155e32e50741a9 100644 (file)
@@ -10,6 +10,7 @@ bind-dynamic
 interface=virbr1
 dhcp-range=192.168.122.1,static
 dhcp-no-override
+dhcp-authoritative
 dhcp-range=2001:db8:ac10:fd01::1,static,64
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/local.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/local.addnhosts
index fbdf75a7de458926a66bf8e9da5d8743c81d3286..ce4a59f6c1a719feb0347f208181f543d9d73fe9 100644 (file)
@@ -12,6 +12,7 @@ dhcp-option=3
 no-resolv
 dhcp-range=192.168.152.2,192.168.152.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/private.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/private.addnhosts
index 08ed67204b4247927db367826190ee8056088813..f35ea1d5d42d7fa4c7472c08b6bf0a28694b6ca6 100644 (file)
@@ -15,6 +15,7 @@ listen-address=10.24.10.1
 srv-host=_name._tcp
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index d7de422c71e2b01d0d6663a307645a42fae1ee10..af1ed707585154139baaa467bd1ef9c6948f9095 100644 (file)
@@ -17,6 +17,7 @@ srv-host=_name6._tcp.test6.com,test6.example.com,6666,0,666
 srv-host=_name7._tcp.test7.com,test7.example.com,1,0,777
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index 44ed6bd1898ee7e3a8307490d29a84c137fc7532..7f560fbb5c76ca8222817b30417e589425635d12 100644 (file)
@@ -11,6 +11,7 @@ interface=virbr0
 txt-record=example,example value
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index a1c839e74afa0a0622dcb33904d6d97cd8195c38..36e11d17b9906cc5ff75366fca150ecd7693de32 100644 (file)
@@ -15,6 +15,7 @@ listen-address=10.24.10.1
 srv-host=_name._tcp
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default&quot;with&quot;quotes&quot;.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default&quot;with&quot;quotes&quot;.addnhosts
index 34d5b17d8ad2dfc2257e17ccfa935a4af16e3cb6..a3c8b102d302d13f097dc6b0be932a1fbaedf821 100644 (file)
@@ -10,6 +10,7 @@ bind-dynamic
 interface=virbr0
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
 addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
index 4b8f0cc457788c56b73f3864dbd125d2ac383d48..b554a5456c6ab0c831a400ffd3454deb8fb19631 100644 (file)
@@ -12,6 +12,7 @@ bind-interfaces
 listen-address=192.168.122.1
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 enable-tftp
 tftp-root=/var/lib/tftproot
 dhcp-boot=pxeboot.img
index 61a025c3e211fc020be7281889789b6798bcf39d..afb4033f7eda4e00e8ac8f59bc7f0b739fe9098e 100644 (file)
@@ -12,6 +12,7 @@ bind-interfaces
 listen-address=192.168.122.1
 dhcp-range=192.168.122.2,192.168.122.254
 dhcp-no-override
+dhcp-authoritative
 dhcp-boot=pxeboot.img,,10.20.30.40
 dhcp-lease-max=253
 dhcp-hostsfile=/var/lib/libvirt/dnsmasq/netboot.hostsfile