1*7c478bd9Sstevel@tonic-gate#!/sbin/sh 2*7c478bd9Sstevel@tonic-gate# 3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 7*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 8*7c478bd9Sstevel@tonic-gate# with the License. 9*7c478bd9Sstevel@tonic-gate# 10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 13*7c478bd9Sstevel@tonic-gate# and limitations under the License. 14*7c478bd9Sstevel@tonic-gate# 15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 20*7c478bd9Sstevel@tonic-gate# 21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# 24*7c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 25*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 26*7c478bd9Sstevel@tonic-gate# 27*7c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate# 30*7c478bd9Sstevel@tonic-gate# This is third phase of TCP/IP startup/configuration. This script 31*7c478bd9Sstevel@tonic-gate# runs after the NIS/NIS+ startup script. We run things here that may 32*7c478bd9Sstevel@tonic-gate# depend on NIS/NIS+ maps. 33*7c478bd9Sstevel@tonic-gate# 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gatecase "$1" in 36*7c478bd9Sstevel@tonic-gate'start') 37*7c478bd9Sstevel@tonic-gate # 38*7c478bd9Sstevel@tonic-gate # In a zone we need this service to be up, but all of the work 39*7c478bd9Sstevel@tonic-gate # it tries to do is irrelevant (and will actually lead to the service 40*7c478bd9Sstevel@tonic-gate # failing if we try to do it), so just bail out. 41*7c478bd9Sstevel@tonic-gate # 42*7c478bd9Sstevel@tonic-gate if [ `/sbin/zonename` != "global" ]; then 43*7c478bd9Sstevel@tonic-gate exit 0 44*7c478bd9Sstevel@tonic-gate fi 45*7c478bd9Sstevel@tonic-gate ;; # Fall through -- rest of script is the initialization code 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate'stop') 48*7c478bd9Sstevel@tonic-gate exit 0 49*7c478bd9Sstevel@tonic-gate ;; 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate*) 52*7c478bd9Sstevel@tonic-gate echo "Usage: $0 { start | stop }" 53*7c478bd9Sstevel@tonic-gate exit 1 54*7c478bd9Sstevel@tonic-gate ;; 55*7c478bd9Sstevel@tonic-gateesac 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate# If boot variables are not set, set variables we use 60*7c478bd9Sstevel@tonic-gate[ -z "$_INIT_UTS_NODENAME" ] && _INIT_UTS_NODENAME=`/usr/bin/uname -n` 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate# 63*7c478bd9Sstevel@tonic-gate# wait_nis 64*7c478bd9Sstevel@tonic-gate# Wait up to 5 seconds for ypbind to obtain a binding. 65*7c478bd9Sstevel@tonic-gate# 66*7c478bd9Sstevel@tonic-gatewait_nis () 67*7c478bd9Sstevel@tonic-gate{ 68*7c478bd9Sstevel@tonic-gate for i in 1 2 3 4 5; do 69*7c478bd9Sstevel@tonic-gate server=`/usr/bin/ypwhich 2>/dev/null` 70*7c478bd9Sstevel@tonic-gate [ $? -eq 0 -a -n "$server" ] && return 0 || sleep 1 71*7c478bd9Sstevel@tonic-gate done 72*7c478bd9Sstevel@tonic-gate return 1 73*7c478bd9Sstevel@tonic-gate} 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate# 76*7c478bd9Sstevel@tonic-gate# This function takes two file names and the file mode as input. The two 77*7c478bd9Sstevel@tonic-gate# files are compared for differences (using cmp(1)) and if different, the 78*7c478bd9Sstevel@tonic-gate# second file is over written with the first. A chmod is done with the file 79*7c478bd9Sstevel@tonic-gate# mode passed in. If the files are equal, the first file passed 80*7c478bd9Sstevel@tonic-gate# in (the /tmp file) is deleted. 81*7c478bd9Sstevel@tonic-gate# 82*7c478bd9Sstevel@tonic-gatemv_file () 83*7c478bd9Sstevel@tonic-gate{ 84*7c478bd9Sstevel@tonic-gate /usr/bin/cmp -s $1 $2 85*7c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 86*7c478bd9Sstevel@tonic-gate /usr/bin/mv $1 $2 87*7c478bd9Sstevel@tonic-gate # 88*7c478bd9Sstevel@tonic-gate # The umask during boot is configurable, which requires 89*7c478bd9Sstevel@tonic-gate # explicit setting of file permission modes when we 90*7c478bd9Sstevel@tonic-gate # create files. 91*7c478bd9Sstevel@tonic-gate # 92*7c478bd9Sstevel@tonic-gate /usr/bin/chmod $3 $2 93*7c478bd9Sstevel@tonic-gate else 94*7c478bd9Sstevel@tonic-gate /usr/bin/rm $1 95*7c478bd9Sstevel@tonic-gate fi 96*7c478bd9Sstevel@tonic-gate} 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate# 99*7c478bd9Sstevel@tonic-gate# update_nss 100*7c478bd9Sstevel@tonic-gate# This routine takes as a parameter, the name of the respective policy 101*7c478bd9Sstevel@tonic-gate# to change in the nsswitch.conf (hosts or ipnodes) to update with dns. 102*7c478bd9Sstevel@tonic-gate# 103*7c478bd9Sstevel@tonic-gateupdate_nss () 104*7c478bd9Sstevel@tonic-gate{ 105*7c478bd9Sstevel@tonic-gate policy=$1; 106*7c478bd9Sstevel@tonic-gate # Add dns to the nsswitch file, if it isn't already there. 107*7c478bd9Sstevel@tonic-gate /usr/bin/awk ' $1 ~ /^'${policy}':/ { 108*7c478bd9Sstevel@tonic-gate n = split($0, a); 109*7c478bd9Sstevel@tonic-gate newl = a[1]; 110*7c478bd9Sstevel@tonic-gate if ($0 !~ /dns/) { 111*7c478bd9Sstevel@tonic-gate printf("#%s # Commented out by DHCP\n", $0); 112*7c478bd9Sstevel@tonic-gate updated = 0; 113*7c478bd9Sstevel@tonic-gate for (i = 2; i <= n; i++) { 114*7c478bd9Sstevel@tonic-gate if (updated == 0 && index(a[i], "[") == 1) { 115*7c478bd9Sstevel@tonic-gate newl = newl" dns"; 116*7c478bd9Sstevel@tonic-gate updated++; 117*7c478bd9Sstevel@tonic-gate } 118*7c478bd9Sstevel@tonic-gate newl = newl" "a[i]; 119*7c478bd9Sstevel@tonic-gate } 120*7c478bd9Sstevel@tonic-gate if (updated == 0) { 121*7c478bd9Sstevel@tonic-gate newl = newl" dns"; 122*7c478bd9Sstevel@tonic-gate updated++; 123*7c478bd9Sstevel@tonic-gate } 124*7c478bd9Sstevel@tonic-gate if (updated != 0) 125*7c478bd9Sstevel@tonic-gate newl = newl" # Added by DHCP"; 126*7c478bd9Sstevel@tonic-gate else 127*7c478bd9Sstevel@tonic-gate newl = $0; 128*7c478bd9Sstevel@tonic-gate printf("%s\n", newl); 129*7c478bd9Sstevel@tonic-gate } else 130*7c478bd9Sstevel@tonic-gate printf("%s\n", $0); 131*7c478bd9Sstevel@tonic-gate } $1 !~ /^'${policy}':/ { printf("%s\n", $0); }' /etc/nsswitch.conf \ 132*7c478bd9Sstevel@tonic-gate >/tmp/nsswitch.conf.$$ 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644 135*7c478bd9Sstevel@tonic-gate} 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate# 138*7c478bd9Sstevel@tonic-gate# update_files 139*7c478bd9Sstevel@tonic-gate# This routine takes as a parameter, the name of the respective file 140*7c478bd9Sstevel@tonic-gate# (hosts or ipnodes) to update with the new host name and IP address. 141*7c478bd9Sstevel@tonic-gate# 142*7c478bd9Sstevel@tonic-gateupdate_files () 143*7c478bd9Sstevel@tonic-gate{ 144*7c478bd9Sstevel@tonic-gate filename=$1; 145*7c478bd9Sstevel@tonic-gate # Delete any old lines added by dhcp. 146*7c478bd9Sstevel@tonic-gate /usr/bin/sed -e '/# Added by DHCP$/d' /etc/inet/${filename} \ 147*7c478bd9Sstevel@tonic-gate > /tmp/${filename}_clear.$$ 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate shift $# # Clear $0-9 first in case grep fails 150*7c478bd9Sstevel@tonic-gate set -- `/usr/bin/grep "^[ ]*$ipaddr[ ]" \ 151*7c478bd9Sstevel@tonic-gate /tmp/${filename}_clear.$$ 2>/dev/null` 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate if [ $# -gt 0 ]; then 154*7c478bd9Sstevel@tonic-gate # 155*7c478bd9Sstevel@tonic-gate # IP address is already in the file. Ensure the 156*7c478bd9Sstevel@tonic-gate # associated hostname is the same as the Hostname 157*7c478bd9Sstevel@tonic-gate # property returned by the DHCP server. 158*7c478bd9Sstevel@tonic-gate # 159*7c478bd9Sstevel@tonic-gate /usr/bin/sed -e "/^[ ]*${ipaddr}[ ]/d" \ 160*7c478bd9Sstevel@tonic-gate /tmp/${filename}_clear.$$ >/tmp/${filename}.$$ 161*7c478bd9Sstevel@tonic-gate echo "${ipaddr}\t${hostname}\t# Added by DHCP" \ 162*7c478bd9Sstevel@tonic-gate >>/tmp/${filename}.$$ 163*7c478bd9Sstevel@tonic-gate else 164*7c478bd9Sstevel@tonic-gate # 165*7c478bd9Sstevel@tonic-gate # IP address is missing from the respective file. Now check 166*7c478bd9Sstevel@tonic-gate # to see if the hostname is present with a different IP. 167*7c478bd9Sstevel@tonic-gate # 168*7c478bd9Sstevel@tonic-gate shift $# # Clear $0-9 in case grep fails 169*7c478bd9Sstevel@tonic-gate set -- `/usr/bin/grep -s -v '^#' /tmp/${filename}_clear.$$ | \ 170*7c478bd9Sstevel@tonic-gate /usr/bin/egrep "[ ]${hostname}([ ]|$)"` 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate if [ $# -gt 0 ]; then 173*7c478bd9Sstevel@tonic-gate # 174*7c478bd9Sstevel@tonic-gate # Hostname is present in the file. Rewrite this line 175*7c478bd9Sstevel@tonic-gate # to have the new IP address and the DHCP comment. 176*7c478bd9Sstevel@tonic-gate # 177*7c478bd9Sstevel@tonic-gate /usr/bin/sed -e "/^[ ]*${1}[ ]/d" \ 178*7c478bd9Sstevel@tonic-gate /tmp/${filename}_clear.$$ >/tmp/${filename}.$$ 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate shift # Shift off $1 (the old IP) 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate echo "$ipaddr $*\c" | /usr/bin/tr ' ' '\t' \ 183*7c478bd9Sstevel@tonic-gate >>/tmp/${filename}.$$ 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate echo "\t# Added by DHCP" >>/tmp/${filename}.$$ 186*7c478bd9Sstevel@tonic-gate else 187*7c478bd9Sstevel@tonic-gate # 188*7c478bd9Sstevel@tonic-gate # Hostname is not present in the named file. 189*7c478bd9Sstevel@tonic-gate # Add a new line for the host at the end of 190*7c478bd9Sstevel@tonic-gate # the new respective file. 191*7c478bd9Sstevel@tonic-gate # 192*7c478bd9Sstevel@tonic-gate /usr/bin/mv /tmp/${filename}_clear.$$ \ 193*7c478bd9Sstevel@tonic-gate /tmp/${filename}.$$ 194*7c478bd9Sstevel@tonic-gate echo "${ipaddr}\t${hostname}\t# Added by DHCP" \ 195*7c478bd9Sstevel@tonic-gate >>/tmp/${filename}.$$ 196*7c478bd9Sstevel@tonic-gate fi 197*7c478bd9Sstevel@tonic-gate fi 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate /usr/bin/rm -f /tmp/${filename}_clear.$$ 200*7c478bd9Sstevel@tonic-gate mv_file /tmp/${filename}.$$ /etc/inet/${filename} 444 201*7c478bd9Sstevel@tonic-gate} 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate# 204*7c478bd9Sstevel@tonic-gate# We now need to reset the netmask and broadcast address for our network 205*7c478bd9Sstevel@tonic-gate# interfaces. Since this may result in a name service lookup, we want to 206*7c478bd9Sstevel@tonic-gate# now wait for NIS to come up if we previously started it. 207*7c478bd9Sstevel@tonic-gate# 208*7c478bd9Sstevel@tonic-gatedomain=`/usr/bin/domainname 2>/dev/null` 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate[ -z "$domain" ] || [ ! -d /var/yp/binding/$domain ] || wait_nis || \ 211*7c478bd9Sstevel@tonic-gate echo "WARNING: Timed out waiting for NIS to come up" >& 2 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate# 214*7c478bd9Sstevel@tonic-gate# Re-set the netmask and broadcast addr for all IP interfaces. This ifconfig 215*7c478bd9Sstevel@tonic-gate# is run here, after waiting for name services, so that "netmask +" will find 216*7c478bd9Sstevel@tonic-gate# the netmask if it lives in a NIS map. The 'D' in -auD tells ifconfig NOT to 217*7c478bd9Sstevel@tonic-gate# mess with the interface if it is under DHCP control 218*7c478bd9Sstevel@tonic-gate# 219*7c478bd9Sstevel@tonic-gate/usr/sbin/ifconfig -auD4 netmask + broadcast + 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate# Uncomment these lines to print complete network interface configuration 222*7c478bd9Sstevel@tonic-gate# echo "network interface configuration:" 223*7c478bd9Sstevel@tonic-gate# /usr/sbin/ifconfig -a 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gatesmf_netstrategy 226*7c478bd9Sstevel@tonic-gate 227*7c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then 228*7c478bd9Sstevel@tonic-gate dnsservers=`/sbin/dhcpinfo DNSserv` 229*7c478bd9Sstevel@tonic-gateelse 230*7c478bd9Sstevel@tonic-gate dnsservers="" 231*7c478bd9Sstevel@tonic-gatefi 232*7c478bd9Sstevel@tonic-gate 233*7c478bd9Sstevel@tonic-gateif [ -n "$dnsservers" ]; then 234*7c478bd9Sstevel@tonic-gate # 235*7c478bd9Sstevel@tonic-gate # Go through /etc/resolv.conf and replace any existing 236*7c478bd9Sstevel@tonic-gate # domain or nameserver entries with new ones derived 237*7c478bd9Sstevel@tonic-gate # from DHCP. Note that it is important to preserve 238*7c478bd9Sstevel@tonic-gate # order of domain entries vs. search entries; the search 239*7c478bd9Sstevel@tonic-gate # entries are reserved for administrator customization 240*7c478bd9Sstevel@tonic-gate # and if placed after the domain entry will override it. 241*7c478bd9Sstevel@tonic-gate # See resolv.conf(4). 242*7c478bd9Sstevel@tonic-gate # 243*7c478bd9Sstevel@tonic-gate if [ ! -f /etc/resolv.conf ]; then 244*7c478bd9Sstevel@tonic-gate /usr/bin/touch /etc/resolv.conf 245*7c478bd9Sstevel@tonic-gate fi 246*7c478bd9Sstevel@tonic-gate dnsdomain=`/sbin/dhcpinfo DNSdmain` 247*7c478bd9Sstevel@tonic-gate export dnsservers dnsdomain 248*7c478bd9Sstevel@tonic-gate /usr/bin/nawk </etc/resolv.conf >/tmp/resolv.conf.$$ ' 249*7c478bd9Sstevel@tonic-gate function writedomain() { 250*7c478bd9Sstevel@tonic-gate if (updated == 0) { 251*7c478bd9Sstevel@tonic-gate # Use only first domain, not a search list 252*7c478bd9Sstevel@tonic-gate split(ENVIRON["dnsdomain"], d) 253*7c478bd9Sstevel@tonic-gate if(length(d[1]) != 0) 254*7c478bd9Sstevel@tonic-gate printf("domain %s\n", d[1]) 255*7c478bd9Sstevel@tonic-gate } 256*7c478bd9Sstevel@tonic-gate ++updated 257*7c478bd9Sstevel@tonic-gate } 258*7c478bd9Sstevel@tonic-gate $1 == "domain" { writedomain(); next } 259*7c478bd9Sstevel@tonic-gate $1 != "nameserver" { print $0 } 260*7c478bd9Sstevel@tonic-gate END { 261*7c478bd9Sstevel@tonic-gate writedomain() 262*7c478bd9Sstevel@tonic-gate n = split(ENVIRON["dnsservers"], s) 263*7c478bd9Sstevel@tonic-gate for (i = 1; i <= n; ++i) 264*7c478bd9Sstevel@tonic-gate printf("nameserver %s\n", s[i]) 265*7c478bd9Sstevel@tonic-gate }' 266*7c478bd9Sstevel@tonic-gate unset dnsservers dnsdomain 267*7c478bd9Sstevel@tonic-gate mv_file /tmp/resolv.conf.$$ /etc/resolv.conf 644 268*7c478bd9Sstevel@tonic-gate # 269*7c478bd9Sstevel@tonic-gate # Add dns to the nsswitch file, if it isn't already there. 270*7c478bd9Sstevel@tonic-gate # 271*7c478bd9Sstevel@tonic-gate update_nss hosts 272*7c478bd9Sstevel@tonic-gate update_nss ipnodes 273*7c478bd9Sstevel@tonic-gate 274*7c478bd9Sstevel@tonic-gateelif /usr/bin/grep '# Added by DHCP$' /etc/nsswitch.conf >/dev/null 2>&1; then 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate # If we added DNS to the hosts and ipnodes policy in the nsswitch, 277*7c478bd9Sstevel@tonic-gate # remove it. 278*7c478bd9Sstevel@tonic-gate /usr/bin/sed \ 279*7c478bd9Sstevel@tonic-gate -e '/# Added by DHCP$/d' \ 280*7c478bd9Sstevel@tonic-gate -e 's/^\(#hosts:\)\(.*[^#]\)\(#.*\)$/hosts: \2/' \ 281*7c478bd9Sstevel@tonic-gate -e 's/^\(#ipnodes:\)\(.*[^#]\)\(#.*\)$/ipnodes: \2/' \ 282*7c478bd9Sstevel@tonic-gate /etc/nsswitch.conf >/tmp/nsswitch.conf.$$ 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644 285*7c478bd9Sstevel@tonic-gatefi 286*7c478bd9Sstevel@tonic-gate 287*7c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate hostname=`/usr/bin/uname -n` 290*7c478bd9Sstevel@tonic-gate ipaddr=`/sbin/dhcpinfo Yiaddr` 291*7c478bd9Sstevel@tonic-gate update_files hosts 292*7c478bd9Sstevel@tonic-gate update_files ipnodes 293*7c478bd9Sstevel@tonic-gate 294*7c478bd9Sstevel@tonic-gateelse 295*7c478bd9Sstevel@tonic-gate # We're not using a dhcp strategy, so host entries added by 296*7c478bd9Sstevel@tonic-gate # DHCP should be removed from /etc/inet/hosts and /etc/inet/ipnodes. 297*7c478bd9Sstevel@tonic-gate 298*7c478bd9Sstevel@tonic-gate if /usr/bin/grep '# Added by DHCP$' /etc/inet/hosts >/dev/null 2>&1; 299*7c478bd9Sstevel@tonic-gate then 300*7c478bd9Sstevel@tonic-gate /usr/bin/sed -e '/# Added by DHCP$/d' \ 301*7c478bd9Sstevel@tonic-gate /etc/inet/hosts > /tmp/hosts.$$ 302*7c478bd9Sstevel@tonic-gate mv_file /tmp/hosts.$$ /etc/inet/hosts 444 303*7c478bd9Sstevel@tonic-gate fi 304*7c478bd9Sstevel@tonic-gate 305*7c478bd9Sstevel@tonic-gate if /usr/bin/grep '# Added by DHCP$' /etc/inet/ipnodes >/dev/null 2>&1; 306*7c478bd9Sstevel@tonic-gate then 307*7c478bd9Sstevel@tonic-gate /usr/bin/sed -e '/# Added by DHCP$/d' \ 308*7c478bd9Sstevel@tonic-gate /etc/inet/ipnodes > /tmp/ipnodes.$$ 309*7c478bd9Sstevel@tonic-gate mv_file /tmp/ipnodes.$$ /etc/inet/ipnodes 444 310*7c478bd9Sstevel@tonic-gate fi 311*7c478bd9Sstevel@tonic-gatefi 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate# 314*7c478bd9Sstevel@tonic-gate# Load the IPQoS configuration. 315*7c478bd9Sstevel@tonic-gate# This is backgrounded so that any remote hostname lookups it performs 316*7c478bd9Sstevel@tonic-gate# don't unduely delay startup. Any messages go via syslog. 317*7c478bd9Sstevel@tonic-gate# 318*7c478bd9Sstevel@tonic-gate 319*7c478bd9Sstevel@tonic-gateif [ -f /usr/sbin/ipqosconf -a -f /etc/inet/ipqosinit.conf ]; then 320*7c478bd9Sstevel@tonic-gate /usr/sbin/ipqosconf -s -a /etc/inet/ipqosinit.conf & 321*7c478bd9Sstevel@tonic-gatefi 322*7c478bd9Sstevel@tonic-gate 323*7c478bd9Sstevel@tonic-gate# 324*7c478bd9Sstevel@tonic-gate# Add a static route for multicast packets out our default interface. 325*7c478bd9Sstevel@tonic-gate# The default interface is the interface that corresponds to the node name. 326*7c478bd9Sstevel@tonic-gate# Run in background subshell to avoid waiting for name service. 327*7c478bd9Sstevel@tonic-gate# 328*7c478bd9Sstevel@tonic-gate 329*7c478bd9Sstevel@tonic-gate( 330*7c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then 331*7c478bd9Sstevel@tonic-gate mcastif=`/sbin/dhcpinfo Yiaddr` || mcastif=$_INIT_UTS_NODENAME 332*7c478bd9Sstevel@tonic-gateelse 333*7c478bd9Sstevel@tonic-gate mcastif=$_INIT_UTS_NODENAME 334*7c478bd9Sstevel@tonic-gatefi 335*7c478bd9Sstevel@tonic-gate 336*7c478bd9Sstevel@tonic-gateecho "Setting default IPv4 interface for multicast:" \ 337*7c478bd9Sstevel@tonic-gate "add net 224.0/4: gateway $mcastif" 338*7c478bd9Sstevel@tonic-gate 339*7c478bd9Sstevel@tonic-gate/usr/sbin/route -n add -interface 224.0/4 -gateway "$mcastif" >/dev/null 340*7c478bd9Sstevel@tonic-gate) & 341