1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-07-02 21:38:54 +03:00

[package] firewall: rework interface address determination to skip ipv6 addresses

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31755 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-16 13:37:49 +00:00
parent 0945d8e239
commit b8351c325d

View File

@ -9,24 +9,34 @@ find_iface_address()
local ipaddr="$2"
local prefix="$3"
local idx=1
local tmp="$(ubus call network.interface."$iface" status 2>/dev/null)"
json_load "${tmp:-{}}"
json_get_type tmp address
if [ "$tmp" = array ]; then
json_select address
json_get_type tmp 1
if [ "$tmp" = object ]; then
while true; do
json_get_type tmp $idx
[ "$tmp" = object ] || break
json_select 1
[ -n "$ipaddr" ] && json_get_var "$ipaddr" address
[ -n "$prefix" ] && json_get_var "$prefix" mask
json_select $((idx++))
json_get_var tmp address
fi
case "$tmp" in
*:*) json_select .. ;;
*)
[ -n "$ipaddr" ] && json_get_var $ipaddr address
[ -n "$prefix" ] && json_get_var $prefix mask
return 0
;;
esac
done
fi
return 1
}
if [ "$ACTION" = "add" ] && [ "$INTERFACE" = "wan" ]; then