Merge "Make is_ipv4_address a bit more robust"

This commit is contained in:
Jenkins 2017-09-25 13:37:32 +00:00 committed by Gerrit Code Review
commit 4a50053c74

View File

@ -2014,7 +2014,7 @@ function cidr2netmask {
# Check if this is a valid ipv4 address string # Check if this is a valid ipv4 address string
function is_ipv4_address { function is_ipv4_address {
local address=$1 local address=$1
local regex='([0-9]{1,3}.){3}[0-9]{1,3}' local regex='([0-9]{1,3}\.){3}[0-9]{1,3}'
# TODO(clarkb) make this more robust # TODO(clarkb) make this more robust
if [[ "$address" =~ $regex ]] ; then if [[ "$address" =~ $regex ]] ; then
return 0 return 0