]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util/tests: enable locking on iptables/ebtables commandlines by default
authorLaine Stump <laine@redhat.com>
Tue, 17 Nov 2020 01:02:43 +0000 (20:02 -0500)
committerLaine Stump <laine@redhat.com>
Tue, 24 Nov 2020 19:21:29 +0000 (14:21 -0500)
commit0a867cd895f06134d24eb27070285bb4b50c088f
treebc03ecf617ea316726fabc68e818b953dc9bf130
parente66451f685e29ffe4be5a060ef64b19961ad4bb5
util/tests: enable locking on iptables/ebtables commandlines by default

iptables and ip6tables have had a "-w" commandline option to grab a
systemwide lock that prevents two iptables invocations from modifying
the iptables chains since 2013 (upstream commit 93587a04 in
iptables-1.4.20).  Similarly, ebtables has had a "--concurrent"
commandline option for the same purpose since 2011 (in the upstream
ebtables commit f9b4bcb93, which was present in ebtables-2.0.10.4).

Libvirt added code to conditionally use the commandline option for
iptables/ip6tables in upstream commit ba95426d6f (libvirt-1.2.0,
November 2013), and for ebtables in upstream commit dc33e6e4a5
(libvirt-1.2.11, November 2014) (the latter actually *re*-added the
locking for iptables/ip6tables, as it had accidentally been removed
during a refactor of firewall code in the interim).

I say "conditionally" because a check was made during firewall module
initialization that tried executing a test command with the
-w/--concurrent option, and only continued using it for actual
commands if that test command completed successfully. At the time the
code was added this was a reasonable thing to do, as it had been less
than a year since introduction of -w to iptables, so many distros
supported by libvirt were still using iptables (and possibly even
ebtables) versions too old to have the new commandline options.

It is now 2020, and as far as I can discern from repology.org (and
manually examining a RHEL7.9 system), every version of every distro
that is supported by libvirt now uses new enough versions of both
iptables and ebtables that they all have support for -w/--concurrent.
That means we can finally remove the conditional code and simply
always use them.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/libvirt_private.syms
src/util/virfirewall.c
src/util/virfirewall.h
tests/networkxml2firewalltest.c
tests/nwfilterebiptablestest.c
tests/nwfilterxml2firewalltest.c
tests/virfirewalltest.c