Skip to content

Commit

Permalink
Fix DNS search entry in /etc/resolv.conf
Browse files Browse the repository at this point in the history
Commit 66d1235 added support for
resolving DNS names from initramfs, but only the DNS domain was
configured for the DNS search. The DHCP client also provides the
`DOMAINSEARCH` variable that should be used for searching if available,
because it can contain more than one domain.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
  • Loading branch information
bdrung committed Aug 21, 2019
1 parent bac527f commit 9944436
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion components/9990-networking.sh
Expand Up @@ -156,7 +156,6 @@ EOF
if [ -n "${DNSDOMAIN}" ]
then
echo "domain ${DNSDOMAIN}" > /etc/resolv.conf
echo "search ${DNSDOMAIN}" >> /etc/resolv.conf
fi

for i in ${IPV4DNS0} ${IPV4DNS1} ${IPV4DNS1} ${DNSSERVERS}
Expand All @@ -166,6 +165,14 @@ EOF
echo "nameserver $i" >> /etc/resolv.conf
fi
done

if [ -n "${DOMAINSEARCH}" ]
then
echo "search ${DOMAINSEARCH}" >> /etc/resolv.conf
elif [ -n "${DNSDOMAIN}" ]
then
echo "search ${DNSDOMAIN}" >> /etc/resolv.conf
fi
fi

# Check if we have a network device at all
Expand Down

0 comments on commit 9944436

Please sign in to comment.