summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xretiolum/scripts/tinc_setup/new_install.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh
index 41a1f73a..3f904871 100755
--- a/retiolum/scripts/tinc_setup/new_install.sh
+++ b/retiolum/scripts/tinc_setup/new_install.sh
@@ -58,7 +58,7 @@ EOF
#convert hostmask to subnetmask only version 4
host2subnet()
{
- NEEDDOTSINSUB=$(expr 3 - $(echo $SUBNET4 | sed 's/[0-9]*//g'))
+ NEEDDOTSINSUB=$(expr 3 - $( echo $SUBNET4 | tr -C -d . | wc -c))
FULLSUBNET=$(echo $SUBNET4$(eval "printf '.0'%.0s {1..${#NEEDDOTSINSUB}}"s))
result=$(($(($((1 << $1)) - 1)) << $((32 - $1))))
byte=""