From cf94c5ebda7050569163f2536a46089280a45c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Charlier?= Date: Tue, 7 Jun 2016 16:06:25 +0200 Subject: [PATCH] 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 --- .../os-refresh-config/configure.d/20-os-net-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elements/os-net-config/os-refresh-config/configure.d/20-os-net-config b/elements/os-net-config/os-refresh-config/configure.d/20-os-net-config index d8e16078d..62f7a3312 100755 --- a/elements/os-net-config/os-refresh-config/configure.d/20-os-net-config +++ b/elements/os-net-config/os-refresh-config/configure.d/20-os-net-config @@ -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