强化获取IP结果检测

This commit is contained in:
若海 committed 2021-03-03 10:53:33 +08:00
1 parent ba3a2a49c6
commit db88bc27d8
3 files changed
+14 -3

No files matched your search

+10
View File
@@ -49,6 +49,11 @@ arWanIp4() {
fi
fi
if [ -z "$hostIp" ]; then
echo "arWanIp4 - Can't get ip address"
return 1
fi
if [ -n "$(echo $hostIp | grep -Ev '^[0-9\.]+$')" ]; then
echo "arWanIp4 - Invalid ip address $hostIp"
return 1
@@ -75,6 +80,11 @@ arWanIp6() {
;;
esac
if [ -z "$hostIp" ]; then
echo "arWanIp6 - Can't get ip address"
return 1
fi
if [ -n "$(echo $hostIp | grep -Ev '^[0-9a-fA-F:]+$')" ]; then
echo "arWanIp6 - Invalid ip address"
return 1