+fw_get_family_mode() {
+ local hint="$1"
+ local zone="$2"
+ local mode="$3"
+
+ local ipv4 ipv6
+ [ -n "$FW_ZONES4$FW_ZONES6" ] && {
+ list_contains FW_ZONES4 $zone && ipv4=1 || ipv4=0
+ list_contains FW_ZONES6 $zone && ipv6=1 || ipv6=0
+ } || {
+ ipv4=$(uci_get_state firewall core ${zone}_ipv4 0)
+ ipv6=$(uci_get_state firewall core ${zone}_ipv6 0)
+ }
+
+ case "$hint:$ipv4:$ipv6" in
+ *4:1:*|*:1:0) echo 4 ;;
+ *6:*:1|*:0:1) echo 6 ;;
+ *) echo $mode ;;
+ esac
+}
+