diff --git a/share/pot/network.sh b/share/pot/network.sh index 84b5d80..a97379d 100644 --- a/share/pot/network.sh +++ b/share/pot/network.sh @@ -243,7 +243,7 @@ _get_alias_ipv4() # $2 ipaddr _get_alias_ipv6() { - local _i _ip _nic _output + local _i _ip _nic _output _pfxlen _output= if [ "$( _get_pot_network_stack "$1" )" != "ipv4" ]; then for _i in $2 ; do @@ -254,12 +254,21 @@ _get_alias_ipv6() _nic="$POT_EXTIF" _ip="$_i" fi + if echo "$_ip" | grep -qF '/' ; then + _pfxlen="$(echo "$_ip" | cut -f 2 -d '/' )" + _ip="$(echo "$_ip" | cut -f 1 -d '/' )" + else + _pfxlen="" + fi if potnet ip6check -H "$_ip" 2> /dev/null ; then if [ -z "$_output" ]; then _output="$_nic|$_ip" else _output="$_output,$_nic|$_ip" fi + if [ -n "$_pfxlen" ]; then + _output="$_output/$_pfxlen" + fi fi done fi