1d71dbb73Sjbeck#!/sbin/sh 2d71dbb73Sjbeck# 3d71dbb73Sjbeck# CDDL HEADER START 4d71dbb73Sjbeck# 5d71dbb73Sjbeck# The contents of this file are subject to the terms of the 6d71dbb73Sjbeck# Common Development and Distribution License (the "License"). 7d71dbb73Sjbeck# You may not use this file except in compliance with the License. 8d71dbb73Sjbeck# 9d71dbb73Sjbeck# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10d71dbb73Sjbeck# or http://www.opensolaris.org/os/licensing. 11d71dbb73Sjbeck# See the License for the specific language governing permissions 12d71dbb73Sjbeck# and limitations under the License. 13d71dbb73Sjbeck# 14d71dbb73Sjbeck# When distributing Covered Code, include this CDDL HEADER in each 15d71dbb73Sjbeck# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16d71dbb73Sjbeck# If applicable, add the following below this CDDL HEADER, with the 17d71dbb73Sjbeck# fields enclosed by brackets "[]" replaced with your own identifying 18d71dbb73Sjbeck# information: Portions Copyright [yyyy] [name of copyright owner] 19d71dbb73Sjbeck# 20d71dbb73Sjbeck# CDDL HEADER END 21d71dbb73Sjbeck# 22d71dbb73Sjbeck# 23*d62bc4baSyz147064# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24d71dbb73Sjbeck# Use is subject to license terms. 25d71dbb73Sjbeck# 26d71dbb73Sjbeck 27d71dbb73Sjbeck#ident "%Z%%M% %I% %E% SMI" 28d71dbb73Sjbeck 29d71dbb73Sjbeck. /lib/svc/share/smf_include.sh 30*d62bc4baSyz147064. /lib/svc/share/net_include.sh 31d71dbb73Sjbeck 32d71dbb73Sjbeck# 33d71dbb73Sjbeck# In a shared-IP zone we need this service to be up, but all of the work 34d71dbb73Sjbeck# it tries to do is irrelevant (and will actually lead to the service 35d71dbb73Sjbeck# failing if we try to do it), so just bail out. 36d71dbb73Sjbeck# In the global zone and exclusive-IP zones we proceed. 37d71dbb73Sjbeck# 38d71dbb73Sjbecksmf_configure_ip || exit $SMF_EXIT_OK 39d71dbb73Sjbeck 40d71dbb73Sjbeckcase "$1" in 41d71dbb73Sjbeck'refresh') 42d71dbb73Sjbeck /usr/bin/pkill -HUP -z `smf_zonename` nwamd 43d71dbb73Sjbeck ;; 44d71dbb73Sjbeck 45d71dbb73Sjbeck'start') 46d71dbb73Sjbeck if smf_is_globalzone; then 47*d62bc4baSyz147064 net_reconfigure || exit $SMF_EXIT_ERR_CONFIG 48*d62bc4baSyz147064 49*d62bc4baSyz147064 # 50*d62bc4baSyz147064 # Upgrade handling. The upgrade file consists of a series 51*d62bc4baSyz147064 # of dladm(1M) commands. Note that after we are done, we 52*d62bc4baSyz147064 # cannot rename the upgrade script file as the file system 53*d62bc4baSyz147064 # is still read-only at this point. Defer this to the 54*d62bc4baSyz147064 # manifest-import service. 55*d62bc4baSyz147064 # 56*d62bc4baSyz147064 upgrade_script=/var/svc/profile/upgrade_datalink 57*d62bc4baSyz147064 if [ -f "${upgrade_script}" ]; then 58*d62bc4baSyz147064 . "${upgrade_script}" 59*d62bc4baSyz147064 fi 60*d62bc4baSyz147064 61d71dbb73Sjbeck # Initialize security objects. 62d71dbb73Sjbeck /sbin/dladm init-secobj 63d71dbb73Sjbeck fi 64d71dbb73Sjbeck # start nwamd in foreground; it will daemonize itself 65d71dbb73Sjbeck if /lib/inet/nwamd ; then 66d71dbb73Sjbeck exit $SMF_EXIT_OK 67d71dbb73Sjbeck else 68d71dbb73Sjbeck exit $SMF_EXIT_ERR_FATAL 69d71dbb73Sjbeck fi 70d71dbb73Sjbeck ;; 71d71dbb73Sjbeck 72d71dbb73Sjbeck'stop') 73d71dbb73Sjbeck /usr/bin/pkill -z `smf_zonename` nwamd 74d71dbb73Sjbeck ;; 75d71dbb73Sjbeck 76afc7d545Smh138676'-u') 77afc7d545Smh138676 # After we run this part of the script upon the next reboot 78afc7d545Smh138676 # network/physical:default will be enabled and 79afc7d545Smh138676 # network/physical:nwam will be disabled. 80afc7d545Smh138676 # There are various other parts of the system (nscd, nfs) that 81afc7d545Smh138676 # depend on continuing to have a working network. For this 82afc7d545Smh138676 # reason we don't change the network configuration immediately. 83afc7d545Smh138676 84afc7d545Smh138676 SVCADM=/usr/sbin/svcadm 85afc7d545Smh138676 SVCCFG=/usr/sbin/svccfg 86afc7d545Smh138676 net_phys=svc:/network/physical:default 87afc7d545Smh138676 net_nwam=svc:/network/physical:nwam 88afc7d545Smh138676 89afc7d545Smh138676 # Disable network/physical temporarily and make sure that will 90afc7d545Smh138676 # be enabled on reboot. 91afc7d545Smh138676 $SVCADM disable -st $net_phys 92afc7d545Smh138676 $SVCCFG -s $net_phys setprop general/enabled=true 93afc7d545Smh138676 94afc7d545Smh138676 # If nwam is online then make sure that it's temporarily enabled. 95afc7d545Smh138676 nwam_online=`/usr/bin/svcprop -t -p restarter/state $net_nwam` 96afc7d545Smh138676 if [ $? -eq 0 ]; then 97afc7d545Smh138676 set -- $nwam_online 98afc7d545Smh138676 [ $3 = "online" ] && $SVCADM enable -st $net_nwam 99afc7d545Smh138676 fi 100afc7d545Smh138676 101afc7d545Smh138676 # Set nwam so that it won't be enabled upon reboot. 102afc7d545Smh138676 $SVCCFG -s $net_nwam setprop general/enabled=false 103afc7d545Smh138676 exit 0 104afc7d545Smh138676 ;; 105afc7d545Smh138676 106afc7d545Smh138676'-c') 107afc7d545Smh138676 # Nothing to do for sysidtool 108afc7d545Smh138676 exit 0 109afc7d545Smh138676 ;; 110afc7d545Smh138676 111d71dbb73Sjbeck*) 112d71dbb73Sjbeck echo "Usage: $0 { start | stop | refresh }" 113d71dbb73Sjbeck exit $SMF_EXIT_ERR_FATAL 114d71dbb73Sjbeck ;; 115d71dbb73Sjbeckesac 116d71dbb73Sjbeckexit $SMF_EXIT_OK 117