xref: /titanic_41/usr/src/cmd/cmd-inet/lib/ipmgmtd/net-ipmgmt (revision c9a6ea2e938727c95af7108c5e00eee4c890c7ae)
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#
25# This daemon stores address object to logical interface number mappings
26# (among other things) and reads/writes from/to ipmgmtd data store.
27#
28
29. /lib/svc/share/smf_include.sh
30
31if [ -z "$SMF_FMRI" ]; then
32        echo "this script can only be invoked by smf(5)"
33        exit $SMF_EXIT_ERR_NOSMF
34fi
35
36#
37# network/ip-interface-management:default service is always enabled by default.
38# When the non-global shared-IP stack zone boots, it tries to bring up this
39# service as well. If we don't start a background process and simply exit the
40# service, the service will go into maintenance mode and so will all it's
41# dependents.
42#
43# In S10C zone (where this script is also used) smf_isnonglobalzone
44# function is unavailable in smf_include.sh
45#
46if [ `/sbin/zonename` != global ]; then
47	if [ `/sbin/zonename -t` = shared ]; then
48		(while true ; do sleep 3600 ; done) &
49		exit $SMF_EXIT_OK
50	fi
51fi
52
53# Apply any persistent protocol (IP/TCP/SCTP/UDP/ICMP) properties
54# ipadm doesn't exist and init-prop isn't required inside S10C
55if [ -f /sbin/ipadm ]; then
56	/sbin/ipadm init-prop
57fi
58
59#
60# We must be now in a global zone or non-global zone with exclusive-IP stack.
61# Start the ipmgmtd daemon.
62#
63if /lib/inet/ipmgmtd ; then
64	exit $SMF_EXIT_OK
65else
66        exit $SMF_EXIT_ERR_FATAL
67fi
68