xref: /illumos-gate/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt (revision bbf215553c7233fbab8a0afdf1fac74c44781867)
16e91bba0SGirish Moodalbail#!/sbin/sh
26e91bba0SGirish Moodalbail#
36e91bba0SGirish Moodalbail# CDDL HEADER START
46e91bba0SGirish Moodalbail#
56e91bba0SGirish Moodalbail# The contents of this file are subject to the terms of the
66e91bba0SGirish Moodalbail# Common Development and Distribution License (the "License").
76e91bba0SGirish Moodalbail# You may not use this file except in compliance with the License.
86e91bba0SGirish Moodalbail#
96e91bba0SGirish Moodalbail# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
106e91bba0SGirish Moodalbail# or http://www.opensolaris.org/os/licensing.
116e91bba0SGirish Moodalbail# See the License for the specific language governing permissions
126e91bba0SGirish Moodalbail# and limitations under the License.
136e91bba0SGirish Moodalbail#
146e91bba0SGirish Moodalbail# When distributing Covered Code, include this CDDL HEADER in each
156e91bba0SGirish Moodalbail# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
166e91bba0SGirish Moodalbail# If applicable, add the following below this CDDL HEADER, with the
176e91bba0SGirish Moodalbail# fields enclosed by brackets "[]" replaced with your own identifying
186e91bba0SGirish Moodalbail# information: Portions Copyright [yyyy] [name of copyright owner]
196e91bba0SGirish Moodalbail#
206e91bba0SGirish Moodalbail# CDDL HEADER END
216e91bba0SGirish Moodalbail#
226e91bba0SGirish Moodalbail#
236f773e29SBaban Kenkre# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24f18d8787SJerry Jelinek# Copyright (c) 2012, Joyent, Inc. All rights reserved.
256e91bba0SGirish Moodalbail#
266e91bba0SGirish Moodalbail# This daemon stores address object to logical interface number mappings
276e91bba0SGirish Moodalbail# (among other things) and reads/writes from/to ipmgmtd data store.
286e91bba0SGirish Moodalbail#
296e91bba0SGirish Moodalbail
306e91bba0SGirish Moodalbail. /lib/svc/share/smf_include.sh
316e91bba0SGirish Moodalbail
326e91bba0SGirish Moodalbailif [ -z "$SMF_FMRI" ]; then
33*bbf21555SRichard Lowe        echo "this script can only be invoked by smf(7)"
346e91bba0SGirish Moodalbail        exit $SMF_EXIT_ERR_NOSMF
356e91bba0SGirish Moodalbailfi
366e91bba0SGirish Moodalbail
376e91bba0SGirish Moodalbail#
386e91bba0SGirish Moodalbail# network/ip-interface-management:default service is always enabled by default.
396e91bba0SGirish Moodalbail# When the non-global shared-IP stack zone boots, it tries to bring up this
406e91bba0SGirish Moodalbail# service as well. If we don't start a background process and simply exit the
416e91bba0SGirish Moodalbail# service, the service will go into maintenance mode and so will all it's
42f18d8787SJerry Jelinek# dependents.  Ideally we would simply exit with SMF_EXIT_NODAEMON, but since
43f18d8787SJerry Jelinek# this method is also used in an S10C zone, where support for SMF_EXIT_NODAEMON
44f18d8787SJerry Jelinek# does not exist, we have to stick around.
456e91bba0SGirish Moodalbail#
466f773e29SBaban Kenkre# In S10C zone (where this script is also used) smf_isnonglobalzone
476f773e29SBaban Kenkre# function is unavailable in smf_include.sh
486f773e29SBaban Kenkre#
496f773e29SBaban Kenkreif [ `/sbin/zonename` != global ]; then
506e91bba0SGirish Moodalbail	if [ `/sbin/zonename -t` = shared ]; then
516e91bba0SGirish Moodalbail		(while true ; do sleep 3600 ; done) &
526e91bba0SGirish Moodalbail		exit $SMF_EXIT_OK
536e91bba0SGirish Moodalbail	fi
546e91bba0SGirish Moodalbailfi
556e91bba0SGirish Moodalbail
566e91bba0SGirish Moodalbail#
576e91bba0SGirish Moodalbail# We must be now in a global zone or non-global zone with exclusive-IP stack.
586e91bba0SGirish Moodalbail# Start the ipmgmtd daemon.
596e91bba0SGirish Moodalbail#
606e91bba0SGirish Moodalbailif /lib/inet/ipmgmtd ; then
616e91bba0SGirish Moodalbail	exit $SMF_EXIT_OK
626e91bba0SGirish Moodalbailelse
636e91bba0SGirish Moodalbail        exit $SMF_EXIT_ERR_FATAL
646e91bba0SGirish Moodalbailfi
65