don't validate -iprange value
We generally don't validate arguments in the script unless we process them there.
This commit is contained in:
1 parent
313a95a467
commit
bf4c75b1cd
1 file changed
-9
@@ -95,14 +95,6 @@ is_cidr() {
|
|||||||
echo "$1" | grep -E "^$CIDR_REGEXP$" >/dev/null
|
echo "$1" | grep -E "^$CIDR_REGEXP$" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
validate_cidr() {
|
|
||||||
if ! is_cidr "$1" ; then
|
|
||||||
echo "Invalid address prefix: $1" >&2
|
|
||||||
echo "Must be in CIDR notation <ip_address>/<prefix_length>, e.g. 10.2.1.1/24" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
collect_cidr_args() {
|
collect_cidr_args() {
|
||||||
CIDR_ARGS=""
|
CIDR_ARGS=""
|
||||||
CIDR_ARG_COUNT=0
|
CIDR_ARG_COUNT=0
|
||||||
@@ -976,7 +968,6 @@ case "$COMMAND" in
|
|||||||
;;
|
;;
|
||||||
-iprange)
|
-iprange)
|
||||||
[ $# -gt 1 ] || usage
|
[ $# -gt 1 ] || usage
|
||||||
[ -z "$2" ] || validate_cidr "$2"
|
|
||||||
IPRANGE="$2"
|
IPRANGE="$2"
|
||||||
IPRANGE_SPECIFIED=1
|
IPRANGE_SPECIFIED=1
|
||||||
shift 2
|
shift 2
|
||||||
|
|||||||
Reference in new issue
Block a user