Added get_ip_version() function.

This commit is contained in:
Mikhail Efremov 2012-12-13 19:40:10 +04:00
parent 4ea61002cc
commit e1383945b3

View File

@ -204,6 +204,20 @@ ipv6addr_is_in_subnet()
### common helpers
get_ip_version()
{
local ip="$1"
if valid_ipv4 "$ip"; then
echo 4
elif valid_ipv6addr "$ip"; then
echo 6
else
return 1
fi
return 0
}
next_iface()
{
local name="$1";shift