summaryrefslogtreecommitdiff
path: root/includes.c
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2019-05-17 11:14:46 +0200
committerJo-Philipp Wich <jo@mein.io>2019-08-22 11:29:42 +0200
commit8c404ef02f0122ec90b48e122777ff6bfa715d7f (patch)
tree161071d9f19cdd0f15b77154415882995f88ae71 /includes.c
parentc1d3a4df49c9b9df38b546a1a094e63e107a1074 (diff)
downloadfirewall3-8c404ef02f0122ec90b48e122777ff6bfa715d7f.tar.gz
iptables.c: lock the xtables.lock
When using fw3 together with other applications or scripts a race conditions might occur. When fw3 is preparing the new tables, another application can use the executable `iptables` which modifies the kernel-tables. libxtables will notify this and fails when fw3 is committing the changes resulting in a failed firewall. Now waits in a while loop until the lock is gone, activate the lock itself and applies changes. To reproduce the bug the following two scripts should run in parrallel, after a few seconds the latter stop and leaves a broken firewall: while true; do iptables -N locking; done and while [ "$(iptables -w -L OUTPUT | wc -l)" -gt 2 ]; do fw3 reload; done The following message will appear Warning: iptc_commit(): Resource temporarily unavailable and connectivity is gone. Tested in an LXC and Qemu container. Signed-off-by: Alexander Couzens <lynxis@fe80.eu> [fixed waiting for unlock and commit message] Signed-off-by: Paul Spooren <mail@aparcar.org>
Diffstat (limited to 'includes.c')
0 files changed, 0 insertions, 0 deletions