aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2013-03-04 11:55:26 +0100
committerTobias Brunner <tobias@strongswan.org>2013-03-05 17:40:13 +0100
commit45ee7c9429dc61ac355e5bebbaa77e711495cb67 (patch)
tree4d92be6e003904d1c8960fcf2b8062ac48e38eea
parent505745567481c0dc1a085d58b889d399be07f1fb (diff)
downloadstrongswan-45ee7c9429dc61ac355e5bebbaa77e711495cb67.tar.bz2
strongswan-45ee7c9429dc61ac355e5bebbaa77e711495cb67.tar.xz
testing: ssh script accepts IP addresses instead of host names
-rwxr-xr-xtesting/ssh15
1 files changed, 11 insertions, 4 deletions
diff --git a/testing/ssh b/testing/ssh
index 9e6d49a61..0de44d0a9 100755
--- a/testing/ssh
+++ b/testing/ssh
@@ -10,11 +10,18 @@ then
fi
host=$1
-ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
-if [ -z $ip ]
+echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*"
+if [ $? -eq 0 ]
then
- echo "Host '$host' unknown"
- exit 1
+ # assume we got an ip address
+ ip=$host
+else
+ ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
+ if [ -z $ip ]
+ then
+ echo "Host '$host' unknown"
+ exit 1
+ fi
fi
shift