Browse Source

Don't use IPv6 DNS servers for the Fuel

Fuel don't support IPv6 yet, so we shouldn't use IPv6 DNS servers
from the local /etc/resolv.conf.

Change-Id: Ia6ec6bf0bf3c100c591f82cd9b8785a00e93f016
Closes-Bug: #1553568
Maksim Malchuk 3 years ago
parent
commit
bbad3cd2fb
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      functions/product.sh

+ 4
- 2
functions/product.sh View File

@@ -156,12 +156,14 @@ enable_outbound_network_for_product_vm() {
156 156
     # Check host nameserver configuration
157 157
     echo -n "Checking local DNS configuration... "
158 158
     if execute test -f /etc/resolv.conf ; then
159
-      nameserver="$(execute grep '^nameserver' /etc/resolv.conf | grep -v 'nameserver\s\s*127.' | head -3)"
159
+      # we should exclude loopback and IPv6 addresses from the nameservers list
160
+      nameserver="$(execute grep '^nameserver' /etc/resolv.conf | egrep -v 'nameserver\s*(127\.|.*:)' | head -3)"
160 161
     fi
161 162
     if [ -z "$nameserver" ] && execute test -x /usr/bin/nmcli; then
162 163
       # Get DNS from network manager
163 164
       if [ -n "`execute LANG=C nmcli nm | grep \"running\s\+connected\"`" ]; then
164
-        nameserver="$(execute nmcli dev list | grep 'IP[46].DNS' | sed -e 's/IP[46]\.DNS\[[0-9]\+\]:\s\+/nameserver /'| grep -v 'nameserver\s\s*127.' | head -3)"
165
+        # we should exclude loopback and IPv6 addresses from the nameservers list
166
+        nameserver="$(execute nmcli dev list | grep 'IP[46].DNS' | sed -e 's/IP[46]\.DNS\[[0-9]\+\]:\s\+/nameserver /'| grep -v 'nameserver\s*(127\.|.*:)' | head -3)"
165 167
       fi
166 168
     fi
167 169
     if [ -z "$nameserver" ]; then

Loading…
Cancel
Save