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# 236927f468Sdp# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T. 277c478bd9Sstevel@tonic-gate# All rights reserved. 287c478bd9Sstevel@tonic-gate# 297c478bd9Sstevel@tonic-gate# 307c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 326927f468Sdp. /lib/svc/share/smf_include.sh 336927f468Sdp. /lib/svc/share/net_include.sh 346927f468Sdp 357c478bd9Sstevel@tonic-gate# 367c478bd9Sstevel@tonic-gate# In a zone we need this service to be up, but all of the work 377c478bd9Sstevel@tonic-gate# it tries to do is irrelevant (and will actually lead to the service 387c478bd9Sstevel@tonic-gate# failing if we try to do it), so just bail out. 397c478bd9Sstevel@tonic-gate# 406927f468Sdpsmf_is_globalzone || exit $SMF_EXIT_OK 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate# Print warnings to console 437c478bd9Sstevel@tonic-gatewarn_failed_ifs() { 447c478bd9Sstevel@tonic-gate echo "Failed to $1 interface(s): $2" >/dev/msglog 457c478bd9Sstevel@tonic-gate} 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate# Make sure that the libraries essential to this stage of booting can be found. 487c478bd9Sstevel@tonic-gateLD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate# 517c478bd9Sstevel@tonic-gate# Cause ifconfig to not automatically start in.mpathd when IPMP groups are 527c478bd9Sstevel@tonic-gate# configured. This is not strictly necessary but makes it so that in.mpathd 537c478bd9Sstevel@tonic-gate# will always be started explicitly from /etc/init.d/inetinit, when we're 547c478bd9Sstevel@tonic-gate# sure that /usr is mounted. 557c478bd9Sstevel@tonic-gate# 567c478bd9Sstevel@tonic-gateSUNW_NO_MPATHD=; export SUNW_NO_MPATHD 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gatesmf_netstrategy 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate# 61*0ba2cbe9Sxc151355# Bring up link aggregations and initialize security objects. 62*0ba2cbe9Sxc151355# Note that link property initialization is deferred until after 63*0ba2cbe9Sxc151355# IP interfaces are plumbed to ensure that the links will not 64*0ba2cbe9Sxc151355# be unloaded (and the property settings lost). 65210db224Sericheng# 66210db224Sericheng/sbin/dladm up-aggr 67*0ba2cbe9Sxc151355/sbin/dladm init-secobj 68210db224Sericheng 69210db224Sericheng# 707c478bd9Sstevel@tonic-gate# If the system was net booted by DHCP, hand DHCP management off to the 717c478bd9Sstevel@tonic-gate# DHCP agent (ifconfig communicates to the DHCP agent through the 727c478bd9Sstevel@tonic-gate# loopback interface). 737c478bd9Sstevel@tonic-gate# 747c478bd9Sstevel@tonic-gateif [ -n "$_INIT_NET_IF" -a "$_INIT_NET_STRATEGY" = "dhcp" ]; then 757c478bd9Sstevel@tonic-gate /sbin/dhcpagent -a 767c478bd9Sstevel@tonic-gatefi 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate# 797c478bd9Sstevel@tonic-gate# The network initialization is done early to support diskless and 807c478bd9Sstevel@tonic-gate# dataless configurations. For IPv4 interfaces that were configured by 817c478bd9Sstevel@tonic-gate# the kernel (e.g. those on diskless machines) and not configured by 827c478bd9Sstevel@tonic-gate# DHCP, reset the netmask using the local "/etc/netmasks" file if one 837c478bd9Sstevel@tonic-gate# exists, and then reset the broadcast address based on the netmask. 847c478bd9Sstevel@tonic-gate# 857c478bd9Sstevel@tonic-gate/sbin/ifconfig -auD4 netmask + broadcast + 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate# 887c478bd9Sstevel@tonic-gate# All the IPv4 and IPv6 interfaces are plumbed before doing any 897c478bd9Sstevel@tonic-gate# interface configuration. This prevents errors from plumb failures 907c478bd9Sstevel@tonic-gate# getting mixed in with the configured interface lists that the script 917c478bd9Sstevel@tonic-gate# outputs. 927c478bd9Sstevel@tonic-gate# 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate# 957c478bd9Sstevel@tonic-gate# Get the list of IPv4 interfaces to configure by breaking 967c478bd9Sstevel@tonic-gate# /etc/hostname.* into separate args by using "." as a shell separator 977c478bd9Sstevel@tonic-gate# character. 987c478bd9Sstevel@tonic-gate# 997c478bd9Sstevel@tonic-gateinterface_names="`echo /etc/hostname.*[0-9] 2>/dev/null`" 1007c478bd9Sstevel@tonic-gateif [ "$interface_names" != "/etc/hostname.*[0-9]" ]; then 1017c478bd9Sstevel@tonic-gate ORIGIFS="$IFS" 1027c478bd9Sstevel@tonic-gate IFS="$IFS." 1037c478bd9Sstevel@tonic-gate set -- $interface_names 1047c478bd9Sstevel@tonic-gate IFS="$ORIGIFS" 1057c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 1067c478bd9Sstevel@tonic-gate shift 1077c478bd9Sstevel@tonic-gate if [ "$1" = "xx0" ]; then 1087c478bd9Sstevel@tonic-gate # 1097c478bd9Sstevel@tonic-gate # For some unknown historical reason the xx0 1107c478bd9Sstevel@tonic-gate # ifname is ignored. 1117c478bd9Sstevel@tonic-gate # 1127c478bd9Sstevel@tonic-gate shift 1137c478bd9Sstevel@tonic-gate continue 1147c478bd9Sstevel@tonic-gate fi 1157c478bd9Sstevel@tonic-gate if [ $# -gt 1 -a "$2" != "/etc/hostname" ]; then 1167c478bd9Sstevel@tonic-gate while [ $# -gt 1 -a "$1" != "/etc/hostname" ]; do 1177c478bd9Sstevel@tonic-gate shift 1187c478bd9Sstevel@tonic-gate done 1197c478bd9Sstevel@tonic-gate else 1207c478bd9Sstevel@tonic-gate inet_list="$inet_list $1" 1217c478bd9Sstevel@tonic-gate shift 1227c478bd9Sstevel@tonic-gate fi 1237c478bd9Sstevel@tonic-gate done 1247c478bd9Sstevel@tonic-gatefi 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate# 1277c478bd9Sstevel@tonic-gate# Get the list of IPv6 interfaces to configure by breaking 1287c478bd9Sstevel@tonic-gate# /etc/hostname6.* into separate args by using "." as a shell separator 1297c478bd9Sstevel@tonic-gate# character. 1307c478bd9Sstevel@tonic-gate# 1317c478bd9Sstevel@tonic-gateinterface_names="`echo /etc/hostname6.*[0-9] 2>/dev/null`" 1327c478bd9Sstevel@tonic-gateif [ "$interface_names" != "/etc/hostname6.*[0-9]" ]; then 1337c478bd9Sstevel@tonic-gate ORIGIFS="$IFS" 1347c478bd9Sstevel@tonic-gate IFS="$IFS." 1357c478bd9Sstevel@tonic-gate set -- $interface_names 1367c478bd9Sstevel@tonic-gate IFS="$ORIGIFS" 1377c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 1387c478bd9Sstevel@tonic-gate shift 1397c478bd9Sstevel@tonic-gate if [ $# -gt 1 -a "$2" != "/etc/hostname6" ]; then 1407c478bd9Sstevel@tonic-gate while [ $# -gt 1 -a "$1" != "/etc/hostname6" ]; do 1417c478bd9Sstevel@tonic-gate shift 1427c478bd9Sstevel@tonic-gate done 1437c478bd9Sstevel@tonic-gate else 1447c478bd9Sstevel@tonic-gate inet6_list="$inet6_list $1" 1457c478bd9Sstevel@tonic-gate shift 1467c478bd9Sstevel@tonic-gate fi 1477c478bd9Sstevel@tonic-gate done 1487c478bd9Sstevel@tonic-gatefi 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate# 1527c478bd9Sstevel@tonic-gate# Step through the IPv4 interface list and try to plumb every interface. 1537c478bd9Sstevel@tonic-gate# Generate list of plumbed and failed IPv4 interfaces. 1547c478bd9Sstevel@tonic-gate# 1557c478bd9Sstevel@tonic-gateif [ -n "$inet_list" ]; then 1567c478bd9Sstevel@tonic-gate set -- $inet_list 1577c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 1587c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 plumb 1597c478bd9Sstevel@tonic-gate if /sbin/ifconfig $1 inet >/dev/null 2>&1; then 1607c478bd9Sstevel@tonic-gate inet_plumbed="$inet_plumbed $1" 1617c478bd9Sstevel@tonic-gate else 1627c478bd9Sstevel@tonic-gate inet_failed="$inet_failed $1" 1637c478bd9Sstevel@tonic-gate fi 1647c478bd9Sstevel@tonic-gate shift 1657c478bd9Sstevel@tonic-gate done 1667c478bd9Sstevel@tonic-gate [ -n "$inet_failed" ] && warn_failed_ifs "plumb IPv4" $inet_failed 1677c478bd9Sstevel@tonic-gatefi 1687c478bd9Sstevel@tonic-gate 169516fc7f3Shx147065# Run autoconf to connect to a WLAN if the interface is a wireless one 170516fc7f3Shx147065if [ -x /sbin/wificonfig -a -n "$inet_plumbed" ]; then 171516fc7f3Shx147065 set -- $inet_plumbed 172516fc7f3Shx147065 while [ $# -gt 0 ]; do 173516fc7f3Shx147065 if [ -r /dev/wifi/$1 ]; then 174516fc7f3Shx147065 /sbin/wificonfig -i $1 startconf >/dev/null 175516fc7f3Shx147065 fi 176516fc7f3Shx147065 shift 177516fc7f3Shx147065 done 178516fc7f3Shx147065fi 179516fc7f3Shx147065 1807c478bd9Sstevel@tonic-gate# 1817c478bd9Sstevel@tonic-gate# Step through the IPv6 interface list and plumb every interface. 1827c478bd9Sstevel@tonic-gate# Generate list of plumbed and failed IPv6 interfaces. Each plumbed 1837c478bd9Sstevel@tonic-gate# interface will be brought up later, after processing any contents of 1847c478bd9Sstevel@tonic-gate# the /etc/hostname6.* file. 1857c478bd9Sstevel@tonic-gate# 1867c478bd9Sstevel@tonic-gateif [ -n "$inet6_list" ]; then 1877c478bd9Sstevel@tonic-gate set -- $inet6_list 1887c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 1897c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 inet6 plumb 1907c478bd9Sstevel@tonic-gate if /sbin/ifconfig $1 inet6 >/dev/null 2>&1; then 1917c478bd9Sstevel@tonic-gate inet6_plumbed="$inet6_plumbed $1" 1927c478bd9Sstevel@tonic-gate else 1937c478bd9Sstevel@tonic-gate inet6_failed="$inet6_failed $1" 1947c478bd9Sstevel@tonic-gate fi 1957c478bd9Sstevel@tonic-gate shift 1967c478bd9Sstevel@tonic-gate done 1977c478bd9Sstevel@tonic-gate [ -n "$inet6_failed" ] && warn_failed_ifs "plumb IPv6" $inet6_failed 1987c478bd9Sstevel@tonic-gatefi 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate# 201*0ba2cbe9Sxc151355# Unfortunately, if a driver unloads and then is subsequently reloaded, no 202*0ba2cbe9Sxc151355# mechanism currently exists to restore the properties of its associated 203*0ba2cbe9Sxc151355# links. Hence, we wait until after interfaces have been plumbed (above) 204*0ba2cbe9Sxc151355# to initialize link properties. 205*0ba2cbe9Sxc151355# 206*0ba2cbe9Sxc151355/sbin/dladm init-linkprop 207*0ba2cbe9Sxc151355 208*0ba2cbe9Sxc151355# 2097c478bd9Sstevel@tonic-gate# Process the /etc/hostname.* files of plumbed IPv4 interfaces. If an 2107c478bd9Sstevel@tonic-gate# /etc/hostname file is not present or is empty, the ifconfig auto-dhcp 2117c478bd9Sstevel@tonic-gate# / auto-revarp command will attempt to set the address, later. 2127c478bd9Sstevel@tonic-gate# 2137c478bd9Sstevel@tonic-gate# If /etc/hostname.lo0 exists the loop below will do additional 2147c478bd9Sstevel@tonic-gate# configuration of lo0. 2157c478bd9Sstevel@tonic-gate# 2167c478bd9Sstevel@tonic-gateif [ -n "$inet_plumbed" ]; then 2177c478bd9Sstevel@tonic-gate i4s_fail= 2187c478bd9Sstevel@tonic-gate echo "configuring IPv4 interfaces:\c" 2197c478bd9Sstevel@tonic-gate set -- $inet_plumbed 2207c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 2217c478bd9Sstevel@tonic-gate inet_process_hostname /sbin/ifconfig $1 inet \ 2227c478bd9Sstevel@tonic-gate </etc/hostname.$1 >/dev/null 2237c478bd9Sstevel@tonic-gate [ $? != 0 ] && i4s_fail="$i4s_fail $1" 2247c478bd9Sstevel@tonic-gate echo " $1\c" 2257c478bd9Sstevel@tonic-gate shift 2267c478bd9Sstevel@tonic-gate done 2277c478bd9Sstevel@tonic-gate echo "." 2287c478bd9Sstevel@tonic-gate [ -n "$i4s_fail" ] && warn_failed_ifs "configure IPv4" $i4s_fail 2297c478bd9Sstevel@tonic-gatefi 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gate# 2327c478bd9Sstevel@tonic-gate# Process the /etc/hostname6.* files of plumbed IPv6 interfaces. After 2337c478bd9Sstevel@tonic-gate# processing the hostname6 file, bring the interface up. If 2347c478bd9Sstevel@tonic-gate# /etc/hostname6.lo0 exists the loop below will do additional 2357c478bd9Sstevel@tonic-gate# configuration of lo0. 2367c478bd9Sstevel@tonic-gate# 2377c478bd9Sstevel@tonic-gateif [ -n "$inet6_plumbed" ]; then 2387c478bd9Sstevel@tonic-gate i6_fail= 2397c478bd9Sstevel@tonic-gate echo "configuring IPv6 interfaces:\c" 2407c478bd9Sstevel@tonic-gate set -- $inet6_plumbed 2417c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 2427c478bd9Sstevel@tonic-gate inet6_process_hostname /sbin/ifconfig $1 inet6 \ 2437c478bd9Sstevel@tonic-gate </etc/hostname6.$1 >/dev/null && 2447c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 inet6 up 2457c478bd9Sstevel@tonic-gate [ $? != 0 ] && i6_fail="$i6_fail $1" 2467c478bd9Sstevel@tonic-gate echo " $1\c" 2477c478bd9Sstevel@tonic-gate shift 2487c478bd9Sstevel@tonic-gate done 2497c478bd9Sstevel@tonic-gate echo "." 2507c478bd9Sstevel@tonic-gate [ -n "$i6_fail" ] && warn_failed_ifs "configure IPv6" $i6_fail 2517c478bd9Sstevel@tonic-gatefi 2527c478bd9Sstevel@tonic-gate 2537c478bd9Sstevel@tonic-gate# Run DHCP if requested. Skip boot-configured interface. 2547c478bd9Sstevel@tonic-gateinterface_names="`echo /etc/dhcp.*[0-9] 2>/dev/null`" 2557c478bd9Sstevel@tonic-gateif [ "$interface_names" != '/etc/dhcp.*[0-9]' ]; then 2567c478bd9Sstevel@tonic-gate # 2577c478bd9Sstevel@tonic-gate # First find the primary interface. Default to the first 2587c478bd9Sstevel@tonic-gate # interface if not specified. First primary interface found 2597c478bd9Sstevel@tonic-gate # "wins". Use care not to "reconfigure" a net-booted interface 2607c478bd9Sstevel@tonic-gate # configured using DHCP. Run through the list of interfaces 2617c478bd9Sstevel@tonic-gate # again, this time trying DHCP. 2627c478bd9Sstevel@tonic-gate # 2637c478bd9Sstevel@tonic-gate i4d_fail= 2647c478bd9Sstevel@tonic-gate firstif= 2657c478bd9Sstevel@tonic-gate primary= 2667c478bd9Sstevel@tonic-gate ORIGIFS="$IFS" 2677c478bd9Sstevel@tonic-gate IFS="${IFS}." 2687c478bd9Sstevel@tonic-gate set -- $interface_names 2697c478bd9Sstevel@tonic-gate 2707c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 2717c478bd9Sstevel@tonic-gate shift 2727c478bd9Sstevel@tonic-gate [ -z "$firstif" ] && firstif=$1 2737c478bd9Sstevel@tonic-gate 2747c478bd9Sstevel@tonic-gate for i in `shcat /etc/dhcp\.$1`; do 2757c478bd9Sstevel@tonic-gate if [ "$i" = primary ]; then 2767c478bd9Sstevel@tonic-gate primary=$1 2777c478bd9Sstevel@tonic-gate break 2787c478bd9Sstevel@tonic-gate fi 2797c478bd9Sstevel@tonic-gate done 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate [ -n "$primary" ] && break 2827c478bd9Sstevel@tonic-gate shift 2837c478bd9Sstevel@tonic-gate done 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate [ -z "$primary" ] && primary="$firstif" 2867c478bd9Sstevel@tonic-gate cmdline=`shcat /etc/dhcp\.${primary}` 2877c478bd9Sstevel@tonic-gate 2887c478bd9Sstevel@tonic-gate if [ "$_INIT_NET_IF" != "$primary" ]; then 2897c478bd9Sstevel@tonic-gate echo "starting DHCP on primary interface $primary" 2907c478bd9Sstevel@tonic-gate /sbin/ifconfig $primary auto-dhcp primary $cmdline 2917c478bd9Sstevel@tonic-gate # Exit code 4 means ifconfig timed out waiting for dhcpagent 2927c478bd9Sstevel@tonic-gate [ $? != 0 ] && [ $? != 4 ] && i4d_fail="$i4d_fail $primary" 2937c478bd9Sstevel@tonic-gate fi 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gate set -- $interface_names 2967c478bd9Sstevel@tonic-gate 2977c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 2987c478bd9Sstevel@tonic-gate shift 2997c478bd9Sstevel@tonic-gate cmdline=`shcat /etc/dhcp\.$1` 3007c478bd9Sstevel@tonic-gate if [ "$1" != "$primary" -a \ 3017c478bd9Sstevel@tonic-gate "$1" != "$_INIT_NET_IF" ]; then 3027c478bd9Sstevel@tonic-gate echo "starting DHCP on interface $1" 3037c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 dhcp start wait 0 $cmdline 3047c478bd9Sstevel@tonic-gate # Exit code can't be timeout when wait is 0 3057c478bd9Sstevel@tonic-gate [ $? != 0 ] && i4d_fail="$i4d_fail $1" 3067c478bd9Sstevel@tonic-gate fi 3077c478bd9Sstevel@tonic-gate shift 3087c478bd9Sstevel@tonic-gate done 3097c478bd9Sstevel@tonic-gate IFS="$ORIGIFS" 3107c478bd9Sstevel@tonic-gate unset ORIGIFS 3117c478bd9Sstevel@tonic-gate [ -n "$i4d_fail" ] && warn_failed_ifs "configure IPv4 DHCP" $i4d_fail 3127c478bd9Sstevel@tonic-gatefi 3137c478bd9Sstevel@tonic-gate 3140659b2b8Sse146197# In order to avoid bringing up the interfaces that have 3150659b2b8Sse146197# intentionally been left down, perform RARP only if the system 3160659b2b8Sse146197# has no configured hostname in /etc/nodename 3170659b2b8Sse146197hostname="`shcat /etc/nodename 2>/dev/null`" 3180659b2b8Sse146197if [ "$_INIT_NET_STRATEGY" = "rarp" -o -z "$hostname" ]; then 3197c478bd9Sstevel@tonic-gate /sbin/ifconfig -adD4 auto-revarp netmask + broadcast + up 3200659b2b8Sse146197fi 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate# 3237c478bd9Sstevel@tonic-gate# Process IPv4 and IPv6 interfaces that failed to plumb. Find an 3247c478bd9Sstevel@tonic-gate# alternative interface to host the addresses. 3257c478bd9Sstevel@tonic-gate# 3267c478bd9Sstevel@tonic-gate[ -n "$inet_failed" ] && move_addresses inet 3277c478bd9Sstevel@tonic-gate 3287c478bd9Sstevel@tonic-gate[ -n "$inet6_failed" ] && move_addresses inet6 3297c478bd9Sstevel@tonic-gate 3307c478bd9Sstevel@tonic-gate# 3317c478bd9Sstevel@tonic-gate# If the /etc/defaultrouter file exists, process it now so that the next 3327c478bd9Sstevel@tonic-gate# stage of booting will have access to NFS. 3337c478bd9Sstevel@tonic-gate# 3347c478bd9Sstevel@tonic-gateif [ -f /etc/defaultrouter ]; then 3357c478bd9Sstevel@tonic-gate while read router rubbish; do 3367c478bd9Sstevel@tonic-gate case "$router" in 3377c478bd9Sstevel@tonic-gate '#'* | '') ;; # Ignore comments, empty lines 3387c478bd9Sstevel@tonic-gate *) /sbin/route -n add default -gateway $router ;; 3397c478bd9Sstevel@tonic-gate esac 3407c478bd9Sstevel@tonic-gate done </etc/defaultrouter 3417c478bd9Sstevel@tonic-gatefi 3427c478bd9Sstevel@tonic-gate 3437c478bd9Sstevel@tonic-gate# 3447c478bd9Sstevel@tonic-gate# We tell smf this service is online if any of the following is true: 3457c478bd9Sstevel@tonic-gate# - no interfaces were configured for plumbing and no DHCP failures 3467c478bd9Sstevel@tonic-gate# - any non-loopback IPv4 interfaces are up and have a non-zero address 3477c478bd9Sstevel@tonic-gate# - there are any DHCP interfaces started 3487c478bd9Sstevel@tonic-gate# - any non-loopback IPv6 interfaces are up 3497c478bd9Sstevel@tonic-gate# 3507c478bd9Sstevel@tonic-gate# If we weren't asked to configure any interfaces, exit 3517c478bd9Sstevel@tonic-gateif [ -z "$inet_list" ] && [ -z "$inet6_list" ]; then 3527c478bd9Sstevel@tonic-gate # Config error if DHCP was attempted without plumbed interfaces 3537c478bd9Sstevel@tonic-gate [ -n "$i4d_fail" ] && exit $SMF_EXIT_ERR_CONFIG 3547c478bd9Sstevel@tonic-gate exit $SMF_EXIT_OK 3557c478bd9Sstevel@tonic-gatefi 3567c478bd9Sstevel@tonic-gate 3577c478bd9Sstevel@tonic-gate# Any non-loopback IPv4 interfaces with usable addresses up? 3587c478bd9Sstevel@tonic-gateif [ -n "`/sbin/ifconfig -a4u`" ]; then 3597c478bd9Sstevel@tonic-gate /sbin/ifconfig -a4u | while read intf addr rest; do 3607c478bd9Sstevel@tonic-gate [ $intf = inet ] && [ $addr != 127.0.0.1 ] && 3617c478bd9Sstevel@tonic-gate [ $addr != 0.0.0.0 ] && exit 0 3627c478bd9Sstevel@tonic-gate done && exit $SMF_EXIT_OK 3637c478bd9Sstevel@tonic-gatefi 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate# Any DHCP interfaces started? 3667c478bd9Sstevel@tonic-gate[ -n "`/sbin/ifconfig -a4 dhcp status 2>/dev/null`" ] && exit $SMF_EXIT_OK 3677c478bd9Sstevel@tonic-gate 3687c478bd9Sstevel@tonic-gate# Any non-loopback IPv6 interfaces up? 3697c478bd9Sstevel@tonic-gateif [ -n "`/sbin/ifconfig -au6`" ]; then 3707c478bd9Sstevel@tonic-gate /sbin/ifconfig -au6 | while read intf addr rest; do 3717c478bd9Sstevel@tonic-gate [ $intf = inet6 ] && [ $addr != ::1/128 ] && exit 0 3727c478bd9Sstevel@tonic-gate done && exit $SMF_EXIT_OK 3737c478bd9Sstevel@tonic-gatefi 3747c478bd9Sstevel@tonic-gate 3757c478bd9Sstevel@tonic-gate# This service was supposed to configure something yet didn't. Exit 3767c478bd9Sstevel@tonic-gate# with config error. 3777c478bd9Sstevel@tonic-gateexit $SMF_EXIT_ERR_CONFIG 378