Make is_ipv4_address a bit more robust

Still not ideal, but at least should avoid matching IPv6 addresses.

Change-Id: Ibb64263fdb0308f56c18518289501dd4642dcbad
This commit is contained in:
Jens Harbott 2017-09-19 17:43:48 +00:00
parent b2330c8919
commit 7617ac2085

View File

@ -2014,7 +2014,7 @@ function cidr2netmask {
# Check if this is a valid ipv4 address string
function is_ipv4_address {
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
if [[ "$address" =~ $regex ]] ; then
return 0