diff --git a/functions-common b/functions-common index 4739e42e90..ed43e20d8d 100644 --- a/functions-common +++ b/functions-common @@ -542,11 +542,11 @@ function get_default_host_ip { local host_ip_iface=$3 local host_ip=$4 - # Find the interface used for the default route - host_ip_iface=${host_ip_iface:-$(ip route | sed -n '/^default/{ s/.*dev \(\w\+\)\s\+.*/\1/; p; }' | head -1)} # Search for an IP unless an explicit is set by ``HOST_IP`` environment variable if [ -z "$host_ip" -o "$host_ip" == "dhcp" ]; then host_ip="" + # Find the interface used for the default route + host_ip_iface=${host_ip_iface:-$(ip route | awk '/default/ {print $5}' | head -1)} local host_ips=$(LC_ALL=C ip -f inet addr show ${host_ip_iface} | awk '/inet/ {split($2,parts,"/"); print parts[1]}') local ip for ip in $host_ips; do