From abc8eb76625cafd12886fb4285f596affd6a2d57 Mon Sep 17 00:00:00 2001 From: bysnupy Date: Tue, 7 Aug 2018 10:24:23 +0900 Subject: [PATCH] Be more accuracy for getting def_route_int and def_route_ip --- roles/openshift_node/files/networkmanager/99-origin-dns.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/openshift_node/files/networkmanager/99-origin-dns.sh b/roles/openshift_node/files/networkmanager/99-origin-dns.sh index acf3e2f38ba..0586c217870 100755 --- a/roles/openshift_node/files/networkmanager/99-origin-dns.sh +++ b/roles/openshift_node/files/networkmanager/99-origin-dns.sh @@ -44,8 +44,8 @@ if [[ $2 =~ ^(up|dhcp4-change|dhcp6-change)$ ]]; then # couldn't find an existing method to determine if the interface owns the # default route def_route=$(/sbin/ip route list match 0.0.0.0/0 | awk '{print $3 }') - def_route_int=$(/sbin/ip route get to ${def_route} | awk '{print $3}') - def_route_ip=$(/sbin/ip route get to ${def_route} | awk '{print $5}') + def_route_int=$(/sbin/ip route get to ${def_route} | awk -F 'dev' '{print $2}' | head -n1 | awk '{print $1}') + def_route_ip=$(/sbin/ip route get to ${def_route} | awk -F 'src' '{print $2}' | head -n1 | awk '{print $1}') if [[ ${DEVICE_IFACE} == ${def_route_int} ]]; then if [ ! -f /etc/dnsmasq.d/origin-dns.conf ]; then cat << EOF > /etc/dnsmasq.d/origin-dns.conf