Fix is_local_ip matching

Add boundaries to the matching to ensure that we don't incompletely
match the IP.

Closes-Bug: 1590010

Change-Id: I06c1e145fd5e98827d8b092719f11c642b1ecdf1
This commit is contained in:
François Charlier 2016-06-07 16:06:25 +02:00
parent 9e381f509b
commit cf94c5ebda
1 changed files with 1 additions and 1 deletions

View File

@ -18,7 +18,7 @@ function get_metadata_ip() {
function is_local_ip() {
local IP_TO_CHECK=$1
if ip a | grep ^\ *inet | grep $IP_TO_CHECK &>/dev/null; then
if ip -o a | grep "inet6\? $IP_TO_CHECK/" &>/dev/null; then
return 0
else
return 1