Fix get_default_host_ip ipv6 address parsing
This is another occurrence of the issue fixed in bug 1786259 with change I30bf655f which occurs when there are multiple IPv6 gateways present. Before this change: $ source openrc +++++functions-common:get_default_host_ip:776 ip -f inet6 addr show 100 Device "100" does not exist. This is because the ip route command returns: default proto ra metric 100 expires 1497sec pref medium nexthop via fe80::4e16:fc01:298c:98ed dev ens3 weight 1 nexthop via fe80::4e16:fc01:2983:88aa dev ens3 weight 1 Related-Bug: #1786259 Change-Id: I7729730df66a4dc7ee11df1d23b19b9c0794b575
This commit is contained in:
parent
b2c406f497
commit
3b0d76c30b
@ -771,7 +771,7 @@ function get_default_host_ip {
|
||||
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 -f $af route | awk '/default/ {print $5}' | head -1)}
|
||||
host_ip_iface=${host_ip_iface:-$(ip -f $af route list match default table all | grep via | awk '/default/ {print $5}' | head -1)}
|
||||
local host_ips
|
||||
host_ips=$(LC_ALL=C ip -f $af addr show ${host_ip_iface} | sed /temporary/d |awk /$af'/ {split($2,parts,"/"); print parts[1]}')
|
||||
local ip
|
||||
|
Loading…
Reference in New Issue
Block a user