12 config_get iface "$state" iface
14 if [ "$iface" = "$INTERFACE" ]; then
15 config_get ifname "$state" ifname
16 config_get ipaddr "$state" ipaddr
17 config_get netmask "$state" netmask
18 config_get gateway "$state" gateway
20 logger -t firewall.freifunk "removing local restriction to $iface($gateway)"
21 iptables -D forwarding_rule ! -i $ifname -o $ifname -d $ipaddr/$netmask -j REJECT --reject-with icmp-host-prohibited
22 uci_revert_state firewall "$state"
29 config_get name "$1" name
31 if [ "$name" = "$ZONE" ]; then
32 config_get_bool local_restrict "$1" local_restrict
36 if [ "$ACTION" = add ]; then
45 config_get ipaddr "$INTERFACE" ipaddr
46 config_get netmask "$INTERFACE" netmask
47 config_get gateway "$INTERFACE" gateway
49 if [ -n "$gateway" ] && [ "$gateway" != 0.0.0.0 ]; then
53 config_foreach get_enabled zone
55 if [ "$local_restrict" = 1 ]; then
56 logger -t firewall.freifunk "restricting local access to $DEVICE($gateway)"
57 iptables -I forwarding_rule ! -i $DEVICE -o $DEVICE -d $ipaddr/$netmask -j REJECT --reject-with icmp-host-prohibited
58 local state="restricted_gw_${INTERFACE}"
59 uci_set_state firewall "$state" "" restricted_gw_state
60 uci_set_state firewall "$state" iface "$INTERFACE"
61 uci_set_state firewall "$state" ifname "$DEVICE"
62 uci_set_state firewall "$state" ipaddr "$ipaddr"
63 uci_set_state firewall "$state" netmask "$netmask"
64 uci_set_state firewall "$state" gateway "$gateway"
68 elif [ "$ACTION" = remove ]; then
70 config_foreach clear_restricted_gw restricted_gw_state