File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ check_result() {
9797# Argument list checker
9898check_args () {
9999 if [ " $1 " -gt " $2 " ]; then
100- echo " Usage: $SCRIPT $3 "
100+ echo " Usage: $( basename $0 ) $3 "
101101 check_result $E_ARGS " not enought arguments" > /dev/null
102102 fi
103103}
@@ -501,15 +501,14 @@ is_alias_format_valid() {
501501is_ip_format_valid () {
502502 object_name=${2-ip}
503503 ip_regex=' ([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
504- ip_clean=$( echo " ${1%/ [0-9][0-9]} " )
505- ip_clean=$( echo " ${1%/ [0-9]} " )
504+ ip_clean=$( echo " ${1%/* } " )
506505 if ! [[ $ip_clean =~ ^$ip_regex \. $ip_regex \. $ip_regex \. $ip_regex $ ]]; then
507506 check_result $E_INVALID " invalid $object_name format :: $1 "
508507 fi
509508 if [ $1 != " $ip_clean " ]; then
510509 ip_cidr=" $ip_clean /"
511510 ip_cidr=$( echo " ${1# $ip_cidr } " )
512- if [[ " $ip_cidr " -gt 32 ]]; then
511+ if [[ " $ip_cidr " -gt 32 ]] || [[ " $ip_cidr " =~ [:alnum:] ]] ; then
513512 check_result $E_INVALID " invalid $object_name format :: $1 "
514513 fi
515514 fi
You can’t perform that action at this time.
0 commit comments