Added get_ip_version() function.
This commit is contained in:
parent
4ea61002cc
commit
e1383945b3
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user