fi
-# Rules, Forwardings, advanced config and includes
-
-for config in freifunk profile_$community; do
-
- config_load $config
-
- for section in advanced include fw_rule fw_forwarding; do
- handle_firewall() {
- local options=$(uci show $config."$1")
- options=$(echo "$options" | sed -e "s/fw_//g" -e "s/^$config/firewall/g")
- for o in $options; do
- uci set $o
- done
- }
- config_foreach handle_firewall $section
- done
-done
+# Rules, Forwardings, advanced config and includes from freifunk and
+# profile_$community config files.
+
+add_fw_rules() {
+ config_cb() {
+ local type="$1"
+ local name="$2"
+ local allowed_section_types="advanced include fw_rule fw_forwarding"
+ if is_in_list "$allowed_section_types" $type ; then
+ uci set firewall.${name}="${type/fw_/}"
+ option_cb() {
+ local option="$1"
+ local value="$2"
+ uci set firewall.${CONFIG_SECTION}.${option}="$value"
+ }
+ else
+ option_cb() { return; }
+ fi
+ }
+ config_load freifunk
+ config_load profile_${community}
+}
+add_fw_rules
+
# If we use auto-ipv6-dhcp then allow 547/udp on the freifunk zone
if [ "$ipv6_config" = "auto-ipv6-dhcpv6" ]; then