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
(cherry picked from commit 68bfc26728
)
This commit is contained in:
parent
185fddf873
commit
2d9b959717
|
@ -43,8 +43,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
|
||||
|
||||
|
|
Loading…
Reference in New Issue