quick fix for v6 adresses being rejected

This commit is contained in:
nils 2021-12-06 17:20:32 +01:00
parent 44b684e721
commit 6e40823b90
1 changed files with 6 additions and 1 deletions

View File

@ -86,7 +86,12 @@ function set_argvars {
function validate {
for arg in $@; do
if ip route show " $arg" 2&> /dev/null;then
if [[ ! "$arg" =~ : ]];then
arg=" $arg" # fixes issue with leading space on ipv6 adresses
else
only="-6" # enable ipv6, this needs a more complex function to avoid treating every argument as v6
fi
if ip route show "$arg" 2&> /dev/null;then
hosts="$hosts $arg"
elif nslookup "$arg" > /dev/null;then
hosts="$hosts $arg"