xref: /titanic_41/usr/src/cmd/cmd-inet/usr.sbin/in.routed/svc-route (revision 7c2fbfb345896881c631598ee3852ce9ce33fb07)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27
28. /lib/svc/share/smf_include.sh
29. /lib/svc/share/routing_include.sh
30
31smf_configure_ip || exit $SMF_EXIT_OK
32
33daemon_args=`get_daemon_args $SMF_FMRI`
34options="AdghmnqsStvVzT:F:P:"
35
36#
37# Handle upgrade - routing/daemon-args property must be mapped to properties
38# in routeadm property group.  Note that the SMF-incompatible -t option is not
39# supported, since it requires that in.routed run in the foreground.
40#
41if [ -n "$daemon_args" ]; then
42	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
43	    "$options" "A" ignore_auth false true
44	set_daemon_ordered_multivalue_property "$SMF_FMRI" "$daemon_args" \
45	    "$options" "F" minimize_routes
46	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
47	    "$options" "g" offer_default_route true false
48	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
49	    "$options" "h" advertise_host_routes false true
50	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
51	    "$options" "m" advertise_host_routes_primary true false
52	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
53	    "$options" "n" install_routes false true
54	set_daemon_ordered_multivalue_property "$SMF_FMRI" "$daemon_args" \
55	    "$options" "P" parameters
56	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
57	    "$options" "q" quiet_mode true false
58	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
59	    "$options" "s" supply_routes true false
60	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
61	    "$options" "S" default_routes_only true false
62	set_daemon_value_property "$SMF_FMRI" "$daemon_args" \
63	    "$options" "T" log_file
64	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
65	    "$options" "v" debug true false
66	set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \
67	    "$options" "z" debug true
68	clear_daemon_args $SMF_FMRI
69fi
70
71#
72# Assemble arguments to daemon from properties
73#
74args="`get_daemon_option_from_boolean_property $SMF_FMRI ignore_auth \
75	A false`"
76args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
77	offer_default_route g true`"
78args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
79	advertise_host_routes h false`"
80args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
81	advertise_host_routes_primary m true`"
82args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
83	install_routes n false`"
84args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
85	quiet_mode q true`"
86args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
87		supply_routes s true`"
88args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
89	default_routes_only S true`"
90args="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
91	debug z true`"
92if [ -n "$args" ]; then
93	args="-${args}"
94fi
95args="$args `get_daemon_ordered_multivalue_option_from_property $SMF_FMRI \
96	minimize_routes F`"
97args="$args `get_daemon_ordered_multivalue_option_from_property \
98	$SMF_FMRI parameters P`"
99args="$args `get_daemon_option_from_property $SMF_FMRI \
100	log_file T`"
101
102/usr/sbin/in.routed $args
103
104[ "$?" = 0 ] || exit $SMF_EXIT_ERR_FATAL
105
106exit "$SMF_EXIT_OK"
107