net-physical revision 550b6e4083768ca350e9e7c3a1ebbf720b23dcad
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# CDDL HEADER START
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# The contents of this file are subject to the terms of the
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# Common Development and Distribution License (the "License").
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# You may not use this file except in compliance with the License.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# See the License for the specific language governing permissions
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# and limitations under the License.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# When distributing Covered Code, include this CDDL HEADER in each
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# If applicable, add the following below this CDDL HEADER, with the
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
e17cb80d7cebc23a4de75376155f2231dea193e6Mark Andrews# CDDL HEADER END
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# All rights reserved.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# In a shared-IP zone we need this service to be up, but all of the work
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# it tries to do is irrelevant (and will actually lead to the service
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# failing if we try to do it), so just bail out.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# In the global zone and exclusive-IP zones we proceed.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# Make sure that the libraries essential to this stage of booting can be found.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Update PVID on interfaces configured with VLAN 1
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Upgrade handling. The upgrade file consists of a series of dladm(1M)
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # commands. Note that after we are done, we cannot rename the upgrade
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # script file as the file system is still read-only at this point.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Defer this to the manifest-import service.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews upgrade_script=/var/svc/profile/upgrade_datalink
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews if [ -f "${upgrade_script}" ]; then
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews . "${upgrade_script}"
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Upgrade handling for ibd:
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # After we are done with the upgrade handling, we can not set the
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # ibd/ibd_upgraded property to "true" as the file system is
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # read-only at this point. It will be done later by ibd-post-upgrade
e17cb80d7cebc23a4de75376155f2231dea193e6Mark Andrews ibd_upgraded=`/bin/svcprop -c -p ibd/ibd_upgraded \
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Bring up simnets, link aggregations and initialize security objects.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Note that link property initialization is deferred until after
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # IP interfaces are plumbed to ensure that the links will not
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # be unloaded (and the property settings lost). We should bring
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # up simnets prior to VLANs/Aggrs to enable creation of VLANs/Aggrs
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # over simnets.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Bring up VNICs
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Create flows via flowadm.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# If the system was net booted by DHCP, hand DHCP management off to the
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# DHCP agent (ifconfig communicates to the DHCP agent through the
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# loopback interface).
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrewsif [ -n "$_INIT_NET_IF" -a "$_INIT_NET_STRATEGY" = "dhcp" ]; then
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# The network initialization is done early to support diskless and
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# dataless configurations. For IPv4 interfaces that were configured by
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# the kernel (e.g. those on diskless machines) and not configured by
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# DHCP, reset the netmask using the local "/etc/netmasks" file if one
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# exists, and then reset the broadcast address based on the netmask.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews /sbin/dladm show-iptun -P $intf > /dev/null 2>&1
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews if [ $? -eq 0 ]; then
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # Is this an implicit IP tunnel (i.e., ip.tun0)
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews if [ $# -eq 2 -a \( "$1" = "ip" -o "$1" = "ip6" \) ]; then
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # It looks like one, but another type of link might be
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # using a name that looks like an implicit IP tunnel.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # If dladm show-link -P finds it, then it's not an IP
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews /sbin/dladm show-link -Pp $intf > /dev/null 2>&1
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews if [ $? -eq 0 ]; then
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# All the IPv4 and IPv6 interfaces are plumbed before doing any
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# interface configuration. This prevents errors from plumb failures
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# getting mixed in with the configured interface lists that the script
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# First deal with /etc/hostname
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# Get the list of IPv4 interfaces to configure by breaking
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# /etc/hostname.* into separate args by using "." as a shell separator
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrewsinterface_names="`echo /etc/hostname.*[0-9] 2>/dev/null`"
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrewsif [ "$interface_names" != "/etc/hostname.*[0-9]" ]; then
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews while [ $# -gt 1 -a "$2" != "/etc/hostname" ]; do
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # skip IP tunnel interfaces plumbed by net-iptun.
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# Get the list of IPv6 interfaces to configure by breaking
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews# /etc/hostname6.* into separate args by using "." as a shell separator
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrewsinterface_names="`echo /etc/hostname6.*[0-9] 2>/dev/null`"
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrewsif [ "$interface_names" != "/etc/hostname6.*[0-9]" ]; then
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews while [ $# -gt 1 -a "$2" != "/etc/hostname6" ]; do
582f8b9a8d170a80ef67475bddb8ad5cf7cd7cadMark Andrews # skip IP tunnel interfaces plumbed by net-iptun.
if [ -n "$ipmp_list" ]; then
set -- $ipmp_list
if [ -n "$inet_list" ]; then
set -- $inet_list
set -- $inet_plumbed
if [ -n "$inet6_list" ]; then
set -- $inet6_list
if [ -n "$ipmp6_list" ]; then
set -- $ipmp6_list
if [[ $current != *Z* ]]; then
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
read ip;
read mask;
read router;
exit $SMF_EXIT_OK
done && exit $SMF_EXIT_OK
done && exit $SMF_EXIT_OK
exit $SMF_EXIT_ERR_CONFIG