9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# CDDL HEADER START
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# The contents of this file are subject to the terms of the
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# Common Development and Distribution License (the "License").
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# You may not use this file except in compliance with the License.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# See the License for the specific language governing permissions
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# and limitations under the License.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# When distributing Covered Code, include this CDDL HEADER in each
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# If applicable, add the following below this CDDL HEADER, with the
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# fields enclosed by brackets "[]" replaced with your own identifying
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# information: Portions Copyright [yyyy] [name of copyright owner]
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# CDDL HEADER END
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywoodunset net_install_name net_install_addrtype net_install_addr \
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood net_install_dhcpwait net_install_interface_id \
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood net_install_stateless net_install_stateful net_install_route
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood cmd=$cmd"-a local=$net_install_addr $net_install_name"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood cmd="$IPADM create-addr -T dhcp $dhcpwait $net_install_name"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood cmd=$cmd"$interface_id $state $net_install_name"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood net_record_err "Error configuring interface:\n\"$cmd\"" $?
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $ipv6_interface == 1 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood ifp=`echo $net_install_name | /usr/bin/cut -f1 -d'/'`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood details="$details $net_install_route -ifp $ifp"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Error creating \"$rootdir/etc/inet\" directory"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Error adding persistent default route:\n\"$cmd\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the mandatory interface name property value. If
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # the value is empty, then no interface is configured.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V4IF/name $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 -o "$prop" = "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the mandatory address type property value. The two
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V4IF/address_type $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 -o "$prop" = "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="No \"address_type\" property defined in the "
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Bad value, \"$prop\", defined for the \"address_type\" "
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg=$msg"property in the \"$NET_V4IF\" property group"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the static address property value. The address property
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # only applies to static address type configurations. If not
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # configuring a static address, then the property should still have
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V4IF/static_address $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$net_install_addrtype" = "static" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the optional DHCP wait property value.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V4IF/dhcp_wait $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the optional default route property value.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V4IF/default_route $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the mandatory interface name property value. If
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # the value is empty, then no interface is configured.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V6IF/name $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 -o "$prop" = "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the mandatory address type property value. The two
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V6IF/address_type $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne 0 -o "$prop" = "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="No \"address_type\" property defined in the "
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Bad value \"$prop\" defined for \"address_type\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the static address property value. The address property
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # only applies to static address type configurations. If not
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # configuring a static address, then the property should still have
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V6IF/static_address $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$net_install_addrtype" = "addrconf" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$prop" != "${NET_IN6ADDR_ANY_INIT}/0" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$prop" = "${NET_IN6ADDR_ANY_INIT}/0" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$net_install_addrtype" = "static" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the optional interface id property value. The
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # property only applies to addrconf address type configurations.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # If configuring a static address, then the property should still
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V6IF/interface_id $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$prop" != "${NET_IN6ADDR_ANY_INIT}/0" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$net_install_addrtype" != "addrconf" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the optional stateless property value. The property
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # only applies to addrconf address type configurations. If
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # configuring a static address, then the property should still
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V6IF/stateless $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$net_install_addrtype" != "addrconf" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Bad value \"$prop\" defined for the \"stateless\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg=$msg" property in the \"$NET_V6IF\" property group"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the optional stateful property value. The property
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # only applies to addrconf address type configurations. If
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # configuring a static address, then the property should still
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V6IF/stateful $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$net_install_addrtype" != "addrconf" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Bad value \"$prop\" defined for the \"stateless\""
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg=$msg" property in the \"$NET_V6IF\" property group"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood # Retrieve the optional default route property value.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood prop=`$SVCPROP -p $NET_V6IF/default_route $NET_INSTALL_FMRI`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 -a "$prop" != "$NET_UNDEFINED_STRING_PROP" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ "$prop" != "$NET_IN6ADDR_ANY_INIT" ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood vout=`$SVCCFG -s $NET_INSTALL_FMRI validate 2>&1`
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood msg="Validation errors in $NET_INSTALL_FMRI:\n$vout"
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -eq 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $? -ne $SMF_EXIT_OK ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $net_install_debug -eq 1 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $errs -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood if [ $ifcnt -ne 0 ]; then
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# The network/install service will be enabled by the install derived profile
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# after the intial install. The service will disable itself after processing
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# the install defined property values.
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# When the non-global shared-IP stack zone boots, it tries to bring up this
9b5bf10ab04b9be5564d70a57980cfb68b6372e7Mark Haywood# service as well. We just want to exit successfully.