fw_callback post core
+ uci_set_state firewall core zones "$FW_ZONES"
uci_set_state firewall core loaded 1
}
fw_callback pre stop
+ local old_zones z
+ config_get old_zones core zones
+ for z in $old_zones; do
+ local old_networks n i
+ config_get old_networks core "${z}_networks"
+ for n in $old_networks; do
+ config_get i core "${n}_ifname"
+ [ -n "$i" ] && env -i ACTION=remove ZONE="$z" \
+ INTERFACE="$n" DEVICE="$i" \
+ /sbin/hotplug-call firewall
+ done
+ done
+
fw_clear ACCEPT
fw_callback post stop
# Copyright (C) 2009-2010 OpenWrt.org
+fw__uci_state_add() {
+ local var="$1"
+ local item="$2"
+
+ local val="$(uci_get_state firewall core $var)"
+ uci_set_state firewall core $var "${val:+$val }$item"
+}
+
+fw__uci_state_del() {
+ local var="$1"
+ local item="$2"
+
+ local val=" $(uci_get_state firewall core $var) "
+ val="${val// $item / }"
+ val="${val# }"
+ val="${val% }"
+ uci_set_state firewall core $var "$val"
+}
+
fw_configure_interface() {
local iface=$1
local action=$2
fw__do_rules del $z $old_ifname $n
done
- [ -n "$old_subnets" ] || ACTION=remove ZONE="$z" INTERFACE="$iface" DEVICE="$ifname" /sbin/hotplug-call firewall
+ [ -n "$old_subnets" ] || {
+ fw__uci_state_del "${z}_networks" "$iface"
+ env -i ACTION=remove ZONE="$z" INTERFACE="$iface" DEVICE="$ifname" /sbin/hotplug-call firewall
+ }
done
local old_aliases
fw__do_rules add ${zone_name} "$ifname" "$aliasnet"
append new_zones $zone_name
- [ -n "$aliasnet" ] || ACTION=add ZONE="$zone_name" INTERFACE="$iface" DEVICE="$ifname" /sbin/hotplug-call firewall
+ [ -n "$aliasnet" ] || {
+ fw__uci_state_add "${zone_name}_networks" "${zone_network}"
+ env -i ACTION=add ZONE="$zone_name" INTERFACE="$iface" DEVICE="$ifname" /sbin/hotplug-call firewall
+ }
}
config_foreach load_zone zone