From 89f7addccd706c02acdcd3ca3f478af94fcb7f41 Mon Sep 17 00:00:00 2001 From: ZiMing Mo Date: Wed, 25 May 2022 16:13:40 +0800 Subject: [PATCH] firewall3: fix locking issue (cherry picked from commit c7a557861a7f6cb22d1a17dc01e8240c246b1f04) --- .../001-firewall3-fix-locking-issue.patch | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 package/network/config/firewall/patches/001-firewall3-fix-locking-issue.patch diff --git a/package/network/config/firewall/patches/001-firewall3-fix-locking-issue.patch b/package/network/config/firewall/patches/001-firewall3-fix-locking-issue.patch new file mode 100644 index 0000000000..8657b5c710 --- /dev/null +++ b/package/network/config/firewall/patches/001-firewall3-fix-locking-issue.patch @@ -0,0 +1,38 @@ +From df1306a96127e91ff2d513a0a67345baaf61d113 Mon Sep 17 00:00:00 2001 +From: Florian Eckert +Date: Fri, 19 Nov 2021 09:51:02 +0100 +Subject: [PATCH] firewall3: fix locking issue + +By calling the command 'fw3 reload' several times at the same time, I +noticed that the locking was not working properly. It happened from time +to time that some firewall rules were present twice in the system! + +By removing the 'unlink' systemcall, this error no longer occurred on my +systems. + +Since fw3 does not run as a service, it makes no sense to delete this +lock file every time a filehandler is no longer open on this lock file, +because fw3 binary is not running. + +If fw3 does run as a service then we can remove this lock file on +service stop. But this is not the case for fw3. + +Signed-off-by: Florian Eckert +--- + utils.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/utils.c b/utils.c +index 17d5bf9..92e966c 100644 +--- a/utils.c ++++ b/utils.c +@@ -397,7 +397,6 @@ fw3_unlock_path(int *fd, const char *lockpath) + warn("Cannot release exclusive lock: %s", strerror(errno)); + + close(*fd); +- unlink(FW3_LOCKFILE); + + *fd = -1; + } +-- +2.30.2