]> git.ipfire.org Git - thirdparty/libvirt.git/commit
network: don't require private addresses if dnsmasq uses SO_BINDTODEVICE
authorLaine Stump <laine@laine.org>
Mon, 17 Dec 2012 17:49:18 +0000 (12:49 -0500)
committerLaine Stump <laine@laine.org>
Mon, 17 Dec 2012 20:51:19 +0000 (15:51 -0500)
commit4b31da3478ea8d4279aaba4ebe55a332ce2772fa
tree59f9da6022c971d22e876de2eb9dcf0436074ec2
parentcdfe739c97a2b4876dd9c6d8fbae71f1ff3ec143
network: don't require private addresses if dnsmasq uses SO_BINDTODEVICE

This is yet another refinement to the fix for CVE-2012-3411:

   https://bugzilla.redhat.com/show_bug.cgi?id=833033

It turns out that it would be very intrusive to correctly backport the
entire --bind-dynamic option to older dnsmasq versions
(e.g. dnsmasq-2.48 that is used on RHEL6.x and CentOS 6.x), but very
simple to patch those versions to just use SO_BINDTODEVICE on all
their listening sockets (SO_BINDTODEVICE also has the desired effect
of permitting only traffic that was received on the interface(s) where
dnsmasq was set to listen.)

This patch modifies the dnsmasq capabilities detection to detect the
string:

    --bind-interfaces with SO_BINDTODEVICE

in the output of "dnsmasq --version", and in that case realize that
using the old --bind-interfaces option is just as safe as
--bind-dynamic (and therefore *not* forbid creation of networks that
use public IP address ranges).

If -bind-dynamic is available, it is still preferred over
--bind-interfaces.

Note that this patch does no harm in upstream, or in any distro's
downstream if it happens to end up there, but builds for distros that
have a new enough dnsmasq to support --bind-dynamic do *NOT* need to
specifically backport this patch; it's only required for distro
releases that have dnsmasq too old to have --bind-dynamic (and those
distros will need to add the SO_BINDTODEVICE patch to dnsmasq,
*including the extra string in the --version output*, as well.
src/network/bridge_driver.c
src/util/dnsmasq.c
src/util/dnsmasq.h