From 68bfc267286a9523f89a73718a7ed11cdc787a96 Mon Sep 17 00:00:00 2001 From: Dan Sneddon Date: Thu, 23 May 2019 12:38:00 -0700 Subject: [PATCH] Fix run-os-net-config.sh to use ping6 for IPv6 hostnames The run-os-net-config.sh script checks to see if an IP address is IPv4 or IPv6, and uses ping or ping6 accordingly. This change also resolves hostnames and submits the resolved IP to the same test. If the hostname only resolves to an IPv6 address, then ping6 will be used. Change-Id: I9f37992157935b37cc9beb8a2f3b9d749a62bd1b Closes-bug: 1830274 --- network/scripts/run-os-net-config.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/network/scripts/run-os-net-config.sh b/network/scripts/run-os-net-config.sh index 46532c72d8..22085cabd4 100755 --- a/network/scripts/run-os-net-config.sh +++ b/network/scripts/run-os-net-config.sh @@ -44,8 +44,9 @@ function ping_metadata_ip() { echo -n "Trying to ping metadata IP ${METADATA_IP}..." + _IP="$(getent hosts $METADATA_IP | awk '{ print $1 }')" _ping=ping - if [[ "$METADATA_IP" =~ ":" ]] ; then + if [[ "$_IP" =~ ":" ]] ; then _ping=ping6 fi