net-nwam revision afc7d54587eb70585fcc35b5f933cc1ed713d87a
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#!/sbin/sh
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# CDDL HEADER START
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# The contents of this file are subject to the terms of the
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# Common Development and Distribution License (the "License").
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# You may not use this file except in compliance with the License.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# or http://www.opensolaris.org/os/licensing.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# See the License for the specific language governing permissions
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# and limitations under the License.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# When distributing Covered Code, include this CDDL HEADER in each
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# If applicable, add the following below this CDDL HEADER, with the
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# fields enclosed by brackets "[]" replaced with your own identifying
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# information: Portions Copyright [yyyy] [name of copyright owner]
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# CDDL HEADER END
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# Use is subject to license terms.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#ident "%Z%%M% %I% %E% SMI"
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck. /lib/svc/share/smf_include.sh
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# In a shared-IP zone we need this service to be up, but all of the work
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# it tries to do is irrelevant (and will actually lead to the service
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# failing if we try to do it), so just bail out.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# In the global zone and exclusive-IP zones we proceed.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck#
d71dbb732372504daff1f1783bc0d8864ce9bd50jbecksmf_configure_ip || exit $SMF_EXIT_OK
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeckcase "$1" in
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck'refresh')
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck /usr/bin/pkill -HUP -z `smf_zonename` nwamd
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck ;;
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck'start')
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck if smf_is_globalzone; then
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck # Initialize security objects.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck /sbin/dladm init-secobj
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck fi
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck # start nwamd in foreground; it will daemonize itself
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck if /lib/inet/nwamd ; then
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck exit $SMF_EXIT_OK
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck else
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck exit $SMF_EXIT_ERR_FATAL
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck fi
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck ;;
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck'stop')
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck /usr/bin/pkill -z `smf_zonename` nwamd
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck ;;
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck
afc7d54587eb70585fcc35b5f933cc1ed713d87amh'-u')
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # After we run this part of the script upon the next reboot
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # network/physical:default will be enabled and
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # network/physical:nwam will be disabled.
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # There are various other parts of the system (nscd, nfs) that
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # depend on continuing to have a working network. For this
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # reason we don't change the network configuration immediately.
afc7d54587eb70585fcc35b5f933cc1ed713d87amh
afc7d54587eb70585fcc35b5f933cc1ed713d87amh SVCADM=/usr/sbin/svcadm
afc7d54587eb70585fcc35b5f933cc1ed713d87amh SVCCFG=/usr/sbin/svccfg
afc7d54587eb70585fcc35b5f933cc1ed713d87amh net_phys=svc:/network/physical:default
afc7d54587eb70585fcc35b5f933cc1ed713d87amh net_nwam=svc:/network/physical:nwam
afc7d54587eb70585fcc35b5f933cc1ed713d87amh
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # Disable network/physical temporarily and make sure that will
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # be enabled on reboot.
afc7d54587eb70585fcc35b5f933cc1ed713d87amh $SVCADM disable -st $net_phys
afc7d54587eb70585fcc35b5f933cc1ed713d87amh $SVCCFG -s $net_phys setprop general/enabled=true
afc7d54587eb70585fcc35b5f933cc1ed713d87amh
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # If nwam is online then make sure that it's temporarily enabled.
afc7d54587eb70585fcc35b5f933cc1ed713d87amh nwam_online=`/usr/bin/svcprop -t -p restarter/state $net_nwam`
afc7d54587eb70585fcc35b5f933cc1ed713d87amh if [ $? -eq 0 ]; then
afc7d54587eb70585fcc35b5f933cc1ed713d87amh set -- $nwam_online
afc7d54587eb70585fcc35b5f933cc1ed713d87amh [ $3 = "online" ] && $SVCADM enable -st $net_nwam
afc7d54587eb70585fcc35b5f933cc1ed713d87amh fi
afc7d54587eb70585fcc35b5f933cc1ed713d87amh
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # Set nwam so that it won't be enabled upon reboot.
afc7d54587eb70585fcc35b5f933cc1ed713d87amh $SVCCFG -s $net_nwam setprop general/enabled=false
afc7d54587eb70585fcc35b5f933cc1ed713d87amh exit 0
afc7d54587eb70585fcc35b5f933cc1ed713d87amh ;;
afc7d54587eb70585fcc35b5f933cc1ed713d87amh
afc7d54587eb70585fcc35b5f933cc1ed713d87amh'-c')
afc7d54587eb70585fcc35b5f933cc1ed713d87amh # Nothing to do for sysidtool
afc7d54587eb70585fcc35b5f933cc1ed713d87amh exit 0
afc7d54587eb70585fcc35b5f933cc1ed713d87amh ;;
afc7d54587eb70585fcc35b5f933cc1ed713d87amh
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck*)
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck echo "Usage: $0 { start | stop | refresh }"
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck exit $SMF_EXIT_ERR_FATAL
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck ;;
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeckesac
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeckexit $SMF_EXIT_OK