mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] iptables: serialize startup service units
@ 2020-01-22 11:21 Juergen Borleis
  0 siblings, 0 replies; only message in thread
From: Juergen Borleis @ 2020-01-22 11:21 UTC (permalink / raw)
  To: ptxdist

Since iptables-1.8.x the tool complains at run-time if a second instance
holds the shared lock:

   Another app is currently holding the xtables lock. Perhaps you want to use the -w option?

If IPv4 and IPv6 is enabled, this concurrent situation can happen and at
the end one of both setups isn't done (first instance wins).

By serializing both service units this concurrent situation cannot occur
and both setups are done as expected.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
---
 projectroot/usr/lib/systemd/system/ip6tables.service | 2 ++
 projectroot/usr/lib/systemd/system/iptables.service  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/projectroot/usr/lib/systemd/system/ip6tables.service b/projectroot/usr/lib/systemd/system/ip6tables.service
index e842cc197..7cf9ab88b 100644
--- a/projectroot/usr/lib/systemd/system/ip6tables.service
+++ b/projectroot/usr/lib/systemd/system/ip6tables.service
@@ -3,6 +3,8 @@ Description=Packet Filtering Framework
 DefaultDependencies=no
 After=systemd-sysctl.service
 Before=sysinit.target
+# ensure, we are running after IPv4
+After=iptables.service
 ConditionFileNotEmpty=/etc/iptables/rules.v6
 [Service]
 Type=oneshot
diff --git a/projectroot/usr/lib/systemd/system/iptables.service b/projectroot/usr/lib/systemd/system/iptables.service
index fa4a8b367..29999628e 100644
--- a/projectroot/usr/lib/systemd/system/iptables.service
+++ b/projectroot/usr/lib/systemd/system/iptables.service
@@ -3,6 +3,8 @@ Description=Packet Filtering Framework
 DefaultDependencies=no
 After=systemd-sysctl.service
 Before=sysinit.target
+# ensure, we are running before IPv6
+Before=ip6tables.service
 ConditionFileNotEmpty=/etc/iptables/rules.v4
 [Service]
 Type=oneshot
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-22 11:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 11:21 [ptxdist] [PATCH] iptables: serialize startup service units Juergen Borleis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox