X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/5acb7ec58a5220ac99bbc6ca274bc698191fff49..205e31dc60862f4f29cc92d727c4ec9d63a33a79:/package/firewall/files/lib/core.sh?ds=sidebyside diff --git a/package/firewall/files/lib/core.sh b/package/firewall/files/lib/core.sh index bf44231fb..5880cd3ac 100644 --- a/package/firewall/files/lib/core.sh +++ b/package/firewall/files/lib/core.sh @@ -8,14 +8,13 @@ include /lib/network fw_start() { fw_init - lock /var/lock/firewall.start - FW_DEFAULTS_APPLIED= fw_is_loaded && { echo "firewall already loaded" >&2 exit 1 } + uci_set_state firewall core "" firewall_state fw_clear DROP @@ -51,8 +50,6 @@ fw_start() { fw_callback post core uci_set_state firewall core loaded 1 - - lock -u /var/lock/firewall.start } fw_stop() { @@ -66,6 +63,11 @@ fw_stop() { uci_revert_state firewall config_clear + + local h + for h in $FW_HOOKS; do unset $h; done + + unset FW_HOOKS unset FW_INITIALIZED } @@ -79,7 +81,7 @@ fw_reload() { } fw_is_loaded() { - local bool=$(uci -q -P /var/state get firewall.core.loaded) + local bool=$(uci_get_state firewall.core.loaded) return $((! ${bool:-0})) } @@ -126,8 +128,10 @@ fw_init() { . $file for hk in $hooks; do for pp in pre post; do - type ${lib}_${pp}_${hk}_cb >/dev/null && + type ${lib}_${pp}_${hk}_cb >/dev/null && { append FW_CB_${pp}_${hk} ${lib} + append FW_HOOKS FW_CB_${pp}_${hk} + } done done done