xref: /titanic_51/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt (revision cfb7311ca709ca6f4d930977c7498455556b5312)
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 2010 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
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.
43#
44if smf_is_nonglobalzone; then
45	if [ `/sbin/zonename -t` = shared ]; then
46		(while true ; do sleep 3600 ; done) &
47		exit $SMF_EXIT_OK
48	fi
49fi
50
51# Apply any persistent protocol (IP/TCP/SCTP/UDP/ICMP) properties
52/sbin/ipadm init-prop
53
54#
55# We must be now in a global zone or non-global zone with exclusive-IP stack.
56# Start the ipmgmtd daemon.
57#
58if /lib/inet/ipmgmtd ; then
59	exit $SMF_EXIT_OK
60else
61        exit $SMF_EXIT_ERR_FATAL
62fi
63