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