net-physical revision da14cebe459d3275048785f25bd869cb09b5307f
173N/A# The contents of this file are subject to the terms of the 173N/A# Common Development and Distribution License (the "License"). 173N/A# You may not use this file except in compliance with the License. 173N/A# See the License for the specific language governing permissions 173N/A# and limitations under the License. 173N/A# When distributing Covered Code, include this CDDL HEADER in each 173N/A# If applicable, add the following below this CDDL HEADER, with the 173N/A# fields enclosed by brackets "[]" replaced with your own identifying 173N/A# information: Portions Copyright [yyyy] [name of copyright owner] 173N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 173N/A# Use is subject to license terms. 173N/A# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T. 173N/A# In a shared-IP zone we need this service to be up, but all of the work 173N/A# it tries to do is irrelevant (and will actually lead to the service 173N/A# failing if we try to do it), so just bail out. 173N/A# In the global zone and exclusive-IP zones we proceed. 173N/A# Print warnings to console 173N/A# Make sure that the libraries essential to this stage of booting can be found. 173N/A# Cause ifconfig to not automatically start in.mpathd when IPMP groups are 173N/A# configured. This is not strictly necessary but makes it so that in.mpathd 173N/A# sure that /usr is mounted. # Upgrade handling. The upgrade file consists of a series of dladm(1M) # commands. Note that after we are done, we cannot rename the upgrade # script file as the file system is still read-only at this point. # Defer this to the manifest-import service. if [ -f
"${upgrade_script}" ];
then # Bring up link aggregations and initialize security objects. # Note that link property initialization is deferred until after # IP interfaces are plumbed to ensure that the links will not # be unloaded (and the property settings lost). # Create flows via flowadm. # If the system was net booted by DHCP, hand DHCP management off to the # DHCP agent (ifconfig communicates to the DHCP agent through the # The network initialization is done early to support diskless and # dataless configurations. For IPv4 interfaces that were configured by # the kernel (e.g. those on diskless machines) and not configured by # DHCP, reset the netmask using the local "/etc/netmasks" file if one # exists, and then reset the broadcast address based on the netmask. # All the IPv4 and IPv6 interfaces are plumbed before doing any # interface configuration. This prevents errors from plumb failures # getting mixed in with the configured interface lists that the script # Get the list of IPv4 interfaces to configure by breaking # /etc/hostname.* into separate args by using "." as a shell separator # Get the list of IPv6 interfaces to configure by breaking # /etc/hostname6.* into separate args by using "." as a shell separator # Step through the IPv4 interface list and try to plumb every interface. # Generate list of plumbed and failed IPv4 interfaces. # Run autoconf to connect to a WLAN if the interface is a wireless one # Step through the IPv6 interface list and plumb every interface. # Generate list of plumbed and failed IPv6 interfaces. Each plumbed # interface will be brought up later, after processing any contents of # Wifi drivers use special property interfaces that are not supported # by the existing property persistence mechanism, so if a wifi driver # unloads and then is subsequently reloaded, associated links' properties # will not be restored. For now, wait until after interfaces have been # plumbed (above) to initialize link properties. # Process the /etc/hostname.* files of plumbed IPv4 interfaces. If an # /etc/hostname file is not present or is empty, the ifconfig auto-dhcp # / auto-revarp command will attempt to set the address, later. echo "configuring IPv4 interfaces:\c" # Process the /etc/hostname6.* files of plumbed IPv6 interfaces. After # processing the hostname6 file, bring the interface up. If echo "configuring IPv6 interfaces:\c" # Run DHCP if requested. Skip boot-configured interface. # First find the primary interface. Default to the first # interface if not specified. First primary interface found # "wins". Use care not to "reconfigure" a net-booted interface # configured using DHCP. Run through the list of interfaces # again, this time trying DHCP. echo "starting DHCP on primary interface $primary" # Exit code 4 means ifconfig timed out waiting for dhcpagent echo "starting DHCP on interface $1" # Exit code can't be timeout when wait is 0 # In order to avoid bringing up the interfaces that have # intentionally been left down, perform RARP only if the system # Process IPv4 and IPv6 interfaces that failed to plumb. Find an # alternative interface to host the addresses. # stage of booting will have access to NFS. '#'* |
'') ;;
# Ignore comments, empty lines # If we get here and were not asked to plumb any IPv4 interfaces, look # for boot properties that direct us. # - The "network-interface" property is required and indicates the # - The "xpv-hcp" property, if present, is used by the hypervisor # tools to indicate how the specified interface should be configured. # Permitted values are "dhcp" and "off", where "off" indicates static # In the case where "xpv-hcp" is set to "dhcp", no further properties # are required or examined. # In the case where "xpv-hcp" is not present or set to "off", the # "host-ip" and "subnet-mask" properties are used to configure # the specified interface. The "router-ip" property, if present, # is used to add a default route. # The interface is successfully plumbed, so # modify "inet_list" to force the exit code # Given that this is the only IPv4 interface, # we assert that it is primary. echo "starting DHCP on primary interface $primary"; # Exit code 4 means ifconfig timed out waiting [ $? != 0 ] && [ $? != 4 ] && \ # The interface is successfully # plumbed, so modify "inet_list" to # force the exit code checks to work. # We tell smf this service is online if any of the following is true: # - no interfaces were configured for plumbing and no DHCP failures # - any non-loopback IPv4 interfaces are up and have a non-zero address # - there are any DHCP interfaces started # - any non-loopback IPv6 interfaces are up # If we weren't asked to configure any interfaces, exit # Config error if DHCP was attempted without plumbed interfaces # Any non-loopback IPv4 interfaces with usable addresses up? # Any DHCP interfaces started? # Any non-loopback IPv6 interfaces up? # This service was supposed to configure something yet didn't. Exit