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.
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.
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]
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
26 # Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
29 .
/lib
/svc
/share
/smf_include.sh
30 .
/lib
/svc
/share
/routing_include.sh
31 .
/lib
/svc
/share
/ipf_include.sh
33 smf_configure_ip ||
exit $SMF_EXIT_OK
38 file=`fmri_to_file ${FMRI} $IPF_SUFFIX`
41 # route:default is enabled iff route discovery is required. Allow
42 # incoming icmp from routers for successful discovery.
47 # A potential router so apply policy to RIP, 520 udp
49 policy
=`get_policy $FMRI`
50 iana_name
=`svcprop -p $FW_CONTEXT_PG/name ${FMRI} 2>/dev/null`
52 tport
=`$SERVINFO -p -t -s $iana_name 2>/dev/null`
53 uport
=`$SERVINFO -p -u -s $iana_name 2>/dev/null`
55 if [ -n "$tport" ]; then
56 generate_rules
$FMRI $policy "tcp" $tport $file
59 if [ -n "$uport" ]; then
60 generate_rules
$FMRI $policy "udp" $uport $file
64 if [ -n "$1" -a "$1" = "ipfilter" ]; then
69 daemon_args
=`get_daemon_args $SMF_FMRI`
70 options
="AdghmnqsStvVzT:F:P:"
73 # Handle upgrade - routing/daemon-args property must be mapped to properties
74 # in routeadm property group. Note that the SMF-incompatible -t option is not
75 # supported, since it requires that in.routed run in the foreground.
77 if [ -n "$daemon_args" ]; then
78 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
79 "$options" "A" ignore_auth false true
80 set_daemon_ordered_multivalue_property
"$SMF_FMRI" "$daemon_args" \
81 "$options" "F" minimize_routes
82 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
83 "$options" "g" offer_default_route true false
84 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
85 "$options" "h" advertise_host_routes false true
86 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
87 "$options" "m" advertise_host_routes_primary true false
88 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
89 "$options" "n" install_routes false true
90 set_daemon_ordered_multivalue_property
"$SMF_FMRI" "$daemon_args" \
91 "$options" "P" parameters
92 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
93 "$options" "q" quiet_mode true false
94 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
95 "$options" "s" supply_routes true false
96 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
97 "$options" "S" default_routes_only true false
98 set_daemon_value_property
"$SMF_FMRI" "$daemon_args" \
99 "$options" "T" log_file
100 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
101 "$options" "v" debug true false
102 set_daemon_boolean_property
"$SMF_FMRI" "$daemon_args" \
103 "$options" "z" debug true
104 clear_daemon_args
$SMF_FMRI
108 # Assemble arguments to daemon from properties
110 args
="`get_daemon_option_from_boolean_property $SMF_FMRI ignore_auth \
112 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
113 offer_default_route g true`"
114 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
115 advertise_host_routes h false`"
116 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
117 advertise_host_routes_primary m true`"
118 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
119 install_routes n false`"
120 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
122 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
123 supply_routes s true`"
124 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
125 default_routes_only S true`"
126 args
="$args`get_daemon_option_from_boolean_property $SMF_FMRI \
128 if [ -n "$args" ]; then
131 args
="$args `get_daemon_ordered_multivalue_option_from_property $SMF_FMRI \
133 args
="$args `get_daemon_ordered_multivalue_option_from_property \
134 $SMF_FMRI parameters P`"
135 args
="$args `get_daemon_option_from_property $SMF_FMRI \
138 /usr
/sbin
/in.routed
$args
140 [ "$?" = 0 ] ||
exit $SMF_EXIT_ERR_FATAL