[libvirt] [PATCH] bridge: Add --dhcp-no-override option to dnsmasq

--dhcp-no-override description from dnsmasq man page: Disable re-use of the DHCP servername and filename fields as extra option space. If it can, dnsmasq moves the boot server and filename information (from dhcp-boot) out of their dedicated fields into DHCP options. This make extra space available in the DHCP packet for options but can, rarely, confuse old or broken clients. This flag forces "simple and safe" behaviour to avoid problems in such a case. It seems some virtual network card ROMs are this old/buggy so let's add --dhcp-no-override as a workaround for them. We don't use extra DHCP options so this should be safe. --- src/network/bridge_driver.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index f247a0f..d6d3068 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -427,6 +427,8 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, (2 * network->def->nranges) + /* --dhcp-range 10.0.0.2,10.0.0.254 */ /* --dhcp-lease-max=xxx if needed */ (network->def->nranges ? 1 : 0) + + /* --dhcp-no-override if needed */ + (network->def->nranges ? 1 : 0) + /* --dhcp-hostsfile=/var/lib/dnsmasq/$NAME.hostsfile */ (network->def->nhosts > 0 ? 1 : 0) + /* --enable-tftp --tftp-root /srv/tftp */ @@ -497,6 +499,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, if (network->def->nranges > 0) { snprintf(buf, sizeof(buf), "--dhcp-lease-max=%d", nbleases); APPEND_ARG(*argv, i++, buf); + APPEND_ARG(*argv, i++, "--dhcp-no-override"); } if (network->def->nhosts > 0) { -- 1.7.2

On 08/11/2010 12:41 PM, Jiri Denemark wrote:
--dhcp-no-override description from dnsmasq man page:
Disable re-use of the DHCP servername and filename fields as extra option space. If it can, dnsmasq moves the boot server and filename information (from dhcp-boot) out of their dedicated fields into DHCP options. This make extra space available in the DHCP packet for options but can, rarely, confuse old or broken clients. This flag forces "simple and safe" behaviour to avoid problems in such a case.
It seems some virtual network card ROMs are this old/buggy so let's add --dhcp-no-override as a workaround for them. We don't use extra DHCP options so this should be safe. --- src/network/bridge_driver.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Are we guaranteed that --dhcp-no-override is supported as far back as the earliest version of dnsmasq that we claim to run with, or do we need to add some --help parsing? Conditional ACK if we are happy that all versions of dnsmasq that we care about can support this flag. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

It seems some virtual network card ROMs are this old/buggy so let's add --dhcp-no-override as a workaround for them. We don't use extra DHCP options so this should be safe.
Are we guaranteed that --dhcp-no-override is supported as far back as the earliest version of dnsmasq that we claim to run with, or do we need to add some --help parsing?
Hmm, good point. The option was added into dnsmasq-2.41 released on 12-Feb-2008. I'm not sure what version we claim to run with (libvirt.spec just requires dnsmasq without any version restrictions) so it might be worth parsing --help for that. What others think about the dnsmasq version we support? Jirka

Are we guaranteed that --dhcp-no-override is supported as far back as the earliest version of dnsmasq that we claim to run with, or do we need to add some --help parsing?
Hmm, good point. The option was added into dnsmasq-2.41 released on 12-Feb-2008. I'm not sure what version we claim to run with (libvirt.spec just requires dnsmasq without any version restrictions) so it might be worth parsing --help for that. What others think about the dnsmasq version we support?
As confirmed on irc, the oldest distros we care about are RHEL-5 and Debian stable and both have dnsmasq-2.45. Requiring 2.41 is fine then. Given the conditional ACK from Eric, I'm going to push the following patch soon: bridge: Add --dhcp-no-override option to dnsmasq --dhcp-no-override description from dnsmasq man page: Disable re-use of the DHCP servername and filename fields as extra option space. If it can, dnsmasq moves the boot server and filename information (from dhcp-boot) out of their dedicated fields into DHCP options. This make extra space available in the DHCP packet for options but can, rarely, confuse old or broken clients. This flag forces "simple and safe" behaviour to avoid problems in such a case. It seems some virtual network card ROMs are this old/buggy so let's add --dhcp-no-override as a workaround for them. We don't use extra DHCP options so this should be safe. The option was added in dnsmasq-2.41, which becomes the minimum required version. --- libvirt.spec.in | 4 ++-- src/network/bridge_driver.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index c666a70..cc3e8e2 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -200,7 +200,7 @@ Requires: %{name}-client = %{version}-%{release} Requires: bridge-utils %endif %if %{with_network} -Requires: dnsmasq +Requires: dnsmasq >= 2.41 Requires: iptables %endif %if %{with_nwfilter} @@ -298,7 +298,7 @@ BuildRequires: avahi-devel BuildRequires: libselinux-devel %endif %if %{with_network} -BuildRequires: dnsmasq +BuildRequires: dnsmasq >= 2.41 %endif BuildRequires: bridge-utils %if %{with_sasl} diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index f247a0f..d6d3068 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -427,6 +427,8 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, (2 * network->def->nranges) + /* --dhcp-range 10.0.0.2,10.0.0.254 */ /* --dhcp-lease-max=xxx if needed */ (network->def->nranges ? 1 : 0) + + /* --dhcp-no-override if needed */ + (network->def->nranges ? 1 : 0) + /* --dhcp-hostsfile=/var/lib/dnsmasq/$NAME.hostsfile */ (network->def->nhosts > 0 ? 1 : 0) + /* --enable-tftp --tftp-root /srv/tftp */ @@ -497,6 +499,7 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, if (network->def->nranges > 0) { snprintf(buf, sizeof(buf), "--dhcp-lease-max=%d", nbleases); APPEND_ARG(*argv, i++, buf); + APPEND_ARG(*argv, i++, "--dhcp-no-override"); } if (network->def->nhosts > 0) { -- 1.7.2
participants (2)
-
Eric Blake
-
Jiri Denemark