[package] firewall: implement disable_ipv6 uci option
[openwrt.git] / package / firewall / files / lib / core.sh
index 3fd98d1..5880cd3 100644 (file)
@@ -14,6 +14,7 @@ fw_start() {
                echo "firewall already loaded" >&2
                exit 1
        }
+
        uci_set_state firewall core "" firewall_state
 
        fw_clear DROP
@@ -62,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
 }
 
@@ -75,9 +81,8 @@ fw_reload() {
 }
 
 fw_is_loaded() {
-       local bool
-       config_get_bool bool core loaded 0
-       return $((! $bool))
+       local bool=$(uci_get_state firewall.core.loaded)
+       return $((! ${bool:-0}))
 }
 
 
@@ -123,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
This page took 0.029574 seconds and 4 git commands to generate.