]> git.ipfire.org Git - thirdparty/libvirt.git/commit
network: add netmask to dhcp range of dnsmasq conf file for IPv4
authorLaine Stump <laine@laine.org>
Mon, 18 Feb 2019 21:34:50 +0000 (16:34 -0500)
committerLaine Stump <laine@laine.org>
Thu, 21 Feb 2019 18:06:16 +0000 (13:06 -0500)
commit82fe58ff2680c1790800c352f0f232d162438655
tree4510e5e71fa698c81b1ddd92839eaab14f862303
parentabb293a56f449c7079876fa0622029400bec2eaf
network: add netmask to dhcp range of dnsmasq conf file for IPv4

dnsmasq documentation says that the *IPv4* prefix/network
address/broadcast address sent to dhcp clients will be automatically
determined by dnsmasq by looking at the interface it's listening on,
so the original libvirt code did not add a netmask to the dnsmasq
commandline (or later, the dnsmasq conf file).

For *IPv6* however, dnsmasq apparently cannot automatically determine
the prefix (functionally the same as a netmask), and it must be
explicitly provided in the conf file (as a part of the dhcp-range
option). So many years after IPv4 DHCP support had been added, when
IPv6 dhcp support was added the prefix was included at the end of the
dhcp-range setting, but only for IPv6.

A user had reported a bug on a host where one of the interfaces was a
superset of the libvirt network where dhcp is needed (e.g., the host's
ethernet is 10.0.0.20/8, and the libvirt network is 10.10.0.1/24). For
some reason dnsmasq was supplying the netmask for the /8 network to
clients requesting an address on the /24 interface.

This seems like a bug in dnsmasq, but even if/when it gets fixed
there, it looks like there is no harm in just always adding the
netmask to all IPv4 dhcp-range options similar to how prefix is added
to all IPv6 dhcp-range options.

Signed-off-by: Laine Stump <laine@laine.org>
Reviewed-by: John Ferlan <jferlan@redhat.com>
12 files changed:
src/network/bridge_driver.c
tests/networkxml2confdata/dhcp6-nat-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-mtu.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
tests/networkxml2confdata/ptr-domains-auto.conf