xref: /illumos-gate/usr/src/cmd/svc/milestone/net-svc (revision f4b3ec61df05330d25f55a36b975b4d7519fdeb1)
17c478bd9Sstevel@tonic-gate#!/sbin/sh
27c478bd9Sstevel@tonic-gate#
37c478bd9Sstevel@tonic-gate# CDDL HEADER START
47c478bd9Sstevel@tonic-gate#
57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
66927f468Sdp# Common Development and Distribution License (the "License").
76927f468Sdp# You may not use this file except in compliance with the License.
87c478bd9Sstevel@tonic-gate#
97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate# and limitations under the License.
137c478bd9Sstevel@tonic-gate#
147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate#
207c478bd9Sstevel@tonic-gate# CDDL HEADER END
217c478bd9Sstevel@tonic-gate#
227c478bd9Sstevel@tonic-gate#
23*f4b3ec61Sdh155122# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate# This is third phase of TCP/IP startup/configuration.  This script
307c478bd9Sstevel@tonic-gate# runs after the NIS/NIS+ startup script.  We run things here that may
317c478bd9Sstevel@tonic-gate# depend on NIS/NIS+ maps.
327c478bd9Sstevel@tonic-gate#
337c478bd9Sstevel@tonic-gate
346927f468Sdp. /lib/svc/share/smf_include.sh
356927f468Sdp
367c478bd9Sstevel@tonic-gatecase "$1" in
377c478bd9Sstevel@tonic-gate'start')
387c478bd9Sstevel@tonic-gate	#
39*f4b3ec61Sdh155122	# In a shared-IP zone we need this service to be up, but all of the
40*f4b3ec61Sdh155122	# work it tries to do is irrelevant (and will actually lead to the
41*f4b3ec61Sdh155122	# service failing if we try to do it), so just bail out.
42*f4b3ec61Sdh155122	# In the global zone and exclusive-IP zones we proceed.
437c478bd9Sstevel@tonic-gate	#
44*f4b3ec61Sdh155122	smf_configure_ip || exit 0
457c478bd9Sstevel@tonic-gate	;; # Fall through -- rest of script is the initialization code
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate'stop')
487c478bd9Sstevel@tonic-gate	exit 0
497c478bd9Sstevel@tonic-gate	;;
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gate*)
527c478bd9Sstevel@tonic-gate	echo "Usage: $0 { start | stop }"
537c478bd9Sstevel@tonic-gate	exit 1
547c478bd9Sstevel@tonic-gate	;;
557c478bd9Sstevel@tonic-gateesac
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gate
587c478bd9Sstevel@tonic-gate# If boot variables are not set, set variables we use
597c478bd9Sstevel@tonic-gate[ -z "$_INIT_UTS_NODENAME" ] && _INIT_UTS_NODENAME=`/usr/bin/uname -n`
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate#
627c478bd9Sstevel@tonic-gate# wait_nis
637c478bd9Sstevel@tonic-gate# Wait up to 5 seconds for ypbind to obtain a binding.
647c478bd9Sstevel@tonic-gate#
657c478bd9Sstevel@tonic-gatewait_nis ()
667c478bd9Sstevel@tonic-gate{
677c478bd9Sstevel@tonic-gate	for i in 1 2 3 4 5; do
687c478bd9Sstevel@tonic-gate		server=`/usr/bin/ypwhich 2>/dev/null`
697c478bd9Sstevel@tonic-gate		[ $? -eq 0 -a -n "$server" ] && return 0 || sleep 1
707c478bd9Sstevel@tonic-gate	done
717c478bd9Sstevel@tonic-gate	return 1
727c478bd9Sstevel@tonic-gate}
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate#
757c478bd9Sstevel@tonic-gate# This function takes two file names and the file mode as input. The two
767c478bd9Sstevel@tonic-gate# files are compared for differences (using cmp(1)) and if different, the
777c478bd9Sstevel@tonic-gate# second file is over written with the first. A chmod is done with the file
787c478bd9Sstevel@tonic-gate# mode passed in. If the files are equal, the first file passed
797c478bd9Sstevel@tonic-gate# in (the /tmp file) is deleted.
807c478bd9Sstevel@tonic-gate#
817c478bd9Sstevel@tonic-gatemv_file ()
827c478bd9Sstevel@tonic-gate{
837c478bd9Sstevel@tonic-gate	/usr/bin/cmp -s $1 $2
847c478bd9Sstevel@tonic-gate	if [ $? -eq 1 ]; then
857c478bd9Sstevel@tonic-gate		/usr/bin/mv $1 $2
867c478bd9Sstevel@tonic-gate		#
877c478bd9Sstevel@tonic-gate		# The umask during boot is configurable, which requires
887c478bd9Sstevel@tonic-gate		# explicit setting of file permission modes when we
897c478bd9Sstevel@tonic-gate		# create files.
907c478bd9Sstevel@tonic-gate		#
917c478bd9Sstevel@tonic-gate		/usr/bin/chmod $3 $2
927c478bd9Sstevel@tonic-gate	else
937c478bd9Sstevel@tonic-gate		/usr/bin/rm $1
947c478bd9Sstevel@tonic-gate	fi
957c478bd9Sstevel@tonic-gate}
967c478bd9Sstevel@tonic-gate
977c478bd9Sstevel@tonic-gate#
987c478bd9Sstevel@tonic-gate# update_nss
997c478bd9Sstevel@tonic-gate# This routine takes as a parameter, the name of the respective policy
1007c478bd9Sstevel@tonic-gate# to change in the nsswitch.conf (hosts or ipnodes) to update with dns.
1017c478bd9Sstevel@tonic-gate#
1027c478bd9Sstevel@tonic-gateupdate_nss ()
1037c478bd9Sstevel@tonic-gate{
1047c478bd9Sstevel@tonic-gate	policy=$1;
1057c478bd9Sstevel@tonic-gate	# Add dns to the nsswitch file, if it isn't already there.
1067c478bd9Sstevel@tonic-gate	/usr/bin/awk ' $1 ~ /^'${policy}':/ {
1077c478bd9Sstevel@tonic-gate		n = split($0, a);
1087c478bd9Sstevel@tonic-gate		newl = a[1];
1097c478bd9Sstevel@tonic-gate		if ($0 !~ /dns/) {
1107c478bd9Sstevel@tonic-gate			printf("#%s # Commented out by DHCP\n", $0);
1117c478bd9Sstevel@tonic-gate			updated = 0;
1127c478bd9Sstevel@tonic-gate			for (i = 2; i <= n; i++) {
1137c478bd9Sstevel@tonic-gate				if (updated == 0 && index(a[i], "[") == 1) {
1147c478bd9Sstevel@tonic-gate					newl = newl" dns";
1157c478bd9Sstevel@tonic-gate					updated++;
1167c478bd9Sstevel@tonic-gate				}
1177c478bd9Sstevel@tonic-gate				newl = newl" "a[i];
1187c478bd9Sstevel@tonic-gate			}
1197c478bd9Sstevel@tonic-gate			if (updated == 0) {
1207c478bd9Sstevel@tonic-gate				newl = newl" dns";
1217c478bd9Sstevel@tonic-gate				updated++;
1227c478bd9Sstevel@tonic-gate			}
1237c478bd9Sstevel@tonic-gate			if (updated != 0)
1247c478bd9Sstevel@tonic-gate				newl = newl" # Added by DHCP";
1257c478bd9Sstevel@tonic-gate			else
1267c478bd9Sstevel@tonic-gate				newl = $0;
1277c478bd9Sstevel@tonic-gate			printf("%s\n", newl);
1287c478bd9Sstevel@tonic-gate		} else
1297c478bd9Sstevel@tonic-gate			printf("%s\n", $0);
1307c478bd9Sstevel@tonic-gate	} $1 !~ /^'${policy}':/ { printf("%s\n", $0); }' /etc/nsswitch.conf \
1317c478bd9Sstevel@tonic-gate	    >/tmp/nsswitch.conf.$$
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate	mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644
1347c478bd9Sstevel@tonic-gate}
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate#
13727092493Srs200217# update_hosts_file
13827092493Srs200217# This routine updates the /etc/inet/hosts file with the hostname and IP
13927092493Srs200217# address that was obtained via DHCP.
1407c478bd9Sstevel@tonic-gate#
14127092493Srs200217update_hosts_file ()
1427c478bd9Sstevel@tonic-gate{
14327092493Srs200217	filename=hosts
1447c478bd9Sstevel@tonic-gate	# Delete any old lines added by dhcp.
1457c478bd9Sstevel@tonic-gate	/usr/bin/sed -e '/# Added by DHCP$/d' /etc/inet/${filename} \
1467c478bd9Sstevel@tonic-gate	    > /tmp/${filename}_clear.$$
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gate	shift $#	# Clear $0-9 first in case grep fails
1497c478bd9Sstevel@tonic-gate	set -- `/usr/bin/grep "^[ 	]*$ipaddr[ 	]" \
1507c478bd9Sstevel@tonic-gate	    /tmp/${filename}_clear.$$ 2>/dev/null`
1517c478bd9Sstevel@tonic-gate
1527c478bd9Sstevel@tonic-gate	if [ $# -gt 0 ]; then
1537c478bd9Sstevel@tonic-gate		#
1547c478bd9Sstevel@tonic-gate		# IP address is already in the file. Ensure the
1557c478bd9Sstevel@tonic-gate		# associated hostname is the same as the Hostname
1567c478bd9Sstevel@tonic-gate		# property returned by the DHCP server.
1577c478bd9Sstevel@tonic-gate		#
1587c478bd9Sstevel@tonic-gate		/usr/bin/sed -e "/^[ 	]*${ipaddr}[ 	]/d" \
1597c478bd9Sstevel@tonic-gate		    /tmp/${filename}_clear.$$ >/tmp/${filename}.$$
1607c478bd9Sstevel@tonic-gate		echo "${ipaddr}\t${hostname}\t# Added by DHCP" \
1617c478bd9Sstevel@tonic-gate		    >>/tmp/${filename}.$$
1627c478bd9Sstevel@tonic-gate	else
1637c478bd9Sstevel@tonic-gate		#
1647c478bd9Sstevel@tonic-gate		# IP address is missing from the respective file.  Now check
1657c478bd9Sstevel@tonic-gate		# to see if the hostname is present with a different IP.
1667c478bd9Sstevel@tonic-gate		#
1677c478bd9Sstevel@tonic-gate		shift $#	# Clear $0-9 in case grep fails
1687c478bd9Sstevel@tonic-gate		set -- `/usr/bin/grep -s -v '^#' /tmp/${filename}_clear.$$ | \
1697c478bd9Sstevel@tonic-gate		    /usr/bin/egrep "[	 ]${hostname}([	 ]|$)"`
1707c478bd9Sstevel@tonic-gate
1717c478bd9Sstevel@tonic-gate		if [ $# -gt 0 ]; then
1727c478bd9Sstevel@tonic-gate			#
1737c478bd9Sstevel@tonic-gate			# Hostname is present in the file. Rewrite this line
1747c478bd9Sstevel@tonic-gate			# to have the new IP address and the DHCP comment.
1757c478bd9Sstevel@tonic-gate			#
1767c478bd9Sstevel@tonic-gate			/usr/bin/sed -e "/^[ 	]*${1}[ 	]/d" \
1777c478bd9Sstevel@tonic-gate			    /tmp/${filename}_clear.$$ >/tmp/${filename}.$$
1787c478bd9Sstevel@tonic-gate
1797c478bd9Sstevel@tonic-gate			shift	# Shift off $1 (the old IP)
1807c478bd9Sstevel@tonic-gate
1817c478bd9Sstevel@tonic-gate			echo "$ipaddr $*\c" | /usr/bin/tr ' ' '\t' \
1827c478bd9Sstevel@tonic-gate			    >>/tmp/${filename}.$$
1837c478bd9Sstevel@tonic-gate
1847c478bd9Sstevel@tonic-gate			echo "\t# Added by DHCP" >>/tmp/${filename}.$$
1857c478bd9Sstevel@tonic-gate		else
1867c478bd9Sstevel@tonic-gate			#
1877c478bd9Sstevel@tonic-gate			# Hostname is not present in the named file.
1887c478bd9Sstevel@tonic-gate			# Add a new line for the host at the end of
1897c478bd9Sstevel@tonic-gate			# the new respective file.
1907c478bd9Sstevel@tonic-gate			#
1917c478bd9Sstevel@tonic-gate			/usr/bin/mv /tmp/${filename}_clear.$$ \
1927c478bd9Sstevel@tonic-gate			    /tmp/${filename}.$$
1937c478bd9Sstevel@tonic-gate			echo "${ipaddr}\t${hostname}\t# Added by DHCP" \
1947c478bd9Sstevel@tonic-gate			    >>/tmp/${filename}.$$
1957c478bd9Sstevel@tonic-gate		fi
1967c478bd9Sstevel@tonic-gate	fi
1977c478bd9Sstevel@tonic-gate
1987c478bd9Sstevel@tonic-gate	/usr/bin/rm -f /tmp/${filename}_clear.$$
1997c478bd9Sstevel@tonic-gate	mv_file /tmp/${filename}.$$ /etc/inet/${filename} 444
2007c478bd9Sstevel@tonic-gate}
2017c478bd9Sstevel@tonic-gate
2027c478bd9Sstevel@tonic-gate#
2037c478bd9Sstevel@tonic-gate# We now need to reset the netmask and broadcast address for our network
2047c478bd9Sstevel@tonic-gate# interfaces.  Since this may result in a name service lookup, we want to
2057c478bd9Sstevel@tonic-gate# now wait for NIS to come up if we previously started it.
2067c478bd9Sstevel@tonic-gate#
2077c478bd9Sstevel@tonic-gatedomain=`/usr/bin/domainname 2>/dev/null`
2087c478bd9Sstevel@tonic-gate
2097c478bd9Sstevel@tonic-gate[ -z "$domain" ] || [ ! -d /var/yp/binding/$domain ] || wait_nis || \
2107c478bd9Sstevel@tonic-gate    echo "WARNING: Timed out waiting for NIS to come up" >& 2
2117c478bd9Sstevel@tonic-gate
2127c478bd9Sstevel@tonic-gate#
2137c478bd9Sstevel@tonic-gate# Re-set the netmask and broadcast addr for all IP interfaces.  This ifconfig
2147c478bd9Sstevel@tonic-gate# is run here, after waiting for name services, so that "netmask +" will find
2157c478bd9Sstevel@tonic-gate# the netmask if it lives in a NIS map. The 'D' in -auD tells ifconfig NOT to
2167c478bd9Sstevel@tonic-gate# mess with the interface if it is under DHCP control
2177c478bd9Sstevel@tonic-gate#
2187c478bd9Sstevel@tonic-gate/usr/sbin/ifconfig -auD4 netmask + broadcast +
2197c478bd9Sstevel@tonic-gate
2207c478bd9Sstevel@tonic-gate# Uncomment these lines to print complete network interface configuration
2217c478bd9Sstevel@tonic-gate# echo "network interface configuration:"
2227c478bd9Sstevel@tonic-gate# /usr/sbin/ifconfig -a
2237c478bd9Sstevel@tonic-gate
2247c478bd9Sstevel@tonic-gatesmf_netstrategy
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then
2277c478bd9Sstevel@tonic-gate	dnsservers=`/sbin/dhcpinfo DNSserv`
2287c478bd9Sstevel@tonic-gateelse
2297c478bd9Sstevel@tonic-gate	dnsservers=""
2307c478bd9Sstevel@tonic-gatefi
2317c478bd9Sstevel@tonic-gate
2327c478bd9Sstevel@tonic-gateif [ -n "$dnsservers" ]; then
2337c478bd9Sstevel@tonic-gate	#
2347c478bd9Sstevel@tonic-gate	# Go through /etc/resolv.conf and replace any existing
2357c478bd9Sstevel@tonic-gate	# domain or nameserver entries with new ones derived
2367c478bd9Sstevel@tonic-gate	# from DHCP.  Note that it is important to preserve
2377c478bd9Sstevel@tonic-gate	# order of domain entries vs. search entries; the search
2387c478bd9Sstevel@tonic-gate	# entries are reserved for administrator customization
2397c478bd9Sstevel@tonic-gate	# and if placed after the domain entry will override it.
2407c478bd9Sstevel@tonic-gate	# See resolv.conf(4).
2417c478bd9Sstevel@tonic-gate	#
2427c478bd9Sstevel@tonic-gate	if [ ! -f /etc/resolv.conf ]; then
2437c478bd9Sstevel@tonic-gate		/usr/bin/touch /etc/resolv.conf
2447c478bd9Sstevel@tonic-gate	fi
2457c478bd9Sstevel@tonic-gate	dnsdomain=`/sbin/dhcpinfo DNSdmain`
2467c478bd9Sstevel@tonic-gate	export dnsservers dnsdomain
2477c478bd9Sstevel@tonic-gate	/usr/bin/nawk </etc/resolv.conf >/tmp/resolv.conf.$$ '
2487c478bd9Sstevel@tonic-gate		function writedomain() {
2497c478bd9Sstevel@tonic-gate			if (updated == 0) {
2507c478bd9Sstevel@tonic-gate			    	# Use only first domain, not a search list
2517c478bd9Sstevel@tonic-gate			    	split(ENVIRON["dnsdomain"], d)
2527c478bd9Sstevel@tonic-gate				if(length(d[1]) != 0)
2537c478bd9Sstevel@tonic-gate					printf("domain %s\n", d[1])
2547c478bd9Sstevel@tonic-gate			}
2557c478bd9Sstevel@tonic-gate			++updated
2567c478bd9Sstevel@tonic-gate		}
2577c478bd9Sstevel@tonic-gate		$1 == "domain" { writedomain(); next }
2587c478bd9Sstevel@tonic-gate		$1 != "nameserver" { print $0 }
2597c478bd9Sstevel@tonic-gate		END {
2607c478bd9Sstevel@tonic-gate			writedomain()
2617c478bd9Sstevel@tonic-gate			n = split(ENVIRON["dnsservers"], s)
2627c478bd9Sstevel@tonic-gate			for (i = 1; i <= n; ++i)
2637c478bd9Sstevel@tonic-gate				printf("nameserver %s\n", s[i])
2647c478bd9Sstevel@tonic-gate		}'
2657c478bd9Sstevel@tonic-gate	unset dnsservers dnsdomain
2667c478bd9Sstevel@tonic-gate	mv_file /tmp/resolv.conf.$$ /etc/resolv.conf 644
2677c478bd9Sstevel@tonic-gate	#
2687c478bd9Sstevel@tonic-gate	# Add dns to the nsswitch file, if it isn't already there.
2697c478bd9Sstevel@tonic-gate	#
2707c478bd9Sstevel@tonic-gate	update_nss hosts
2717c478bd9Sstevel@tonic-gate	update_nss ipnodes
2727c478bd9Sstevel@tonic-gate
2737c478bd9Sstevel@tonic-gateelif /usr/bin/grep '# Added by DHCP$' /etc/nsswitch.conf >/dev/null 2>&1; then
2747c478bd9Sstevel@tonic-gate
2757c478bd9Sstevel@tonic-gate	# If we added DNS to the hosts and ipnodes policy in the nsswitch,
2767c478bd9Sstevel@tonic-gate	# remove it.
2777c478bd9Sstevel@tonic-gate	/usr/bin/sed \
2787c478bd9Sstevel@tonic-gate	    -e '/# Added by DHCP$/d' \
2797c478bd9Sstevel@tonic-gate	    -e 's/^\(#hosts:\)\(.*[^#]\)\(#.*\)$/hosts: \2/' \
2807c478bd9Sstevel@tonic-gate	    -e 's/^\(#ipnodes:\)\(.*[^#]\)\(#.*\)$/ipnodes: \2/' \
2817c478bd9Sstevel@tonic-gate	    /etc/nsswitch.conf >/tmp/nsswitch.conf.$$
2827c478bd9Sstevel@tonic-gate
2837c478bd9Sstevel@tonic-gate	mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644
2847c478bd9Sstevel@tonic-gatefi
2857c478bd9Sstevel@tonic-gate
2867c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then
2877c478bd9Sstevel@tonic-gate
2887c478bd9Sstevel@tonic-gate	hostname=`/usr/bin/uname -n`
2897c478bd9Sstevel@tonic-gate	ipaddr=`/sbin/dhcpinfo Yiaddr`
29027092493Srs200217	update_hosts_file
2917c478bd9Sstevel@tonic-gate
2927c478bd9Sstevel@tonic-gateelse
2937c478bd9Sstevel@tonic-gate	# We're not using a dhcp strategy, so host entries added by
29427092493Srs200217	# DHCP should be removed from /etc/inet/hosts.
2957c478bd9Sstevel@tonic-gate
2967c478bd9Sstevel@tonic-gate	if /usr/bin/grep '# Added by DHCP$' /etc/inet/hosts >/dev/null 2>&1;
2977c478bd9Sstevel@tonic-gate	    then
2987c478bd9Sstevel@tonic-gate		/usr/bin/sed -e '/# Added by DHCP$/d' \
2997c478bd9Sstevel@tonic-gate		    /etc/inet/hosts > /tmp/hosts.$$
3007c478bd9Sstevel@tonic-gate		mv_file /tmp/hosts.$$ /etc/inet/hosts 444
3017c478bd9Sstevel@tonic-gate	fi
3027c478bd9Sstevel@tonic-gatefi
3037c478bd9Sstevel@tonic-gate
3047c478bd9Sstevel@tonic-gate#
3057c478bd9Sstevel@tonic-gate# Load the IPQoS configuration.
3067c478bd9Sstevel@tonic-gate# This is backgrounded so that any remote hostname lookups it performs
3077c478bd9Sstevel@tonic-gate# don't unduely delay startup. Any messages go via syslog.
3087c478bd9Sstevel@tonic-gate#
3097c478bd9Sstevel@tonic-gate
3107c478bd9Sstevel@tonic-gateif [ -f /usr/sbin/ipqosconf -a -f /etc/inet/ipqosinit.conf ]; then
3117c478bd9Sstevel@tonic-gate	/usr/sbin/ipqosconf -s -a /etc/inet/ipqosinit.conf &
3127c478bd9Sstevel@tonic-gatefi
3137c478bd9Sstevel@tonic-gate
3147c478bd9Sstevel@tonic-gate#
3157c478bd9Sstevel@tonic-gate# Add a static route for multicast packets out our default interface.
3167c478bd9Sstevel@tonic-gate# The default interface is the interface that corresponds to the node name.
3177c478bd9Sstevel@tonic-gate# Run in background subshell to avoid waiting for name service.
3187c478bd9Sstevel@tonic-gate#
3197c478bd9Sstevel@tonic-gate
3207c478bd9Sstevel@tonic-gate(
3217c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then
3227c478bd9Sstevel@tonic-gate	mcastif=`/sbin/dhcpinfo Yiaddr` || mcastif=$_INIT_UTS_NODENAME
3237c478bd9Sstevel@tonic-gateelse
3247c478bd9Sstevel@tonic-gate	mcastif=$_INIT_UTS_NODENAME
3257c478bd9Sstevel@tonic-gatefi
3267c478bd9Sstevel@tonic-gate
3277c478bd9Sstevel@tonic-gateecho "Setting default IPv4 interface for multicast:" \
3287c478bd9Sstevel@tonic-gate    "add net 224.0/4: gateway $mcastif"
3297c478bd9Sstevel@tonic-gate
3307c478bd9Sstevel@tonic-gate/usr/sbin/route -n add -interface 224.0/4 -gateway "$mcastif" >/dev/null
3317c478bd9Sstevel@tonic-gate) &
332