diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-05-17 12:47:14 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-05-17 12:47:14 +0000 |
commit | de15765a3768bac4ae99c81ed04460da4760bbf6 (patch) | |
tree | b2531b0ebae4e570945a81c6e9746457398ddc6d /package/firewall/files/lib | |
parent | c8f606c7601dd8a00120ebf8e3b06ec3bfe59efd (diff) | |
download | openwrt-de15765a3768bac4ae99c81ed04460da4760bbf6.tar.gz openwrt-de15765a3768bac4ae99c81ed04460da4760bbf6.tar.bz2 openwrt-de15765a3768bac4ae99c81ed04460da4760bbf6.zip |
firewall: - defer firewall start until the first interface is brought up by hotplug, fixes race conditions on slow devices - create a file lock during firewall start and wait for it in hotplug events, prevents race conditions between start and addif - start firewall actions in background from hotplug handler since the firewall itself fires further hotplug events which results in a deadlock if not forked off - get loaded state direcly from the uci binary since updated value is not recognized by config_get after uci_set_state - bump package revision to r2
SVN-Revision: 21486
Diffstat (limited to 'package/firewall/files/lib')
-rw-r--r-- | package/firewall/files/lib/core.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/package/firewall/files/lib/core.sh b/package/firewall/files/lib/core.sh index 3fd98d1602..bf44231fb0 100644 --- a/package/firewall/files/lib/core.sh +++ b/package/firewall/files/lib/core.sh @@ -8,6 +8,8 @@ include /lib/network fw_start() { fw_init + lock /var/lock/firewall.start + FW_DEFAULTS_APPLIED= fw_is_loaded && { @@ -49,6 +51,8 @@ fw_start() { fw_callback post core uci_set_state firewall core loaded 1 + + lock -u /var/lock/firewall.start } fw_stop() { @@ -75,9 +79,8 @@ fw_reload() { } fw_is_loaded() { - local bool - config_get_bool bool core loaded 0 - return $((! $bool)) + local bool=$(uci -q -P /var/state get firewall.core.loaded) + return $((! ${bool:-0})) } |