xref: /illumos-gate/usr/src/cmd/cmd-inet/usr.lib/in.ripngd/svc-ripng (revision a192e900f6d2b0e1a822e3252c0dfd795ed49d76)
1*a192e900Samaguire#!/sbin/sh
2*a192e900Samaguire#
3*a192e900Samaguire# CDDL HEADER START
4*a192e900Samaguire#
5*a192e900Samaguire# The contents of this file are subject to the terms of the
6*a192e900Samaguire# Common Development and Distribution License (the "License").
7*a192e900Samaguire# You may not use this file except in compliance with the License.
8*a192e900Samaguire#
9*a192e900Samaguire# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*a192e900Samaguire# or http://www.opensolaris.org/os/licensing.
11*a192e900Samaguire# See the License for the specific language governing permissions
12*a192e900Samaguire# and limitations under the License.
13*a192e900Samaguire#
14*a192e900Samaguire# When distributing Covered Code, include this CDDL HEADER in each
15*a192e900Samaguire# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*a192e900Samaguire# If applicable, add the following below this CDDL HEADER, with the
17*a192e900Samaguire# fields enclosed by brackets "[]" replaced with your own identifying
18*a192e900Samaguire# information: Portions Copyright [yyyy] [name of copyright owner]
19*a192e900Samaguire#
20*a192e900Samaguire# CDDL HEADER END
21*a192e900Samaguire#
22*a192e900Samaguire#
23*a192e900Samaguire# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*a192e900Samaguire# Use is subject to license terms.
25*a192e900Samaguire#
26*a192e900Samaguire# ident	"%Z%%M%	%I%	%E% SMI"
27*a192e900Samaguire
28*a192e900Samaguire. /lib/svc/share/smf_include.sh
29*a192e900Samaguire. /lib/svc/share/routing_include.sh
30*a192e900Samaguire
31*a192e900Samaguiresmf_is_globalzone || exit $SMF_EXIT_OK
32*a192e900Samaguire
33*a192e900Samaguiredaemon_args=`get_daemon_args $SMF_FMRI`
34*a192e900Samaguireoptions="sqp:Ptv"
35*a192e900Samaguire
36*a192e900Samaguire#
37*a192e900Samaguire# Handle upgrade - routing/daemon-args property must be mapped to properties
38*a192e900Samaguire# in routeadm property group.  Note the SMF-incompatible -t option is not
39*a192e900Samaguire# supported, since it requires that in.ripngd run in the foreground.
40*a192e900Samaguire#
41*a192e900Samaguireif [ -n "$daemon_args" ]; then
42*a192e900Samaguire	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
43*a192e900Samaguire	    "$options" "q" supply_routes false true
44*a192e900Samaguire	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
45*a192e900Samaguire	    "$options" "s" supply_routes true
46*a192e900Samaguire	set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
47*a192e900Samaguire	    "$options" "p" udp_port 521
48*a192e900Samaguire	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
49*a192e900Samaguire	    "$options" "P" poison_reverse false true
50*a192e900Samaguire	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
51*a192e900Samaguire	    "$options" "v" verbose true false
52*a192e900Samaguire	set_daemon_nonoption_properties "$SMF_FMRI" "$daemon_args" \
53*a192e900Samaguire	    "$options" "log_file"
54*a192e900Samaguire	clear_daemon_args $SMF_FMRI
55*a192e900Samaguirefi
56*a192e900Samaguire
57*a192e900Samaguire#
58*a192e900Samaguire# Assemble arguments to daemon from properties
59*a192e900Samaguire#
60*a192e900Samaguireargs="`get_daemon_option_from_boolean_property $SMF_FMRI \
61*a192e900Samaguire	supply_routes -q false`"
62*a192e900Samaguireargs="$args `get_daemon_option_from_boolean_property $SMF_FMRI \
63*a192e900Samaguire	supply_routes -s true`"
64*a192e900Samaguireargs="$args `get_daemon_option_from_property $SMF_FMRI udp_port p 521`"
65*a192e900Samaguireargs="$args `get_daemon_option_from_boolean_property $SMF_FMRI \
66*a192e900Samaguire	poison_reverse -P false`"
67*a192e900Samaguireargs="$args `get_daemon_option_from_boolean_property $SMF_FMRI \
68*a192e900Samaguire	verbose -v true`"
69*a192e900Samaguireargs="$args `get_daemon_nonoption_property $SMF_FMRI log_file`"
70*a192e900Samaguire
71*a192e900Samaguire#
72*a192e900Samaguire# If in.ndpd isn't already running, then we start it here because
73*a192e900Samaguire# in.ripngd depends on having routes based on the prefixes configured by
74*a192e900Samaguire# in.ndpd.
75*a192e900Samaguire#
76*a192e900Samaguire/usr/sbin/svcadm enable -st ndp
77*a192e900Samaguire[ "$?" = "$SMF_EXIT_OK" ] || exit $SMF_EXIT_ERR_FATAL
78*a192e900Samaguire
79*a192e900Samaguire/usr/lib/inet/in.ripngd $args
80*a192e900Samaguire
81*a192e900Samaguire[ "$?" = 0 ] || exit $SMF_EXIT_ERR_FATAL
82*a192e900Samaguire
83*a192e900Samaguireexit "$SMF_EXIT_OK"
84