summaryrefslogtreecommitdiff
path: root/usr/src/cmd/svc
diff options
context:
space:
mode:
authorBrian Bennett <brian.bennett@joyent.com>2022-01-26 12:31:15 -0800
committerGitHub <noreply@github.com>2022-01-26 12:31:15 -0800
commitbdda732b87814197ddde2f7e2e2e5f47799f5451 (patch)
tree85a5bf337f42e3cf63be5abba74563ae326506c4 /usr/src/cmd/svc
parent8fc6db9038a26b94dd85991125777b95db7e1948 (diff)
downloadillumos-joyent-release-20220127.tar.gz
OS-8341 dns_resolvers and dns_domain are tied to admin_ip settings unnecessarily (#388)release-20220127
Reviewed by: Dan McDonald <danmcd@kebe.com> Approved by: Dan McDonald <danmcd@kebe.com>
Diffstat (limited to 'usr/src/cmd/svc')
-rw-r--r--usr/src/cmd/svc/milestone/net-physical38
1 files changed, 26 insertions, 12 deletions
diff --git a/usr/src/cmd/svc/milestone/net-physical b/usr/src/cmd/svc/milestone/net-physical
index 7e5372ed75..5c459a3622 100644
--- a/usr/src/cmd/svc/milestone/net-physical
+++ b/usr/src/cmd/svc/milestone/net-physical
@@ -25,7 +25,7 @@
# All rights reserved.
# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
# Copyright 2012 Milan Jurik. All rights reserved.
-# Copyright 2019 Joyent, Inc.
+# Copyright 2021 Joyent, Inc.
# Copyright 2021 Tintri by DDN, Inc. All rights reserved.
#
@@ -395,6 +395,26 @@ function setup_mtu
done
}
+#
+# Set up resolvers, if we can
+#
+function configure_resolv_conf
+{
+ if [[ ${RESOLV_CONF_DONE} == true ]]; then
+ return
+ elif [[ -n ${CONFIG_dns_domain} ]] && [[ -n ${CONFIG_dns_resolvers} ]]; then
+ echo "search ${CONFIG_dns_domain}" > /etc/resolv.conf
+ if [[ -n ${CONFIG_binder_admin_ips} ]]; then
+ for serv in $(echo "${CONFIG_binder_admin_ips}" | sed -e "s/,/ /g"); do
+ echo "nameserver ${serv}" >> /etc/resolv.conf
+ done
+ fi
+ for serv in $(echo "${CONFIG_dns_resolvers}" | sed -e "s/,/ /g"); do
+ echo "nameserver ${serv}" >> /etc/resolv.conf
+ done
+ RESOLV_CONF_DONE=true
+ fi
+}
# Helper function for plumbing an interface for an address family once
typeset -A plumbedifs
@@ -547,17 +567,7 @@ if smf_is_globalzone; then
ADMIN_NIC_UP=true
# also setup resolv.conf if we can
- if [[ -n ${CONFIG_dns_domain} ]] && [[ -n ${CONFIG_dns_resolvers} ]]; then
- echo "search ${CONFIG_dns_domain}" > /etc/resolv.conf
- if [[ -n ${CONFIG_binder_admin_ips} ]]; then
- for serv in $(echo "${CONFIG_binder_admin_ips}" | sed -e "s/,/ /g"); do
- echo "nameserver ${serv}" >> /etc/resolv.conf
- done
- fi
- for serv in $(echo "${CONFIG_dns_resolvers}" | sed -e "s/,/ /g"); do
- echo "nameserver ${serv}" >> /etc/resolv.conf
- done
- fi
+ configure_resolv_conf
else
if [[ ${headnode} == "true" ]]; then
echo "ERROR: headnode but no admin_{ip,netmask} in config, not bringing up admin network."
@@ -719,6 +729,10 @@ if smf_is_globalzone; then
done
done
+
+ # All vnics are done. If the config has admin_ip=none, then we won't
+ # have resolvers set up yet, so try again here.
+ configure_resolv_conf
fi
else
# Non-global zones