强化获取IP结果检测
This commit is contained in:
1 parent
ba3a2a49c6
commit
db88bc27d8
3 files changed
+14
-3
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user