xref: /illumos-gate/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt (revision 0aaef2f550fa500248f59b0b8a14225b5afbd198)
1#!/sbin/sh
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24# Copyright (c) 2012, Joyent, Inc. All rights reserved.
25#
26# This daemon stores address object to logical interface number mappings
27# (among other things) and reads/writes from/to ipmgmtd data store.
28#
29
30. /lib/svc/share/smf_include.sh
31
32if [ -z "$SMF_FMRI" ]; then
33        echo "this script can only be invoked by smf(5)"
34        exit $SMF_EXIT_ERR_NOSMF
35fi
36
37#
38# network/ip-interface-management:default service is always enabled by default.
39# When the non-global shared-IP stack zone boots, it tries to bring up this
40# service as well. If we don't start a background process and simply exit the
41# service, the service will go into maintenance mode and so will all it's
42# dependents.  Ideally we would simply exit with SMF_EXIT_NODAEMON, but since
43# this method is also used in an S10C zone, where support for SMF_EXIT_NODAEMON
44# does not exist, we have to stick around.
45#
46# In S10C zone (where this script is also used) smf_isnonglobalzone
47# function is unavailable in smf_include.sh
48#
49if [ `/sbin/zonename` != global ]; then
50	if [ `/sbin/zonename -t` = shared ]; then
51		(while true ; do sleep 3600 ; done) &
52		exit $SMF_EXIT_OK
53	fi
54fi
55
56#
57# We must be now in a global zone or non-global zone with exclusive-IP stack.
58# Start the ipmgmtd daemon.
59#
60if /lib/inet/ipmgmtd ; then
61	exit $SMF_EXIT_OK
62else
63        exit $SMF_EXIT_ERR_FATAL
64fi
65