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# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T. 28*7c478bd9Sstevel@tonic-gate# All rights reserved. 29*7c478bd9Sstevel@tonic-gate# 30*7c478bd9Sstevel@tonic-gate# 31*7c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate# 34*7c478bd9Sstevel@tonic-gate# In a zone we need this service to be up, but all of the work 35*7c478bd9Sstevel@tonic-gate# it tries to do is irrelevant (and will actually lead to the service 36*7c478bd9Sstevel@tonic-gate# failing if we try to do it), so just bail out. 37*7c478bd9Sstevel@tonic-gate# 38*7c478bd9Sstevel@tonic-gateif [ `/sbin/zonename` != "global" ]; then 39*7c478bd9Sstevel@tonic-gate exit 0 40*7c478bd9Sstevel@tonic-gatefi 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 43*7c478bd9Sstevel@tonic-gate. /lib/svc/share/net_include.sh 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate# Print warnings to console 46*7c478bd9Sstevel@tonic-gatewarn_failed_ifs() { 47*7c478bd9Sstevel@tonic-gate echo "Failed to $1 interface(s): $2" >/dev/msglog 48*7c478bd9Sstevel@tonic-gate} 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate# Make sure that the libraries essential to this stage of booting can be found. 51*7c478bd9Sstevel@tonic-gateLD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate# 54*7c478bd9Sstevel@tonic-gate# Cause ifconfig to not automatically start in.mpathd when IPMP groups are 55*7c478bd9Sstevel@tonic-gate# configured. This is not strictly necessary but makes it so that in.mpathd 56*7c478bd9Sstevel@tonic-gate# will always be started explicitly from /etc/init.d/inetinit, when we're 57*7c478bd9Sstevel@tonic-gate# sure that /usr is mounted. 58*7c478bd9Sstevel@tonic-gate# 59*7c478bd9Sstevel@tonic-gateSUNW_NO_MPATHD=; export SUNW_NO_MPATHD 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gatesmf_netstrategy 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate# 64*7c478bd9Sstevel@tonic-gate# If the system was net booted by DHCP, hand DHCP management off to the 65*7c478bd9Sstevel@tonic-gate# DHCP agent (ifconfig communicates to the DHCP agent through the 66*7c478bd9Sstevel@tonic-gate# loopback interface). 67*7c478bd9Sstevel@tonic-gate# 68*7c478bd9Sstevel@tonic-gateif [ -n "$_INIT_NET_IF" -a "$_INIT_NET_STRATEGY" = "dhcp" ]; then 69*7c478bd9Sstevel@tonic-gate /sbin/dhcpagent -a 70*7c478bd9Sstevel@tonic-gatefi 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate# 73*7c478bd9Sstevel@tonic-gate# The network initialization is done early to support diskless and 74*7c478bd9Sstevel@tonic-gate# dataless configurations. For IPv4 interfaces that were configured by 75*7c478bd9Sstevel@tonic-gate# the kernel (e.g. those on diskless machines) and not configured by 76*7c478bd9Sstevel@tonic-gate# DHCP, reset the netmask using the local "/etc/netmasks" file if one 77*7c478bd9Sstevel@tonic-gate# exists, and then reset the broadcast address based on the netmask. 78*7c478bd9Sstevel@tonic-gate# 79*7c478bd9Sstevel@tonic-gate/sbin/ifconfig -auD4 netmask + broadcast + 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate# 82*7c478bd9Sstevel@tonic-gate# All the IPv4 and IPv6 interfaces are plumbed before doing any 83*7c478bd9Sstevel@tonic-gate# interface configuration. This prevents errors from plumb failures 84*7c478bd9Sstevel@tonic-gate# getting mixed in with the configured interface lists that the script 85*7c478bd9Sstevel@tonic-gate# outputs. 86*7c478bd9Sstevel@tonic-gate# 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate# 89*7c478bd9Sstevel@tonic-gate# Get the list of IPv4 interfaces to configure by breaking 90*7c478bd9Sstevel@tonic-gate# /etc/hostname.* into separate args by using "." as a shell separator 91*7c478bd9Sstevel@tonic-gate# character. 92*7c478bd9Sstevel@tonic-gate# 93*7c478bd9Sstevel@tonic-gateinterface_names="`echo /etc/hostname.*[0-9] 2>/dev/null`" 94*7c478bd9Sstevel@tonic-gateif [ "$interface_names" != "/etc/hostname.*[0-9]" ]; then 95*7c478bd9Sstevel@tonic-gate ORIGIFS="$IFS" 96*7c478bd9Sstevel@tonic-gate IFS="$IFS." 97*7c478bd9Sstevel@tonic-gate set -- $interface_names 98*7c478bd9Sstevel@tonic-gate IFS="$ORIGIFS" 99*7c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 100*7c478bd9Sstevel@tonic-gate shift 101*7c478bd9Sstevel@tonic-gate if [ "$1" = "xx0" ]; then 102*7c478bd9Sstevel@tonic-gate # 103*7c478bd9Sstevel@tonic-gate # For some unknown historical reason the xx0 104*7c478bd9Sstevel@tonic-gate # ifname is ignored. 105*7c478bd9Sstevel@tonic-gate # 106*7c478bd9Sstevel@tonic-gate shift 107*7c478bd9Sstevel@tonic-gate continue 108*7c478bd9Sstevel@tonic-gate fi 109*7c478bd9Sstevel@tonic-gate if [ $# -gt 1 -a "$2" != "/etc/hostname" ]; then 110*7c478bd9Sstevel@tonic-gate while [ $# -gt 1 -a "$1" != "/etc/hostname" ]; do 111*7c478bd9Sstevel@tonic-gate shift 112*7c478bd9Sstevel@tonic-gate done 113*7c478bd9Sstevel@tonic-gate else 114*7c478bd9Sstevel@tonic-gate inet_list="$inet_list $1" 115*7c478bd9Sstevel@tonic-gate shift 116*7c478bd9Sstevel@tonic-gate fi 117*7c478bd9Sstevel@tonic-gate done 118*7c478bd9Sstevel@tonic-gatefi 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate# 121*7c478bd9Sstevel@tonic-gate# Get the list of IPv6 interfaces to configure by breaking 122*7c478bd9Sstevel@tonic-gate# /etc/hostname6.* into separate args by using "." as a shell separator 123*7c478bd9Sstevel@tonic-gate# character. 124*7c478bd9Sstevel@tonic-gate# 125*7c478bd9Sstevel@tonic-gateinterface_names="`echo /etc/hostname6.*[0-9] 2>/dev/null`" 126*7c478bd9Sstevel@tonic-gateif [ "$interface_names" != "/etc/hostname6.*[0-9]" ]; then 127*7c478bd9Sstevel@tonic-gate ORIGIFS="$IFS" 128*7c478bd9Sstevel@tonic-gate IFS="$IFS." 129*7c478bd9Sstevel@tonic-gate set -- $interface_names 130*7c478bd9Sstevel@tonic-gate IFS="$ORIGIFS" 131*7c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 132*7c478bd9Sstevel@tonic-gate shift 133*7c478bd9Sstevel@tonic-gate if [ $# -gt 1 -a "$2" != "/etc/hostname6" ]; then 134*7c478bd9Sstevel@tonic-gate while [ $# -gt 1 -a "$1" != "/etc/hostname6" ]; do 135*7c478bd9Sstevel@tonic-gate shift 136*7c478bd9Sstevel@tonic-gate done 137*7c478bd9Sstevel@tonic-gate else 138*7c478bd9Sstevel@tonic-gate inet6_list="$inet6_list $1" 139*7c478bd9Sstevel@tonic-gate shift 140*7c478bd9Sstevel@tonic-gate fi 141*7c478bd9Sstevel@tonic-gate done 142*7c478bd9Sstevel@tonic-gatefi 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate# 146*7c478bd9Sstevel@tonic-gate# Step through the IPv4 interface list and try to plumb every interface. 147*7c478bd9Sstevel@tonic-gate# Generate list of plumbed and failed IPv4 interfaces. 148*7c478bd9Sstevel@tonic-gate# 149*7c478bd9Sstevel@tonic-gateif [ -n "$inet_list" ]; then 150*7c478bd9Sstevel@tonic-gate set -- $inet_list 151*7c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 152*7c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 plumb 153*7c478bd9Sstevel@tonic-gate if /sbin/ifconfig $1 inet >/dev/null 2>&1; then 154*7c478bd9Sstevel@tonic-gate inet_plumbed="$inet_plumbed $1" 155*7c478bd9Sstevel@tonic-gate else 156*7c478bd9Sstevel@tonic-gate inet_failed="$inet_failed $1" 157*7c478bd9Sstevel@tonic-gate fi 158*7c478bd9Sstevel@tonic-gate shift 159*7c478bd9Sstevel@tonic-gate done 160*7c478bd9Sstevel@tonic-gate [ -n "$inet_failed" ] && warn_failed_ifs "plumb IPv4" $inet_failed 161*7c478bd9Sstevel@tonic-gatefi 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate# 164*7c478bd9Sstevel@tonic-gate# Step through the IPv6 interface list and plumb every interface. 165*7c478bd9Sstevel@tonic-gate# Generate list of plumbed and failed IPv6 interfaces. Each plumbed 166*7c478bd9Sstevel@tonic-gate# interface will be brought up later, after processing any contents of 167*7c478bd9Sstevel@tonic-gate# the /etc/hostname6.* file. 168*7c478bd9Sstevel@tonic-gate# 169*7c478bd9Sstevel@tonic-gateif [ -n "$inet6_list" ]; then 170*7c478bd9Sstevel@tonic-gate set -- $inet6_list 171*7c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 172*7c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 inet6 plumb 173*7c478bd9Sstevel@tonic-gate if /sbin/ifconfig $1 inet6 >/dev/null 2>&1; then 174*7c478bd9Sstevel@tonic-gate inet6_plumbed="$inet6_plumbed $1" 175*7c478bd9Sstevel@tonic-gate else 176*7c478bd9Sstevel@tonic-gate inet6_failed="$inet6_failed $1" 177*7c478bd9Sstevel@tonic-gate fi 178*7c478bd9Sstevel@tonic-gate shift 179*7c478bd9Sstevel@tonic-gate done 180*7c478bd9Sstevel@tonic-gate [ -n "$inet6_failed" ] && warn_failed_ifs "plumb IPv6" $inet6_failed 181*7c478bd9Sstevel@tonic-gatefi 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate# 184*7c478bd9Sstevel@tonic-gate# Process the /etc/hostname.* files of plumbed IPv4 interfaces. If an 185*7c478bd9Sstevel@tonic-gate# /etc/hostname file is not present or is empty, the ifconfig auto-dhcp 186*7c478bd9Sstevel@tonic-gate# / auto-revarp command will attempt to set the address, later. 187*7c478bd9Sstevel@tonic-gate# 188*7c478bd9Sstevel@tonic-gate# If /etc/hostname.lo0 exists the loop below will do additional 189*7c478bd9Sstevel@tonic-gate# configuration of lo0. 190*7c478bd9Sstevel@tonic-gate# 191*7c478bd9Sstevel@tonic-gateif [ -n "$inet_plumbed" ]; then 192*7c478bd9Sstevel@tonic-gate i4s_fail= 193*7c478bd9Sstevel@tonic-gate echo "configuring IPv4 interfaces:\c" 194*7c478bd9Sstevel@tonic-gate set -- $inet_plumbed 195*7c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 196*7c478bd9Sstevel@tonic-gate inet_process_hostname /sbin/ifconfig $1 inet \ 197*7c478bd9Sstevel@tonic-gate </etc/hostname.$1 >/dev/null 198*7c478bd9Sstevel@tonic-gate [ $? != 0 ] && i4s_fail="$i4s_fail $1" 199*7c478bd9Sstevel@tonic-gate echo " $1\c" 200*7c478bd9Sstevel@tonic-gate shift 201*7c478bd9Sstevel@tonic-gate done 202*7c478bd9Sstevel@tonic-gate echo "." 203*7c478bd9Sstevel@tonic-gate [ -n "$i4s_fail" ] && warn_failed_ifs "configure IPv4" $i4s_fail 204*7c478bd9Sstevel@tonic-gatefi 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate# 207*7c478bd9Sstevel@tonic-gate# Process the /etc/hostname6.* files of plumbed IPv6 interfaces. After 208*7c478bd9Sstevel@tonic-gate# processing the hostname6 file, bring the interface up. If 209*7c478bd9Sstevel@tonic-gate# /etc/hostname6.lo0 exists the loop below will do additional 210*7c478bd9Sstevel@tonic-gate# configuration of lo0. 211*7c478bd9Sstevel@tonic-gate# 212*7c478bd9Sstevel@tonic-gateif [ -n "$inet6_plumbed" ]; then 213*7c478bd9Sstevel@tonic-gate i6_fail= 214*7c478bd9Sstevel@tonic-gate echo "configuring IPv6 interfaces:\c" 215*7c478bd9Sstevel@tonic-gate set -- $inet6_plumbed 216*7c478bd9Sstevel@tonic-gate while [ $# -gt 0 ]; do 217*7c478bd9Sstevel@tonic-gate inet6_process_hostname /sbin/ifconfig $1 inet6 \ 218*7c478bd9Sstevel@tonic-gate </etc/hostname6.$1 >/dev/null && 219*7c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 inet6 up 220*7c478bd9Sstevel@tonic-gate [ $? != 0 ] && i6_fail="$i6_fail $1" 221*7c478bd9Sstevel@tonic-gate echo " $1\c" 222*7c478bd9Sstevel@tonic-gate shift 223*7c478bd9Sstevel@tonic-gate done 224*7c478bd9Sstevel@tonic-gate echo "." 225*7c478bd9Sstevel@tonic-gate [ -n "$i6_fail" ] && warn_failed_ifs "configure IPv6" $i6_fail 226*7c478bd9Sstevel@tonic-gatefi 227*7c478bd9Sstevel@tonic-gate 228*7c478bd9Sstevel@tonic-gate# Run DHCP if requested. Skip boot-configured interface. 229*7c478bd9Sstevel@tonic-gateinterface_names="`echo /etc/dhcp.*[0-9] 2>/dev/null`" 230*7c478bd9Sstevel@tonic-gateif [ "$interface_names" != '/etc/dhcp.*[0-9]' ]; then 231*7c478bd9Sstevel@tonic-gate # 232*7c478bd9Sstevel@tonic-gate # First find the primary interface. Default to the first 233*7c478bd9Sstevel@tonic-gate # interface if not specified. First primary interface found 234*7c478bd9Sstevel@tonic-gate # "wins". Use care not to "reconfigure" a net-booted interface 235*7c478bd9Sstevel@tonic-gate # configured using DHCP. Run through the list of interfaces 236*7c478bd9Sstevel@tonic-gate # again, this time trying DHCP. 237*7c478bd9Sstevel@tonic-gate # 238*7c478bd9Sstevel@tonic-gate i4d_fail= 239*7c478bd9Sstevel@tonic-gate firstif= 240*7c478bd9Sstevel@tonic-gate primary= 241*7c478bd9Sstevel@tonic-gate ORIGIFS="$IFS" 242*7c478bd9Sstevel@tonic-gate IFS="${IFS}." 243*7c478bd9Sstevel@tonic-gate set -- $interface_names 244*7c478bd9Sstevel@tonic-gate 245*7c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 246*7c478bd9Sstevel@tonic-gate shift 247*7c478bd9Sstevel@tonic-gate [ -z "$firstif" ] && firstif=$1 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate for i in `shcat /etc/dhcp\.$1`; do 250*7c478bd9Sstevel@tonic-gate if [ "$i" = primary ]; then 251*7c478bd9Sstevel@tonic-gate primary=$1 252*7c478bd9Sstevel@tonic-gate break 253*7c478bd9Sstevel@tonic-gate fi 254*7c478bd9Sstevel@tonic-gate done 255*7c478bd9Sstevel@tonic-gate 256*7c478bd9Sstevel@tonic-gate [ -n "$primary" ] && break 257*7c478bd9Sstevel@tonic-gate shift 258*7c478bd9Sstevel@tonic-gate done 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate [ -z "$primary" ] && primary="$firstif" 261*7c478bd9Sstevel@tonic-gate cmdline=`shcat /etc/dhcp\.${primary}` 262*7c478bd9Sstevel@tonic-gate 263*7c478bd9Sstevel@tonic-gate if [ "$_INIT_NET_IF" != "$primary" ]; then 264*7c478bd9Sstevel@tonic-gate echo "starting DHCP on primary interface $primary" 265*7c478bd9Sstevel@tonic-gate /sbin/ifconfig $primary auto-dhcp primary $cmdline 266*7c478bd9Sstevel@tonic-gate # Exit code 4 means ifconfig timed out waiting for dhcpagent 267*7c478bd9Sstevel@tonic-gate [ $? != 0 ] && [ $? != 4 ] && i4d_fail="$i4d_fail $primary" 268*7c478bd9Sstevel@tonic-gate fi 269*7c478bd9Sstevel@tonic-gate 270*7c478bd9Sstevel@tonic-gate set -- $interface_names 271*7c478bd9Sstevel@tonic-gate 272*7c478bd9Sstevel@tonic-gate while [ $# -ge 2 ]; do 273*7c478bd9Sstevel@tonic-gate shift 274*7c478bd9Sstevel@tonic-gate cmdline=`shcat /etc/dhcp\.$1` 275*7c478bd9Sstevel@tonic-gate if [ "$1" != "$primary" -a \ 276*7c478bd9Sstevel@tonic-gate "$1" != "$_INIT_NET_IF" ]; then 277*7c478bd9Sstevel@tonic-gate echo "starting DHCP on interface $1" 278*7c478bd9Sstevel@tonic-gate /sbin/ifconfig $1 dhcp start wait 0 $cmdline 279*7c478bd9Sstevel@tonic-gate # Exit code can't be timeout when wait is 0 280*7c478bd9Sstevel@tonic-gate [ $? != 0 ] && i4d_fail="$i4d_fail $1" 281*7c478bd9Sstevel@tonic-gate fi 282*7c478bd9Sstevel@tonic-gate shift 283*7c478bd9Sstevel@tonic-gate done 284*7c478bd9Sstevel@tonic-gate IFS="$ORIGIFS" 285*7c478bd9Sstevel@tonic-gate unset ORIGIFS 286*7c478bd9Sstevel@tonic-gate [ -n "$i4d_fail" ] && warn_failed_ifs "configure IPv4 DHCP" $i4d_fail 287*7c478bd9Sstevel@tonic-gatefi 288*7c478bd9Sstevel@tonic-gate 289*7c478bd9Sstevel@tonic-gate# Configure the rest of the IPv4 interfaces automatically, quietly. 290*7c478bd9Sstevel@tonic-gate/sbin/ifconfig -adD4 auto-revarp netmask + broadcast + up 291*7c478bd9Sstevel@tonic-gate 292*7c478bd9Sstevel@tonic-gate# 293*7c478bd9Sstevel@tonic-gate# Process IPv4 and IPv6 interfaces that failed to plumb. Find an 294*7c478bd9Sstevel@tonic-gate# alternative interface to host the addresses. 295*7c478bd9Sstevel@tonic-gate# 296*7c478bd9Sstevel@tonic-gate[ -n "$inet_failed" ] && move_addresses inet 297*7c478bd9Sstevel@tonic-gate 298*7c478bd9Sstevel@tonic-gate[ -n "$inet6_failed" ] && move_addresses inet6 299*7c478bd9Sstevel@tonic-gate 300*7c478bd9Sstevel@tonic-gate# 301*7c478bd9Sstevel@tonic-gate# If the /etc/defaultrouter file exists, process it now so that the next 302*7c478bd9Sstevel@tonic-gate# stage of booting will have access to NFS. 303*7c478bd9Sstevel@tonic-gate# 304*7c478bd9Sstevel@tonic-gateif [ -f /etc/defaultrouter ]; then 305*7c478bd9Sstevel@tonic-gate while read router rubbish; do 306*7c478bd9Sstevel@tonic-gate case "$router" in 307*7c478bd9Sstevel@tonic-gate '#'* | '') ;; # Ignore comments, empty lines 308*7c478bd9Sstevel@tonic-gate *) /sbin/route -n add default -gateway $router ;; 309*7c478bd9Sstevel@tonic-gate esac 310*7c478bd9Sstevel@tonic-gate done </etc/defaultrouter 311*7c478bd9Sstevel@tonic-gatefi 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate# 314*7c478bd9Sstevel@tonic-gate# We tell smf this service is online if any of the following is true: 315*7c478bd9Sstevel@tonic-gate# - no interfaces were configured for plumbing and no DHCP failures 316*7c478bd9Sstevel@tonic-gate# - any non-loopback IPv4 interfaces are up and have a non-zero address 317*7c478bd9Sstevel@tonic-gate# - there are any DHCP interfaces started 318*7c478bd9Sstevel@tonic-gate# - any non-loopback IPv6 interfaces are up 319*7c478bd9Sstevel@tonic-gate# 320*7c478bd9Sstevel@tonic-gate# If we weren't asked to configure any interfaces, exit 321*7c478bd9Sstevel@tonic-gateif [ -z "$inet_list" ] && [ -z "$inet6_list" ]; then 322*7c478bd9Sstevel@tonic-gate # Config error if DHCP was attempted without plumbed interfaces 323*7c478bd9Sstevel@tonic-gate [ -n "$i4d_fail" ] && exit $SMF_EXIT_ERR_CONFIG 324*7c478bd9Sstevel@tonic-gate exit $SMF_EXIT_OK 325*7c478bd9Sstevel@tonic-gatefi 326*7c478bd9Sstevel@tonic-gate 327*7c478bd9Sstevel@tonic-gate# Any non-loopback IPv4 interfaces with usable addresses up? 328*7c478bd9Sstevel@tonic-gateif [ -n "`/sbin/ifconfig -a4u`" ]; then 329*7c478bd9Sstevel@tonic-gate /sbin/ifconfig -a4u | while read intf addr rest; do 330*7c478bd9Sstevel@tonic-gate [ $intf = inet ] && [ $addr != 127.0.0.1 ] && 331*7c478bd9Sstevel@tonic-gate [ $addr != 0.0.0.0 ] && exit 0 332*7c478bd9Sstevel@tonic-gate done && exit $SMF_EXIT_OK 333*7c478bd9Sstevel@tonic-gatefi 334*7c478bd9Sstevel@tonic-gate 335*7c478bd9Sstevel@tonic-gate# Any DHCP interfaces started? 336*7c478bd9Sstevel@tonic-gate[ -n "`/sbin/ifconfig -a4 dhcp status 2>/dev/null`" ] && exit $SMF_EXIT_OK 337*7c478bd9Sstevel@tonic-gate 338*7c478bd9Sstevel@tonic-gate# Any non-loopback IPv6 interfaces up? 339*7c478bd9Sstevel@tonic-gateif [ -n "`/sbin/ifconfig -au6`" ]; then 340*7c478bd9Sstevel@tonic-gate /sbin/ifconfig -au6 | while read intf addr rest; do 341*7c478bd9Sstevel@tonic-gate [ $intf = inet6 ] && [ $addr != ::1/128 ] && exit 0 342*7c478bd9Sstevel@tonic-gate done && exit $SMF_EXIT_OK 343*7c478bd9Sstevel@tonic-gatefi 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate# This service was supposed to configure something yet didn't. Exit 346*7c478bd9Sstevel@tonic-gate# with config error. 347*7c478bd9Sstevel@tonic-gateexit $SMF_EXIT_ERR_CONFIG 348