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 6*6927f468Sdp# Common Development and Distribution License (the "License"). 7*6927f468Sdp# 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*6927f468Sdp# Copyright 2006 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 34*6927f468Sdp. /lib/svc/share/smf_include.sh 35*6927f468Sdp 367c478bd9Sstevel@tonic-gatecase "$1" in 377c478bd9Sstevel@tonic-gate'start') 387c478bd9Sstevel@tonic-gate # 397c478bd9Sstevel@tonic-gate # In a zone we need this service to be up, but all of the work 407c478bd9Sstevel@tonic-gate # it tries to do is irrelevant (and will actually lead to the service 417c478bd9Sstevel@tonic-gate # failing if we try to do it), so just bail out. 427c478bd9Sstevel@tonic-gate # 43*6927f468Sdp smf_is_globalzone || exit 0 447c478bd9Sstevel@tonic-gate ;; # Fall through -- rest of script is the initialization code 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate'stop') 477c478bd9Sstevel@tonic-gate exit 0 487c478bd9Sstevel@tonic-gate ;; 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate*) 517c478bd9Sstevel@tonic-gate echo "Usage: $0 { start | stop }" 527c478bd9Sstevel@tonic-gate exit 1 537c478bd9Sstevel@tonic-gate ;; 547c478bd9Sstevel@tonic-gateesac 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate# If boot variables are not set, set variables we use 587c478bd9Sstevel@tonic-gate[ -z "$_INIT_UTS_NODENAME" ] && _INIT_UTS_NODENAME=`/usr/bin/uname -n` 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate# 617c478bd9Sstevel@tonic-gate# wait_nis 627c478bd9Sstevel@tonic-gate# Wait up to 5 seconds for ypbind to obtain a binding. 637c478bd9Sstevel@tonic-gate# 647c478bd9Sstevel@tonic-gatewait_nis () 657c478bd9Sstevel@tonic-gate{ 667c478bd9Sstevel@tonic-gate for i in 1 2 3 4 5; do 677c478bd9Sstevel@tonic-gate server=`/usr/bin/ypwhich 2>/dev/null` 687c478bd9Sstevel@tonic-gate [ $? -eq 0 -a -n "$server" ] && return 0 || sleep 1 697c478bd9Sstevel@tonic-gate done 707c478bd9Sstevel@tonic-gate return 1 717c478bd9Sstevel@tonic-gate} 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate# 747c478bd9Sstevel@tonic-gate# This function takes two file names and the file mode as input. The two 757c478bd9Sstevel@tonic-gate# files are compared for differences (using cmp(1)) and if different, the 767c478bd9Sstevel@tonic-gate# second file is over written with the first. A chmod is done with the file 777c478bd9Sstevel@tonic-gate# mode passed in. If the files are equal, the first file passed 787c478bd9Sstevel@tonic-gate# in (the /tmp file) is deleted. 797c478bd9Sstevel@tonic-gate# 807c478bd9Sstevel@tonic-gatemv_file () 817c478bd9Sstevel@tonic-gate{ 827c478bd9Sstevel@tonic-gate /usr/bin/cmp -s $1 $2 837c478bd9Sstevel@tonic-gate if [ $? -eq 1 ]; then 847c478bd9Sstevel@tonic-gate /usr/bin/mv $1 $2 857c478bd9Sstevel@tonic-gate # 867c478bd9Sstevel@tonic-gate # The umask during boot is configurable, which requires 877c478bd9Sstevel@tonic-gate # explicit setting of file permission modes when we 887c478bd9Sstevel@tonic-gate # create files. 897c478bd9Sstevel@tonic-gate # 907c478bd9Sstevel@tonic-gate /usr/bin/chmod $3 $2 917c478bd9Sstevel@tonic-gate else 927c478bd9Sstevel@tonic-gate /usr/bin/rm $1 937c478bd9Sstevel@tonic-gate fi 947c478bd9Sstevel@tonic-gate} 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate# 977c478bd9Sstevel@tonic-gate# update_nss 987c478bd9Sstevel@tonic-gate# This routine takes as a parameter, the name of the respective policy 997c478bd9Sstevel@tonic-gate# to change in the nsswitch.conf (hosts or ipnodes) to update with dns. 1007c478bd9Sstevel@tonic-gate# 1017c478bd9Sstevel@tonic-gateupdate_nss () 1027c478bd9Sstevel@tonic-gate{ 1037c478bd9Sstevel@tonic-gate policy=$1; 1047c478bd9Sstevel@tonic-gate # Add dns to the nsswitch file, if it isn't already there. 1057c478bd9Sstevel@tonic-gate /usr/bin/awk ' $1 ~ /^'${policy}':/ { 1067c478bd9Sstevel@tonic-gate n = split($0, a); 1077c478bd9Sstevel@tonic-gate newl = a[1]; 1087c478bd9Sstevel@tonic-gate if ($0 !~ /dns/) { 1097c478bd9Sstevel@tonic-gate printf("#%s # Commented out by DHCP\n", $0); 1107c478bd9Sstevel@tonic-gate updated = 0; 1117c478bd9Sstevel@tonic-gate for (i = 2; i <= n; i++) { 1127c478bd9Sstevel@tonic-gate if (updated == 0 && index(a[i], "[") == 1) { 1137c478bd9Sstevel@tonic-gate newl = newl" dns"; 1147c478bd9Sstevel@tonic-gate updated++; 1157c478bd9Sstevel@tonic-gate } 1167c478bd9Sstevel@tonic-gate newl = newl" "a[i]; 1177c478bd9Sstevel@tonic-gate } 1187c478bd9Sstevel@tonic-gate if (updated == 0) { 1197c478bd9Sstevel@tonic-gate newl = newl" dns"; 1207c478bd9Sstevel@tonic-gate updated++; 1217c478bd9Sstevel@tonic-gate } 1227c478bd9Sstevel@tonic-gate if (updated != 0) 1237c478bd9Sstevel@tonic-gate newl = newl" # Added by DHCP"; 1247c478bd9Sstevel@tonic-gate else 1257c478bd9Sstevel@tonic-gate newl = $0; 1267c478bd9Sstevel@tonic-gate printf("%s\n", newl); 1277c478bd9Sstevel@tonic-gate } else 1287c478bd9Sstevel@tonic-gate printf("%s\n", $0); 1297c478bd9Sstevel@tonic-gate } $1 !~ /^'${policy}':/ { printf("%s\n", $0); }' /etc/nsswitch.conf \ 1307c478bd9Sstevel@tonic-gate >/tmp/nsswitch.conf.$$ 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644 1337c478bd9Sstevel@tonic-gate} 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate# 1367c478bd9Sstevel@tonic-gate# update_files 1377c478bd9Sstevel@tonic-gate# This routine takes as a parameter, the name of the respective file 1387c478bd9Sstevel@tonic-gate# (hosts or ipnodes) to update with the new host name and IP address. 1397c478bd9Sstevel@tonic-gate# 1407c478bd9Sstevel@tonic-gateupdate_files () 1417c478bd9Sstevel@tonic-gate{ 1427c478bd9Sstevel@tonic-gate filename=$1; 1437c478bd9Sstevel@tonic-gate # Delete any old lines added by dhcp. 1447c478bd9Sstevel@tonic-gate /usr/bin/sed -e '/# Added by DHCP$/d' /etc/inet/${filename} \ 1457c478bd9Sstevel@tonic-gate > /tmp/${filename}_clear.$$ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate shift $# # Clear $0-9 first in case grep fails 1487c478bd9Sstevel@tonic-gate set -- `/usr/bin/grep "^[ ]*$ipaddr[ ]" \ 1497c478bd9Sstevel@tonic-gate /tmp/${filename}_clear.$$ 2>/dev/null` 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate if [ $# -gt 0 ]; then 1527c478bd9Sstevel@tonic-gate # 1537c478bd9Sstevel@tonic-gate # IP address is already in the file. Ensure the 1547c478bd9Sstevel@tonic-gate # associated hostname is the same as the Hostname 1557c478bd9Sstevel@tonic-gate # property returned by the DHCP server. 1567c478bd9Sstevel@tonic-gate # 1577c478bd9Sstevel@tonic-gate /usr/bin/sed -e "/^[ ]*${ipaddr}[ ]/d" \ 1587c478bd9Sstevel@tonic-gate /tmp/${filename}_clear.$$ >/tmp/${filename}.$$ 1597c478bd9Sstevel@tonic-gate echo "${ipaddr}\t${hostname}\t# Added by DHCP" \ 1607c478bd9Sstevel@tonic-gate >>/tmp/${filename}.$$ 1617c478bd9Sstevel@tonic-gate else 1627c478bd9Sstevel@tonic-gate # 1637c478bd9Sstevel@tonic-gate # IP address is missing from the respective file. Now check 1647c478bd9Sstevel@tonic-gate # to see if the hostname is present with a different IP. 1657c478bd9Sstevel@tonic-gate # 1667c478bd9Sstevel@tonic-gate shift $# # Clear $0-9 in case grep fails 1677c478bd9Sstevel@tonic-gate set -- `/usr/bin/grep -s -v '^#' /tmp/${filename}_clear.$$ | \ 1687c478bd9Sstevel@tonic-gate /usr/bin/egrep "[ ]${hostname}([ ]|$)"` 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate if [ $# -gt 0 ]; then 1717c478bd9Sstevel@tonic-gate # 1727c478bd9Sstevel@tonic-gate # Hostname is present in the file. Rewrite this line 1737c478bd9Sstevel@tonic-gate # to have the new IP address and the DHCP comment. 1747c478bd9Sstevel@tonic-gate # 1757c478bd9Sstevel@tonic-gate /usr/bin/sed -e "/^[ ]*${1}[ ]/d" \ 1767c478bd9Sstevel@tonic-gate /tmp/${filename}_clear.$$ >/tmp/${filename}.$$ 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate shift # Shift off $1 (the old IP) 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate echo "$ipaddr $*\c" | /usr/bin/tr ' ' '\t' \ 1817c478bd9Sstevel@tonic-gate >>/tmp/${filename}.$$ 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate echo "\t# Added by DHCP" >>/tmp/${filename}.$$ 1847c478bd9Sstevel@tonic-gate else 1857c478bd9Sstevel@tonic-gate # 1867c478bd9Sstevel@tonic-gate # Hostname is not present in the named file. 1877c478bd9Sstevel@tonic-gate # Add a new line for the host at the end of 1887c478bd9Sstevel@tonic-gate # the new respective file. 1897c478bd9Sstevel@tonic-gate # 1907c478bd9Sstevel@tonic-gate /usr/bin/mv /tmp/${filename}_clear.$$ \ 1917c478bd9Sstevel@tonic-gate /tmp/${filename}.$$ 1927c478bd9Sstevel@tonic-gate echo "${ipaddr}\t${hostname}\t# Added by DHCP" \ 1937c478bd9Sstevel@tonic-gate >>/tmp/${filename}.$$ 1947c478bd9Sstevel@tonic-gate fi 1957c478bd9Sstevel@tonic-gate fi 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate /usr/bin/rm -f /tmp/${filename}_clear.$$ 1987c478bd9Sstevel@tonic-gate mv_file /tmp/${filename}.$$ /etc/inet/${filename} 444 1997c478bd9Sstevel@tonic-gate} 2007c478bd9Sstevel@tonic-gate 2017c478bd9Sstevel@tonic-gate# 2027c478bd9Sstevel@tonic-gate# We now need to reset the netmask and broadcast address for our network 2037c478bd9Sstevel@tonic-gate# interfaces. Since this may result in a name service lookup, we want to 2047c478bd9Sstevel@tonic-gate# now wait for NIS to come up if we previously started it. 2057c478bd9Sstevel@tonic-gate# 2067c478bd9Sstevel@tonic-gatedomain=`/usr/bin/domainname 2>/dev/null` 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate[ -z "$domain" ] || [ ! -d /var/yp/binding/$domain ] || wait_nis || \ 2097c478bd9Sstevel@tonic-gate echo "WARNING: Timed out waiting for NIS to come up" >& 2 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate# 2127c478bd9Sstevel@tonic-gate# Re-set the netmask and broadcast addr for all IP interfaces. This ifconfig 2137c478bd9Sstevel@tonic-gate# is run here, after waiting for name services, so that "netmask +" will find 2147c478bd9Sstevel@tonic-gate# the netmask if it lives in a NIS map. The 'D' in -auD tells ifconfig NOT to 2157c478bd9Sstevel@tonic-gate# mess with the interface if it is under DHCP control 2167c478bd9Sstevel@tonic-gate# 2177c478bd9Sstevel@tonic-gate/usr/sbin/ifconfig -auD4 netmask + broadcast + 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate# Uncomment these lines to print complete network interface configuration 2207c478bd9Sstevel@tonic-gate# echo "network interface configuration:" 2217c478bd9Sstevel@tonic-gate# /usr/sbin/ifconfig -a 2227c478bd9Sstevel@tonic-gate 2237c478bd9Sstevel@tonic-gatesmf_netstrategy 2247c478bd9Sstevel@tonic-gate 2257c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then 2267c478bd9Sstevel@tonic-gate dnsservers=`/sbin/dhcpinfo DNSserv` 2277c478bd9Sstevel@tonic-gateelse 2287c478bd9Sstevel@tonic-gate dnsservers="" 2297c478bd9Sstevel@tonic-gatefi 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gateif [ -n "$dnsservers" ]; then 2327c478bd9Sstevel@tonic-gate # 2337c478bd9Sstevel@tonic-gate # Go through /etc/resolv.conf and replace any existing 2347c478bd9Sstevel@tonic-gate # domain or nameserver entries with new ones derived 2357c478bd9Sstevel@tonic-gate # from DHCP. Note that it is important to preserve 2367c478bd9Sstevel@tonic-gate # order of domain entries vs. search entries; the search 2377c478bd9Sstevel@tonic-gate # entries are reserved for administrator customization 2387c478bd9Sstevel@tonic-gate # and if placed after the domain entry will override it. 2397c478bd9Sstevel@tonic-gate # See resolv.conf(4). 2407c478bd9Sstevel@tonic-gate # 2417c478bd9Sstevel@tonic-gate if [ ! -f /etc/resolv.conf ]; then 2427c478bd9Sstevel@tonic-gate /usr/bin/touch /etc/resolv.conf 2437c478bd9Sstevel@tonic-gate fi 2447c478bd9Sstevel@tonic-gate dnsdomain=`/sbin/dhcpinfo DNSdmain` 2457c478bd9Sstevel@tonic-gate export dnsservers dnsdomain 2467c478bd9Sstevel@tonic-gate /usr/bin/nawk </etc/resolv.conf >/tmp/resolv.conf.$$ ' 2477c478bd9Sstevel@tonic-gate function writedomain() { 2487c478bd9Sstevel@tonic-gate if (updated == 0) { 2497c478bd9Sstevel@tonic-gate # Use only first domain, not a search list 2507c478bd9Sstevel@tonic-gate split(ENVIRON["dnsdomain"], d) 2517c478bd9Sstevel@tonic-gate if(length(d[1]) != 0) 2527c478bd9Sstevel@tonic-gate printf("domain %s\n", d[1]) 2537c478bd9Sstevel@tonic-gate } 2547c478bd9Sstevel@tonic-gate ++updated 2557c478bd9Sstevel@tonic-gate } 2567c478bd9Sstevel@tonic-gate $1 == "domain" { writedomain(); next } 2577c478bd9Sstevel@tonic-gate $1 != "nameserver" { print $0 } 2587c478bd9Sstevel@tonic-gate END { 2597c478bd9Sstevel@tonic-gate writedomain() 2607c478bd9Sstevel@tonic-gate n = split(ENVIRON["dnsservers"], s) 2617c478bd9Sstevel@tonic-gate for (i = 1; i <= n; ++i) 2627c478bd9Sstevel@tonic-gate printf("nameserver %s\n", s[i]) 2637c478bd9Sstevel@tonic-gate }' 2647c478bd9Sstevel@tonic-gate unset dnsservers dnsdomain 2657c478bd9Sstevel@tonic-gate mv_file /tmp/resolv.conf.$$ /etc/resolv.conf 644 2667c478bd9Sstevel@tonic-gate # 2677c478bd9Sstevel@tonic-gate # Add dns to the nsswitch file, if it isn't already there. 2687c478bd9Sstevel@tonic-gate # 2697c478bd9Sstevel@tonic-gate update_nss hosts 2707c478bd9Sstevel@tonic-gate update_nss ipnodes 2717c478bd9Sstevel@tonic-gate 2727c478bd9Sstevel@tonic-gateelif /usr/bin/grep '# Added by DHCP$' /etc/nsswitch.conf >/dev/null 2>&1; then 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate # If we added DNS to the hosts and ipnodes policy in the nsswitch, 2757c478bd9Sstevel@tonic-gate # remove it. 2767c478bd9Sstevel@tonic-gate /usr/bin/sed \ 2777c478bd9Sstevel@tonic-gate -e '/# Added by DHCP$/d' \ 2787c478bd9Sstevel@tonic-gate -e 's/^\(#hosts:\)\(.*[^#]\)\(#.*\)$/hosts: \2/' \ 2797c478bd9Sstevel@tonic-gate -e 's/^\(#ipnodes:\)\(.*[^#]\)\(#.*\)$/ipnodes: \2/' \ 2807c478bd9Sstevel@tonic-gate /etc/nsswitch.conf >/tmp/nsswitch.conf.$$ 2817c478bd9Sstevel@tonic-gate 2827c478bd9Sstevel@tonic-gate mv_file /tmp/nsswitch.conf.$$ /etc/nsswitch.conf 644 2837c478bd9Sstevel@tonic-gatefi 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then 2867c478bd9Sstevel@tonic-gate 2877c478bd9Sstevel@tonic-gate hostname=`/usr/bin/uname -n` 2887c478bd9Sstevel@tonic-gate ipaddr=`/sbin/dhcpinfo Yiaddr` 2897c478bd9Sstevel@tonic-gate update_files hosts 2907c478bd9Sstevel@tonic-gate update_files ipnodes 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gateelse 2937c478bd9Sstevel@tonic-gate # We're not using a dhcp strategy, so host entries added by 2947c478bd9Sstevel@tonic-gate # DHCP should be removed from /etc/inet/hosts and /etc/inet/ipnodes. 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-gate 3037c478bd9Sstevel@tonic-gate if /usr/bin/grep '# Added by DHCP$' /etc/inet/ipnodes >/dev/null 2>&1; 3047c478bd9Sstevel@tonic-gate then 3057c478bd9Sstevel@tonic-gate /usr/bin/sed -e '/# Added by DHCP$/d' \ 3067c478bd9Sstevel@tonic-gate /etc/inet/ipnodes > /tmp/ipnodes.$$ 3077c478bd9Sstevel@tonic-gate mv_file /tmp/ipnodes.$$ /etc/inet/ipnodes 444 3087c478bd9Sstevel@tonic-gate fi 3097c478bd9Sstevel@tonic-gatefi 3107c478bd9Sstevel@tonic-gate 3117c478bd9Sstevel@tonic-gate# 3127c478bd9Sstevel@tonic-gate# Load the IPQoS configuration. 3137c478bd9Sstevel@tonic-gate# This is backgrounded so that any remote hostname lookups it performs 3147c478bd9Sstevel@tonic-gate# don't unduely delay startup. Any messages go via syslog. 3157c478bd9Sstevel@tonic-gate# 3167c478bd9Sstevel@tonic-gate 3177c478bd9Sstevel@tonic-gateif [ -f /usr/sbin/ipqosconf -a -f /etc/inet/ipqosinit.conf ]; then 3187c478bd9Sstevel@tonic-gate /usr/sbin/ipqosconf -s -a /etc/inet/ipqosinit.conf & 3197c478bd9Sstevel@tonic-gatefi 3207c478bd9Sstevel@tonic-gate 3217c478bd9Sstevel@tonic-gate# 3227c478bd9Sstevel@tonic-gate# Add a static route for multicast packets out our default interface. 3237c478bd9Sstevel@tonic-gate# The default interface is the interface that corresponds to the node name. 3247c478bd9Sstevel@tonic-gate# Run in background subshell to avoid waiting for name service. 3257c478bd9Sstevel@tonic-gate# 3267c478bd9Sstevel@tonic-gate 3277c478bd9Sstevel@tonic-gate( 3287c478bd9Sstevel@tonic-gateif [ "$_INIT_NET_STRATEGY" = "dhcp" ]; then 3297c478bd9Sstevel@tonic-gate mcastif=`/sbin/dhcpinfo Yiaddr` || mcastif=$_INIT_UTS_NODENAME 3307c478bd9Sstevel@tonic-gateelse 3317c478bd9Sstevel@tonic-gate mcastif=$_INIT_UTS_NODENAME 3327c478bd9Sstevel@tonic-gatefi 3337c478bd9Sstevel@tonic-gate 3347c478bd9Sstevel@tonic-gateecho "Setting default IPv4 interface for multicast:" \ 3357c478bd9Sstevel@tonic-gate "add net 224.0/4: gateway $mcastif" 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate/usr/sbin/route -n add -interface 224.0/4 -gateway "$mcastif" >/dev/null 3387c478bd9Sstevel@tonic-gate) & 339