aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harkin <ryan.harkin@linaro.org>2021-01-25 12:12:33 +0000
committerRyan Harkin <ryan.harkin@linaro.org>2021-01-25 12:12:33 +0000
commit138b05ee5cc94e1db922dc7b686183f079f985ab (patch)
tree01c904c580c4781ad5c52ab5c0d1495e1824b27f
parent32159e41eba1e7a8b5954400c750ea9974f1cf6d (diff)
fixup! fixup! fixup! network-test addedlinaro-20210125-001
-rwxr-xr-xautomated/linux/network-test/network-test.sh18
1 files changed, 8 insertions, 10 deletions
diff --git a/automated/linux/network-test/network-test.sh b/automated/linux/network-test/network-test.sh
index 4fc3624..d277e01 100755
--- a/automated/linux/network-test/network-test.sh
+++ b/automated/linux/network-test/network-test.sh
@@ -223,15 +223,16 @@ is_valid_ip() {
local ip=$1
local is_valid=1
- if expr "$ip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
- for i in 1 2 3 4; do
- if [ $(echo "$ip" | cut -d. -f$i) -gt 255 ]; then
- return 1
+ if [ -z "${ip}"]; then
+ if expr "$ip" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' >/dev/null; then
+ for i in 1 2 3 4; do
+ if [ $(echo "$ip" | cut -d. -f$i) -gt 255 ]; then
+ return 1
+ fi
+ done
+ is_valid=0
fi
- done
- is_valid=0
fi
-
return $is_valid
}
@@ -384,9 +385,6 @@ assign_ipaddr(){
echo "Check IP address removed"
show_ip "${interface}"
IPADDR=$(get_ipaddr "${interface}")
- echo "Check if IP address '${IPADDR}' is valid"
- is_valid_ip "${IPADDR}" && echo "is_valid_ip returns 0 ($?}"
- is_valid_ip "${IPADDR}" || echo "is_valid_ip returns non-zero ($?)"
is_valid_ip "${IPADDR}"
check_return "ethernet-${interface}-${test_string}-remove-ipaddr"
fi