net-svc revision 6927f468b0af7710df000f6b16f6ee413e1e3007
f743002678eb67b99bbc29fee116b65d9530fec0wrowe#!/sbin/sh
80833bb9a1bf25dcf19e814438a4b311d2e1f4cffuankg#
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem# CDDL HEADER START
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic#
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic# The contents of this file are subject to the terms of the
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic# Common Development and Distribution License (the "License").
1337c7673efc1f80f634139fbad7cbb98a0dc657ylavic# You may not use this file except in compliance with the License.
4da61833a1cbbca94094f9653fd970582b97a72etrawick#
4da61833a1cbbca94094f9653fd970582b97a72etrawick# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4da61833a1cbbca94094f9653fd970582b97a72etrawick# or http://www.opensolaris.org/os/licensing.
4da61833a1cbbca94094f9653fd970582b97a72etrawick# See the License for the specific language governing permissions
4da61833a1cbbca94094f9653fd970582b97a72etrawick# and limitations under the License.
4789804be088bcd86ae637a29cdb7fda25169521jailletc#
4789804be088bcd86ae637a29cdb7fda25169521jailletc# When distributing Covered Code, include this CDDL HEADER in each
4789804be088bcd86ae637a29cdb7fda25169521jailletc# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4789804be088bcd86ae637a29cdb7fda25169521jailletc# If applicable, add the following below this CDDL HEADER, with the
e50c3026198fd496f183cda4c32a202925476778covener# fields enclosed by brackets "[]" replaced with your own identifying
e50c3026198fd496f183cda4c32a202925476778covener# information: Portions Copyright [yyyy] [name of copyright owner]
e50c3026198fd496f183cda4c32a202925476778covener#
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrin# CDDL HEADER END
5b88c8507d5ef6d0c4cfbc78230294968175b638minfrin#
6c3b9cebb551140fbb25d58bae08b539b3802133ylavic#
6c3b9cebb551140fbb25d58bae08b539b3802133ylavic# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
6c3b9cebb551140fbb25d58bae08b539b3802133ylavic# Use is subject to license terms.
4f29b65ab4b547ad5dbe506e2d0ff5d12ead9247ylavic#
4f29b65ab4b547ad5dbe506e2d0ff5d12ead9247ylavic#ident "%Z%%M% %I% %E% SMI"
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic#
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic# This is third phase of TCP/IP startup/configuration. This script
0a0df13b7f1f4f1a74fe295253d89ca3911b301aylavic# runs after the NIS/NIS+ startup script. We run things here that may
69301145375a889e7e37caf7cc7321ac0f91801erpluem# depend on NIS/NIS+ maps.
69301145375a889e7e37caf7cc7321ac0f91801erpluem#
69301145375a889e7e37caf7cc7321ac0f91801erpluem
506bfe33206b2fece40ef25f695af39dd4130facjkaluza. /lib/svc/share/smf_include.sh
506bfe33206b2fece40ef25f695af39dd4130facjkaluza
506bfe33206b2fece40ef25f695af39dd4130facjkaluzacase "$1" in
506bfe33206b2fece40ef25f695af39dd4130facjkaluza'start')
d58a848a016d401b965111e50ef829e1641f7834minfrin #
d58a848a016d401b965111e50ef829e1641f7834minfrin # In a zone we need this service to be up, but all of the work
d58a848a016d401b965111e50ef829e1641f7834minfrin # it tries to do is irrelevant (and will actually lead to the service
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf # failing if we try to do it), so just bail out.
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf #
2e6f4d654c96c98b761fb012fd25c5d5b1558c44sf smf_is_globalzone || exit 0
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic ;; # Fall through -- rest of script is the initialization code
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic'stop')
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic exit 0
17e6c95f3b22d18acdf8380fb26a8d0e10c80767ylavic ;;
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic*)
e8bd80a4bb88199d2f9a24a50345688e52d9c116ylavic echo "Usage: $0 { start | stop }"
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic exit 1
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic ;;
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavicesac
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic# If boot variables are not set, set variables we use
330e16bea8fe9cace4de90c349750c03dfb1fe64ylavic[ -z "$_INIT_UTS_NODENAME" ] && _INIT_UTS_NODENAME=`/usr/bin/uname -n`
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener#
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener# wait_nis
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener# Wait up to 5 seconds for ypbind to obtain a binding.
d7205b1a86c51c27b71a2c458dc453fd53a261c1covener#
44ff304057225e944e220e981d434a046d14cf06covenerwait_nis ()
44ff304057225e944e220e981d434a046d14cf06covener{
44ff304057225e944e220e981d434a046d14cf06covener for i in 1 2 3 4 5; do
44ff304057225e944e220e981d434a046d14cf06covener server=`/usr/bin/ypwhich 2>/dev/null`
5d1ba75b8794925e67591c209085a49279791de9covener [ $? -eq 0 -a -n "$server" ] && return 0 || sleep 1
5d1ba75b8794925e67591c209085a49279791de9covener done
5d1ba75b8794925e67591c209085a49279791de9covener return 1
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand}
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand#
032982212dbcc7c3cce95bf89c503bb56e185ac7kbrand# This function takes two file names and the file mode as input. The two
caad2986f81ab263f7af41467dd622dc9add17f3ylavic# files are compared for differences (using cmp(1)) and if different, the
caad2986f81ab263f7af41467dd622dc9add17f3ylavic# second file is over written with the first. A chmod is done with the file
caad2986f81ab263f7af41467dd622dc9add17f3ylavic# mode passed in. If the files are equal, the first file passed
caad2986f81ab263f7af41467dd622dc9add17f3ylavic# in (the /tmp file) is deleted.
45a10d38e6051fd7bdf9d742aaae633d97ff02abjailletc#
f7317ff316c2b141feea31bddb74d5d3fa1584edjortonmv_file ()
f7317ff316c2b141feea31bddb74d5d3fa1584edjorton{
2165214331e4afafca4048f66f303d0253d7b001covener /usr/bin/cmp -s $1 $2
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem if [ $? -eq 1 ]; then
a34684a59b60a4173c25035d0c627ef17e6dc215rpluem /usr/bin/mv $1 $2
1e2d421a36999d292042a5539971070d54aa6c63ylavic #
1e2d421a36999d292042a5539971070d54aa6c63ylavic # The umask during boot is configurable, which requires
1e2d421a36999d292042a5539971070d54aa6c63ylavic # explicit setting of file permission modes when we
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh # create files.
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh #
fa7ed98b9dc94c5845cf845aea0a44ecacd290c9humbedooh /usr/bin/chmod $3 $2
0b67eb8568cd58bb77082703951679b42cf098actrawick else
0b67eb8568cd58bb77082703951679b42cf098actrawick /usr/bin/rm $1
0b67eb8568cd58bb77082703951679b42cf098actrawick fi
0b67eb8568cd58bb77082703951679b42cf098actrawick}
5ef3c61605a3a021ff71f488983cb0065f8e1a79covener
fb1985a97912b25ec6564c73e610a31e5fc6e25fcovener#
09c87c777bed1655621bb20e1c46cb6b1a63279dcovener# update_nss
6502b7b32f980cc2093bb3ebce37e5e4dc68fba4ylavic# This routine takes as a parameter, the name of the respective policy
6502b7b32f980cc2093bb3ebce37e5e4dc68fba4ylavic# to change in the nsswitch.conf (hosts or ipnodes) to update with dns.
3060ce7f798fbda7999cd4ddf89b525d2b294185covener#
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavicupdate_nss ()
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavic{
c1a63b8fad09c419c1a64f75993feb8a343a6801ylavic policy=$1;
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletc # Add dns to the nsswitch file, if it isn't already there.
e6b4bd1113567627ab6bb6c6a7105e1e01a7d889jailletc /usr/bin/awk ' $1 ~ /^'${policy}':/ {
e466c40e1801982602ee0200c9e8b61cc148742djailletc n = split($0, a);
e466c40e1801982602ee0200c9e8b61cc148742djailletc newl = a[1];
457468b82e59d01eba00dd9d0817309c8f5e414ejim if ($0 !~ /dns/) {
457468b82e59d01eba00dd9d0817309c8f5e414ejim printf("#%s # Commented out by DHCP\n", $0);
457468b82e59d01eba00dd9d0817309c8f5e414ejim updated = 0;
04983e3bd1754764eec7d6bb772fe3b0bf391771jorton for (i = 2; i <= n; i++) {
04983e3bd1754764eec7d6bb772fe3b0bf391771jorton if (updated == 0 && index(a[i], "[") == 1) {
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluem newl = newl" dns";
15660979a30d251681463de2e0584853890082accovener updated++;
15660979a30d251681463de2e0584853890082accovener }
49dacedb6c387b786b7911082ff35121a45f414bcovener newl = newl" "a[i];
49dacedb6c387b786b7911082ff35121a45f414bcovener }
cfd9415521847b2f9394fad04fb701cfb955f503rjung if (updated == 0) {
cfd9415521847b2f9394fad04fb701cfb955f503rjung newl = newl" dns";
cfd9415521847b2f9394fad04fb701cfb955f503rjung updated++;
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe }
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe if (updated != 0)
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe newl = newl" # Added by DHCP";
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe else
28c31fb73c1264bd1d0ff932573677030b024c7dwrowe newl = $0;
8491e0600f69b0405e156ea8a419653c065c645bcovener printf("%s\n", newl);
63b9f1f5880391261705f696d7d65507bbe9ace3covener } else
63b9f1f5880391261705f696d7d65507bbe9ace3covener printf("%s\n", $0);
63b9f1f5880391261705f696d7d65507bbe9ace3covener } $1 !~ /^'${policy}':/ { printf("%s\n", $0); }' /etc/nsswitch.conf \
49dacedb6c387b786b7911082ff35121a45f414bcovener >/tmp/nsswitch.conf.$$
49dacedb6c387b786b7911082ff35121a45f414bcovener
49dacedb6c387b786b7911082ff35121a45f414bcovener mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644
49dacedb6c387b786b7911082ff35121a45f414bcovener}
3c990331fc6702119e4f5b8ba9eae3021aea5265jim
3c990331fc6702119e4f5b8ba9eae3021aea5265jim#
3c990331fc6702119e4f5b8ba9eae3021aea5265jim# update_files
3c990331fc6702119e4f5b8ba9eae3021aea5265jim# This routine takes as a parameter, the name of the respective file
fc42512879dd0504532f52fe5d0d0383dda96a1eniq# (hosts or ipnodes) to update with the new host name and IP address.
fc42512879dd0504532f52fe5d0d0383dda96a1eniq#
fc42512879dd0504532f52fe5d0d0383dda96a1eniqupdate_files ()
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niq{
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niq filename=$1;
0451df5dc50fa5d8b3e07d92ee6a92e36a1181a5niq # Delete any old lines added by dhcp.
da0442c0440caef34706e2c2f3af05cb65921cc0jailletc /usr/bin/sed -e '/# Added by DHCP$/d' /etc/inet/${filename} \
983528026996668ea295be95aedb9c7a346af470ylavic > /tmp/${filename}_clear.$$
da0442c0440caef34706e2c2f3af05cb65921cc0jailletc
da0442c0440caef34706e2c2f3af05cb65921cc0jailletc shift $# # Clear $0-9 first in case grep fails
06b8f183140c8e02e0974e938a05078b511d1603covener set -- `/usr/bin/grep "^[ ]*$ipaddr[ ]" \
06b8f183140c8e02e0974e938a05078b511d1603covener /tmp/${filename}_clear.$$ 2>/dev/null`
06b8f183140c8e02e0974e938a05078b511d1603covener
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluem if [ $# -gt 0 ]; then
259878293a997ff49f5ddfc53d3739cbdc25444ecovener #
259878293a997ff49f5ddfc53d3739cbdc25444ecovener # IP address is already in the file. Ensure the
259878293a997ff49f5ddfc53d3739cbdc25444ecovener # associated hostname is the same as the Hostname
259878293a997ff49f5ddfc53d3739cbdc25444ecovener # property returned by the DHCP server.
15890c9306ba98f6fc243e15a3c4778ddc7d773erpluem #
b54b024c06a19926832d77d40ba35ad8c41e4d3dminfrin /usr/bin/sed -e "/^[ ]*${ipaddr}[ ]/d" \
b54b024c06a19926832d77d40ba35ad8c41e4d3dminfrin /tmp/${filename}_clear.$$ >/tmp/${filename}.$$
b54b024c06a19926832d77d40ba35ad8c41e4d3dminfrin echo "${ipaddr}\t${hostname}\t# Added by DHCP" \
65967d05f839dbf27cf91d91fa79585eeae19660minfrin >>/tmp/${filename}.$$
65967d05f839dbf27cf91d91fa79585eeae19660minfrin else
65967d05f839dbf27cf91d91fa79585eeae19660minfrin #
65967d05f839dbf27cf91d91fa79585eeae19660minfrin # IP address is missing from the respective file. Now check
8152945ae46857b170cb227e79bb799f4fc7710dminfrin # to see if the hostname is present with a different IP.
8152945ae46857b170cb227e79bb799f4fc7710dminfrin #
8152945ae46857b170cb227e79bb799f4fc7710dminfrin shift $# # Clear $0-9 in case grep fails
8152945ae46857b170cb227e79bb799f4fc7710dminfrin set -- `/usr/bin/grep -s -v '^#' /tmp/${filename}_clear.$$ | \
75f5c2db254c0167a0e396254460de09b775d203trawick /usr/bin/egrep "[ ]${hostname}([ ]|$)"`
75f5c2db254c0167a0e396254460de09b775d203trawick
75f5c2db254c0167a0e396254460de09b775d203trawick if [ $# -gt 0 ]; then
4f0358189bfa57b8e75bd6b94db264302a8f336amrumph #
4f0358189bfa57b8e75bd6b94db264302a8f336amrumph # Hostname is present in the file. Rewrite this line
4f0358189bfa57b8e75bd6b94db264302a8f336amrumph # to have the new IP address and the DHCP comment.
5716f9c6daa92dde5f2f9d11ed63f7c9549c223atrawick #
5716f9c6daa92dde5f2f9d11ed63f7c9549c223atrawick /usr/bin/sed -e "/^[ ]*${1}[ ]/d" \
5716f9c6daa92dde5f2f9d11ed63f7c9549c223atrawick /tmp/${filename}_clear.$$ >/tmp/${filename}.$$
5716f9c6daa92dde5f2f9d11ed63f7c9549c223atrawick
54d750a84a175d8e338880514d440773eb986b50covener shift # Shift off $1 (the old IP)
54d750a84a175d8e338880514d440773eb986b50covener
54d750a84a175d8e338880514d440773eb986b50covener echo "$ipaddr $*\c" | /usr/bin/tr ' ' '\t' \
54d750a84a175d8e338880514d440773eb986b50covener >>/tmp/${filename}.$$
54d750a84a175d8e338880514d440773eb986b50covener
54d750a84a175d8e338880514d440773eb986b50covener echo "\t# Added by DHCP" >>/tmp/${filename}.$$
54d750a84a175d8e338880514d440773eb986b50covener else
54d750a84a175d8e338880514d440773eb986b50covener #
7a3aa12f0eda24793ee26d6a179bd53132e9dae8covener # Hostname is not present in the named file.
54d750a84a175d8e338880514d440773eb986b50covener # Add a new line for the host at the end of
54d750a84a175d8e338880514d440773eb986b50covener # the new respective file.
83b50288fa7d306324bba68832011ea08f5c7832covener #
4e30ef014533a7e93c92d88306291f5e49c9692ftrawick /usr/bin/mv /tmp/${filename}_clear.$$ \
83b50288fa7d306324bba68832011ea08f5c7832covener /tmp/${filename}.$$
5f066f496cd9f20a2a701255bc67d44e7cb46daetrawick echo "${ipaddr}\t${hostname}\t# Added by DHCP" \
5f066f496cd9f20a2a701255bc67d44e7cb46daetrawick >>/tmp/${filename}.$$
5f066f496cd9f20a2a701255bc67d44e7cb46daetrawick fi
2e15620d724fb8e3a5be183b917359a2fd6e9468covener fi
2e15620d724fb8e3a5be183b917359a2fd6e9468covener
2e15620d724fb8e3a5be183b917359a2fd6e9468covener /usr/bin/rm -f /tmp/${filename}_clear.$$
2e15620d724fb8e3a5be183b917359a2fd6e9468covener mv_file /tmp/${filename}.$$ /etc/inet/${filename} 444
1b988c41ee505962781d110a3e4c2c90f1ea0aa4covener}
1b988c41ee505962781d110a3e4c2c90f1ea0aa4covener
1b988c41ee505962781d110a3e4c2c90f1ea0aa4covener#
1b988c41ee505962781d110a3e4c2c90f1ea0aa4covener# We now need to reset the netmask and broadcast address for our network
b8efdc95bec9cf089aa1be0bfd07d46aa1137a7acovener# interfaces. Since this may result in a name service lookup, we want to
b8efdc95bec9cf089aa1be0bfd07d46aa1137a7acovener# now wait for NIS to come up if we previously started it.
b8efdc95bec9cf089aa1be0bfd07d46aa1137a7acovener#
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisddomain=`/usr/bin/domainname 2>/dev/null`
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisd
f06e7c4b1bce6b6491e5de0b7998d3f5696b293dchrisd[ -z "$domain" ] || [ ! -d /var/yp/binding/$domain ] || wait_nis || \
179565be4043d7e5f9161aa75271fa0a001866d9covener echo "WARNING: Timed out waiting for NIS to come up" >& 2
179565be4043d7e5f9161aa75271fa0a001866d9covener
179565be4043d7e5f9161aa75271fa0a001866d9covener#
111436a32ba1254291e4883292fb116d15fe8f64covener# Re-set the netmask and broadcast addr for all IP interfaces. This ifconfig
fce4949fb0b309a5744afcd503c6ed2d35621ee2covener# is run here, after waiting for name services, so that "netmask +" will find
fce4949fb0b309a5744afcd503c6ed2d35621ee2covener# the netmask if it lives in a NIS map. The 'D' in -auD tells ifconfig NOT to
fce4949fb0b309a5744afcd503c6ed2d35621ee2covener# mess with the interface if it is under DHCP control
fce4949fb0b309a5744afcd503c6ed2d35621ee2covener#
7b7430e701e9a31ce809da7c220bb8dfcf68c86etrawick/usr/sbin/ifconfig -auD4 netmask + broadcast +
7b7430e701e9a31ce809da7c220bb8dfcf68c86etrawick
7b7430e701e9a31ce809da7c220bb8dfcf68c86etrawick# Uncomment these lines to print complete network interface configuration
ccc20788c1e5fc973f36df634399c89acb70deaejerenkrantz# echo "network interface configuration:"
ccc20788c1e5fc973f36df634399c89acb70deaejerenkrantz# /usr/sbin/ifconfig -a
ccc20788c1e5fc973f36df634399c89acb70deaejerenkrantz
273e512f20f262e5e2aa8e0e83371d1929fb76adjkaluzasmf_netstrategy
273e512f20f262e5e2aa8e0e83371d1929fb76adjkaluza
273e512f20f262e5e2aa8e0e83371d1929fb76adjkaluzaif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then
efe780dcf13b2b95effabf897d694d8f23feac74trawick dnsservers=`/sbin/dhcpinfo DNSserv`
fe83f60b41477b14a37edcfcd1f7f5c5a1ebfe44minfrinelse
fe83f60b41477b14a37edcfcd1f7f5c5a1ebfe44minfrin dnsservers=""
fe83f60b41477b14a37edcfcd1f7f5c5a1ebfe44minfrinfi
993d1261a278d7322bccef219101220b7b4fb8c5jkaluza
993d1261a278d7322bccef219101220b7b4fb8c5jkaluzaif [ -n "$dnsservers" ]; then
993d1261a278d7322bccef219101220b7b4fb8c5jkaluza #
ba050a6f942b9fa0e81ed73437588005c569655ccovener # Go through /etc/resolv.conf and replace any existing
ba050a6f942b9fa0e81ed73437588005c569655ccovener # domain or nameserver entries with new ones derived
ba050a6f942b9fa0e81ed73437588005c569655ccovener # from DHCP. Note that it is important to preserve
ba050a6f942b9fa0e81ed73437588005c569655ccovener # order of domain entries vs. search entries; the search
135ddda3a989215d2bedbcf1529bfb269c3eda23niq # entries are reserved for administrator customization
135ddda3a989215d2bedbcf1529bfb269c3eda23niq # and if placed after the domain entry will override it.
135ddda3a989215d2bedbcf1529bfb269c3eda23niq # See resolv.conf(4).
001a44c352f89c9ec332ffd3e0a6927dcd19432chumbedooh #
001a44c352f89c9ec332ffd3e0a6927dcd19432chumbedooh if [ ! -f /etc/resolv.conf ]; then
001a44c352f89c9ec332ffd3e0a6927dcd19432chumbedooh /usr/bin/touch /etc/resolv.conf
efe780dcf13b2b95effabf897d694d8f23feac74trawick fi
793214f67dede32edfd9ee96c664ead04d175cbbjfclere dnsdomain=`/sbin/dhcpinfo DNSdmain`
cc5a4a08dc9783fcbc52ce86f11e01c281a43810minfrin export dnsservers dnsdomain
9b0076ddd1103e5fa9c1f9bafde4b06ce244fbaecovener /usr/bin/nawk </etc/resolv.conf >/tmp/resolv.conf.$$ '
9b0076ddd1103e5fa9c1f9bafde4b06ce244fbaecovener function writedomain() {
9b0076ddd1103e5fa9c1f9bafde4b06ce244fbaecovener if (updated == 0) {
249d09d51808cb7981af99762c3b3736ca126cd5jkaluza # Use only first domain, not a search list
249d09d51808cb7981af99762c3b3736ca126cd5jkaluza split(ENVIRON["dnsdomain"], d)
249d09d51808cb7981af99762c3b3736ca126cd5jkaluza if(length(d[1]) != 0)
249d09d51808cb7981af99762c3b3736ca126cd5jkaluza printf("domain %s\n", d[1])
56589be3d7a3e9343370df240010c6928cc78b39jkaluza }
56589be3d7a3e9343370df240010c6928cc78b39jkaluza ++updated
56589be3d7a3e9343370df240010c6928cc78b39jkaluza }
77ca16c5676da23155311e13cee61e7eaba9fa3ejailletc $1 == "domain" { writedomain(); next }
77ca16c5676da23155311e13cee61e7eaba9fa3ejailletc $1 != "nameserver" { print $0 }
77ca16c5676da23155311e13cee61e7eaba9fa3ejailletc END {
77ca16c5676da23155311e13cee61e7eaba9fa3ejailletc writedomain()
f87299dab99bc04b51a6b8cad51b6795db862c0atrawick n = split(ENVIRON["dnsservers"], s)
f87299dab99bc04b51a6b8cad51b6795db862c0atrawick for (i = 1; i <= n; ++i)
f87299dab99bc04b51a6b8cad51b6795db862c0atrawick printf("nameserver %s\n", s[i])
4d12805e6c18253040223ea637acd6b3b3c18f60jorton }'
4d12805e6c18253040223ea637acd6b3b3c18f60jorton unset dnsservers dnsdomain
4d12805e6c18253040223ea637acd6b3b3c18f60jorton mv_file /tmp/resolv.conf.$$ /etc/resolv.conf 644
85eacfc96a04547ef25aabbc06440039715084c2jorton #
85eacfc96a04547ef25aabbc06440039715084c2jorton # Add dns to the nsswitch file, if it isn't already there.
e5d909f2b06bd880fb3675cd49363df981caa631trawick #
a4df2cd1e1391575a327c2a90ba4315f805a0a78covener update_nss hosts
a4df2cd1e1391575a327c2a90ba4315f805a0a78covener update_nss ipnodes
a4df2cd1e1391575a327c2a90ba4315f805a0a78covener
cb666b29f81df1d11d65002250153353568021fccovenerelif /usr/bin/grep '# Added by DHCP$' /etc/nsswitch.conf >/dev/null 2>&1; then
cb666b29f81df1d11d65002250153353568021fccovener
cb666b29f81df1d11d65002250153353568021fccovener # If we added DNS to the hosts and ipnodes policy in the nsswitch,
6a80c3c6f4b8ea7ba5e89402b8b779b09ce020e0covener # remove it.
1c2cab00d988fc48cbe59032cf76cc0bab20d6f7covener /usr/bin/sed \
6a80c3c6f4b8ea7ba5e89402b8b779b09ce020e0covener -e '/# Added by DHCP$/d' \
75a230a728338d84dcfe81edd375352f34de22d0covener -e 's/^\(#hosts:\)\(.*[^#]\)\(#.*\)$/hosts: \2/' \
75a230a728338d84dcfe81edd375352f34de22d0covener -e 's/^\(#ipnodes:\)\(.*[^#]\)\(#.*\)$/ipnodes: \2/' \
75a230a728338d84dcfe81edd375352f34de22d0covener /etc/nsswitch.conf >/tmp/nsswitch.conf.$$
1f50dc34ae069adeed20b2986e5ffdefa5c410e0covener
1f50dc34ae069adeed20b2986e5ffdefa5c410e0covener mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644
1f50dc34ae069adeed20b2986e5ffdefa5c410e0covenerfi
63a5ea80bddcc84a462e40f402b4f330e0e05411covener
63a5ea80bddcc84a462e40f402b4f330e0e05411covenerif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then
63a5ea80bddcc84a462e40f402b4f330e0e05411covener
63a5ea80bddcc84a462e40f402b4f330e0e05411covener hostname=`/usr/bin/uname -n`
65a4e663b82f8bce28ac22ab2edfd7502de36998sf ipaddr=`/sbin/dhcpinfo Yiaddr`
65a4e663b82f8bce28ac22ab2edfd7502de36998sf update_files hosts
65a4e663b82f8bce28ac22ab2edfd7502de36998sf update_files ipnodes
65a4e663b82f8bce28ac22ab2edfd7502de36998sf
c7de1955eb0eaeabf7042902476397692672d549sfelse
74e7f6c55fd67b10cb400b3f6d1dc718a303d944minfrin # We're not using a dhcp strategy, so host entries added by
74e7f6c55fd67b10cb400b3f6d1dc718a303d944minfrin # DHCP should be removed from /etc/inet/hosts and /etc/inet/ipnodes.
74e7f6c55fd67b10cb400b3f6d1dc718a303d944minfrin
74e7f6c55fd67b10cb400b3f6d1dc718a303d944minfrin if /usr/bin/grep '# Added by DHCP$' /etc/inet/hosts >/dev/null 2>&1;
a511a29faf2ff7ead3b67680154a624effb31aafminfrin then
a511a29faf2ff7ead3b67680154a624effb31aafminfrin /usr/bin/sed -e '/# Added by DHCP$/d' \
a511a29faf2ff7ead3b67680154a624effb31aafminfrin /etc/inet/hosts > /tmp/hosts.$$
a511a29faf2ff7ead3b67680154a624effb31aafminfrin mv_file /tmp/hosts.$$ /etc/inet/hosts 444
a511a29faf2ff7ead3b67680154a624effb31aafminfrin fi
63921358ef93fcb41bc71d9894221ba3d7fbb87bminfrin
63921358ef93fcb41bc71d9894221ba3d7fbb87bminfrin if /usr/bin/grep '# Added by DHCP$' /etc/inet/ipnodes >/dev/null 2>&1;
63921358ef93fcb41bc71d9894221ba3d7fbb87bminfrin then
deec48c67d4786bc77112ffbf3a4e70b931097edminfrin /usr/bin/sed -e '/# Added by DHCP$/d' \
6d601599d3d65df0410eae6e573e75b2dbfb1fb4minfrin /etc/inet/ipnodes > /tmp/ipnodes.$$
6d601599d3d65df0410eae6e573e75b2dbfb1fb4minfrin mv_file /tmp/ipnodes.$$ /etc/inet/ipnodes 444
6d601599d3d65df0410eae6e573e75b2dbfb1fb4minfrin fi
6d601599d3d65df0410eae6e573e75b2dbfb1fb4minfrinfi
684e0cfc200f66287a93bbd1708d1dd8a92a7eefcovener
684e0cfc200f66287a93bbd1708d1dd8a92a7eefcovener#
5c43d2fb853f84497b5ece2d414ef9484aa87e5fsf# Load the IPQoS configuration.
05a5a9c3e16f21566e1b61f4bd68025ce1b741ccjoes# This is backgrounded so that any remote hostname lookups it performs
05a5a9c3e16f21566e1b61f4bd68025ce1b741ccjoes# don't unduely delay startup. Any messages go via syslog.
ef82e8fa164e0a1f8b813f7deb6b7ead96018c94niq#
26c5829347f6a355c00f1ba0301d575056b69536niq
ef82e8fa164e0a1f8b813f7deb6b7ead96018c94niqif [ -f /usr/sbin/ipqosconf -a -f /etc/inet/ipqosinit.conf ]; then
ef82e8fa164e0a1f8b813f7deb6b7ead96018c94niq /usr/sbin/ipqosconf -s -a /etc/inet/ipqosinit.conf &
ef82e8fa164e0a1f8b813f7deb6b7ead96018c94niqfi
ef82e8fa164e0a1f8b813f7deb6b7ead96018c94niq
ef82e8fa164e0a1f8b813f7deb6b7ead96018c94niq#
ef82e8fa164e0a1f8b813f7deb6b7ead96018c94niq# Add a static route for multicast packets out our default interface.
413ee814748f37be168ff12407fa6dba0ceeabe6trawick# The default interface is the interface that corresponds to the node name.
c12917da693bae4028a1d5a5e8224bceed8c739dsf# Run in background subshell to avoid waiting for name service.
c12917da693bae4028a1d5a5e8224bceed8c739dsf#
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf(
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsfif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsf mcastif=`/sbin/dhcpinfo Yiaddr` || mcastif=$_INIT_UTS_NODENAME
eafcc0ebf263d0ba69855b6e10958c4c1a2361bdsfelse
d7ffd2da16d58b1a0de212e4d56f7aebb72bef26sf mcastif=$_INIT_UTS_NODENAME
d7ffd2da16d58b1a0de212e4d56f7aebb72bef26sffi
d7ffd2da16d58b1a0de212e4d56f7aebb72bef26sf
4576c1a9ef54cd1e5555ee07d016a7f559f80338sfecho "Setting default IPv4 interface for multicast:" \
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf "add net 224.0/4: gateway $mcastif"
4576c1a9ef54cd1e5555ee07d016a7f559f80338sf
9811aed12bbc71783d2e544ccb5fecd193843eadsf/usr/sbin/route -n add -interface 224.0/4 -gateway "$mcastif" >/dev/null
9811aed12bbc71783d2e544ccb5fecd193843eadsf) &
9811aed12bbc71783d2e544ccb5fecd193843eadsf