net-physical revision f4b3ec61df05330d25f55a36b975b4d7519fdeb1
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# CDDL HEADER START
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# The contents of this file are subject to the terms of the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Common Development and Distribution License (the "License").
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# You may not use this file except in compliance with the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# See the License for the specific language governing permissions
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# and limitations under the License.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# When distributing Covered Code, include this CDDL HEADER in each
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# If applicable, add the following below this CDDL HEADER, with the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# fields enclosed by brackets "[]" replaced with your own identifying
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# information: Portions Copyright [yyyy] [name of copyright owner]
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# CDDL HEADER END
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Use is subject to license terms.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# All rights reserved.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# ident "%Z%%M% %I% %E% SMI"
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# In a shared-IP zone we need this service to be up, but all of the work
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# it tries to do is irrelevant (and will actually lead to the service
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# failing if we try to do it), so just bail out.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# In the global zone and exclusive-IP zones we proceed.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Print warnings to console
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster echo "Failed to $1 interface(s): $2" >/dev/msglog
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Make sure that the libraries essential to this stage of booting can be found.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Cause ifconfig to not automatically start in.mpathd when IPMP groups are
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# configured. This is not strictly necessary but makes it so that in.mpathd
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# will always be started explicitly from /etc/init.d/inetinit, when we're
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# sure that /usr is mounted.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # Bring up link aggregations and initialize security objects.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # Note that link property initialization is deferred until after
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # IP interfaces are plumbed to ensure that the links will not
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster # be unloaded (and the property settings lost).
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# If the system was net booted by DHCP, hand DHCP management off to the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# DHCP agent (ifconfig communicates to the DHCP agent through the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# loopback interface).
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Fosterif [ -n "$_INIT_NET_IF" -a "$_INIT_NET_STRATEGY" = "dhcp" ]; then
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# The network initialization is done early to support diskless and
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# dataless configurations. For IPv4 interfaces that were configured by
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# the kernel (e.g. those on diskless machines) and not configured by
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# DHCP, reset the netmask using the local "/etc/netmasks" file if one
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# exists, and then reset the broadcast address based on the netmask.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# All the IPv4 and IPv6 interfaces are plumbed before doing any
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# interface configuration. This prevents errors from plumb failures
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# getting mixed in with the configured interface lists that the script
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# Get the list of IPv4 interfaces to configure by breaking
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster# /etc/hostname.* into separate args by using "." as a shell separator
set -- $interface_names
set -- $interface_names
if [ -n "$inet_list" ]; then
set -- $inet_list
set -- $inet_plumbed
if [ -n "$inet6_list" ]; then
set -- $inet6_list
if smf_is_globalzone; then
# If /etc/hostname.lo0 exists the loop below will do additional
if [ -n "$inet_plumbed" ]; then
set -- $inet_plumbed
# /etc/hostname6.lo0 exists the loop below will do additional
if [ -n "$inet6_plumbed" ]; then
set -- $inet6_plumbed
set -- $interface_names
[ -n "$primary" ] && break
echo "starting DHCP on primary interface $primary"
set -- $interface_names
unset ORIGIFS
# If the /etc/defaultrouter file exists, process it now so that the next
exit $SMF_EXIT_OK
done && exit $SMF_EXIT_OK
done && exit $SMF_EXIT_OK
exit $SMF_EXIT_ERR_CONFIG