diff --git a/scripts/shield-trigger b/scripts/shield-trigger index 9aed262..65adf85 100755 --- a/scripts/shield-trigger +++ b/scripts/shield-trigger @@ -27,12 +27,9 @@ null_route() { # louzy detection of IPv4 or IPv6 address # TASK="$1" - INET=$(echo "$2" | sed 's/[0-9\.]//g') - if [ -z "$INET" ] - then - INET="" - GW="127.0.0.1" - else + INET="" + GW="127.0.0.1" + if [ "${2#*:}" != "$2" ] ; then INET="-f inet6" GW="::1" fi diff --git a/scripts/shield-trigger-iptables b/scripts/shield-trigger-iptables index 3f7e92b..51d446f 100755 --- a/scripts/shield-trigger-iptables +++ b/scripts/shield-trigger-iptables @@ -22,16 +22,8 @@ # run_iptables() { - # - # louzy detection of IPv4 or IPv6 address - # - IPT=$(echo "$2" | sed 's/[0-9\.]//g') - if [ -z "$IPT" ] - then - IPT=iptables - else - IPT=ip6tables - fi + IPT="iptables" + [ "${2#*:}" != "$2" ] && IPT="ip6tables" # switch -A for iptables to -I if [ "$1" = "-A" ]