13048Samaguire#!/sbin/sh 23048Samaguire# 33048Samaguire# CDDL HEADER START 43048Samaguire# 53048Samaguire# The contents of this file are subject to the terms of the 63048Samaguire# Common Development and Distribution License (the "License"). 73048Samaguire# You may not use this file except in compliance with the License. 83048Samaguire# 93048Samaguire# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 103048Samaguire# or http://www.opensolaris.org/os/licensing. 113048Samaguire# See the License for the specific language governing permissions 123048Samaguire# and limitations under the License. 133048Samaguire# 143048Samaguire# When distributing Covered Code, include this CDDL HEADER in each 153048Samaguire# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 163048Samaguire# If applicable, add the following below this CDDL HEADER, with the 173048Samaguire# fields enclosed by brackets "[]" replaced with your own identifying 183048Samaguire# information: Portions Copyright [yyyy] [name of copyright owner] 193048Samaguire# 203048Samaguire# CDDL HEADER END 213048Samaguire# 223048Samaguire# 23*8823STruong.Q.Nguyen@Sun.COM# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 243048Samaguire# Use is subject to license terms. 253048Samaguire# 263048Samaguire 273048Samaguire. /lib/svc/share/smf_include.sh 283048Samaguire. /lib/svc/share/routing_include.sh 29*8823STruong.Q.Nguyen@Sun.COM. /lib/svc/share/ipf_include.sh 303048Samaguire 313448Sdh155122smf_configure_ip || exit $SMF_EXIT_OK 323048Samaguire 33*8823STruong.Q.Nguyen@Sun.COMcreate_ipf_rules() 34*8823STruong.Q.Nguyen@Sun.COM{ 35*8823STruong.Q.Nguyen@Sun.COM FMRI=$1 36*8823STruong.Q.Nguyen@Sun.COM file=`fmri_to_file ${FMRI} $IPF_SUFFIX` 37*8823STruong.Q.Nguyen@Sun.COM 38*8823STruong.Q.Nguyen@Sun.COM # 39*8823STruong.Q.Nguyen@Sun.COM # route:default is enabled iff route discovery is required. Allow 40*8823STruong.Q.Nguyen@Sun.COM # incoming icmp from routers for successful discovery. 41*8823STruong.Q.Nguyen@Sun.COM echo "# $FMRI" >$file 42*8823STruong.Q.Nguyen@Sun.COM gen_IRDP_rules $file 43*8823STruong.Q.Nguyen@Sun.COM 44*8823STruong.Q.Nguyen@Sun.COM # 45*8823STruong.Q.Nguyen@Sun.COM # A potential router so apply policy to RIP, 520 udp 46*8823STruong.Q.Nguyen@Sun.COM # 47*8823STruong.Q.Nguyen@Sun.COM policy=`get_policy $FMRI` 48*8823STruong.Q.Nguyen@Sun.COM iana_name=`svcprop -p $FW_CONTEXT_PG/name ${FMRI} 2>/dev/null` 49*8823STruong.Q.Nguyen@Sun.COM 50*8823STruong.Q.Nguyen@Sun.COM tport=`$SERVINFO -p -t -s $iana_name 2>/dev/null` 51*8823STruong.Q.Nguyen@Sun.COM uport=`$SERVINFO -p -u -s $iana_name 2>/dev/null` 52*8823STruong.Q.Nguyen@Sun.COM 53*8823STruong.Q.Nguyen@Sun.COM if [ -n "$tport" ]; then 54*8823STruong.Q.Nguyen@Sun.COM generate_rules $FMRI $policy "tcp" "any" $tport $file 55*8823STruong.Q.Nguyen@Sun.COM fi 56*8823STruong.Q.Nguyen@Sun.COM 57*8823STruong.Q.Nguyen@Sun.COM if [ -n "$uport" ]; then 58*8823STruong.Q.Nguyen@Sun.COM generate_rules $FMRI $policy "udp" "any" $uport $file 59*8823STruong.Q.Nguyen@Sun.COM fi 60*8823STruong.Q.Nguyen@Sun.COM} 61*8823STruong.Q.Nguyen@Sun.COM 62*8823STruong.Q.Nguyen@Sun.COMif [ -n "$1" -a "$1" = "ipfilter" ]; then 63*8823STruong.Q.Nguyen@Sun.COM create_ipf_rules $2 64*8823STruong.Q.Nguyen@Sun.COM exit "$SMF_EXIT_OK" 65*8823STruong.Q.Nguyen@Sun.COMfi 66*8823STruong.Q.Nguyen@Sun.COM 673048Samaguiredaemon_args=`get_daemon_args $SMF_FMRI` 683048Samaguireoptions="AdghmnqsStvVzT:F:P:" 693048Samaguire 703048Samaguire# 713048Samaguire# Handle upgrade - routing/daemon-args property must be mapped to properties 723048Samaguire# in routeadm property group. Note that the SMF-incompatible -t option is not 733048Samaguire# supported, since it requires that in.routed run in the foreground. 743048Samaguire# 753048Samaguireif [ -n "$daemon_args" ]; then 763048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 773048Samaguire "$options" "A" ignore_auth false true 783048Samaguire set_daemon_ordered_multivalue_property "$SMF_FMRI" "$daemon_args" \ 793048Samaguire "$options" "F" minimize_routes 803048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 813048Samaguire "$options" "g" offer_default_route true false 823048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 833048Samaguire "$options" "h" advertise_host_routes false true 843048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 853048Samaguire "$options" "m" advertise_host_routes_primary true false 863048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 873048Samaguire "$options" "n" install_routes false true 883048Samaguire set_daemon_ordered_multivalue_property "$SMF_FMRI" "$daemon_args" \ 893048Samaguire "$options" "P" parameters 903048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 913541Samaguire "$options" "q" quiet_mode true false 923048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 933541Samaguire "$options" "s" supply_routes true false 943048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 953048Samaguire "$options" "S" default_routes_only true false 963048Samaguire set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ 973048Samaguire "$options" "T" log_file 983048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 993048Samaguire "$options" "v" debug true false 1003048Samaguire set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ 1013048Samaguire "$options" "z" debug true 1023048Samaguire clear_daemon_args $SMF_FMRI 1033048Samaguirefi 1043048Samaguire 1053048Samaguire# 1063048Samaguire# Assemble arguments to daemon from properties 1073048Samaguire# 1083048Samaguireargs="`get_daemon_option_from_boolean_property $SMF_FMRI ignore_auth \ 1093048Samaguire A false`" 1103048Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1113048Samaguire offer_default_route g true`" 1123048Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1133048Samaguire advertise_host_routes h false`" 1143048Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1153048Samaguire advertise_host_routes_primary m true`" 1163048Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1173048Samaguire install_routes n false`" 1183048Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1193541Samaguire quiet_mode q true`" 1203541Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1213048Samaguire supply_routes s true`" 1223048Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1233048Samaguire default_routes_only S true`" 1243048Samaguireargs="$args`get_daemon_option_from_boolean_property $SMF_FMRI \ 1253048Samaguire debug z true`" 1263048Samaguireif [ -n "$args" ]; then 1273048Samaguire args="-${args}" 1283048Samaguirefi 1293048Samaguireargs="$args `get_daemon_ordered_multivalue_option_from_property $SMF_FMRI \ 1303048Samaguire minimize_routes F`" 1313048Samaguireargs="$args `get_daemon_ordered_multivalue_option_from_property \ 1323048Samaguire $SMF_FMRI parameters P`" 1333048Samaguireargs="$args `get_daemon_option_from_property $SMF_FMRI \ 1343048Samaguire log_file T`" 1353048Samaguire 1363048Samaguire/usr/sbin/in.routed $args 1373048Samaguire 1383048Samaguire[ "$?" = 0 ] || exit $SMF_EXIT_ERR_FATAL 1393048Samaguire 1403048Samaguireexit "$SMF_EXIT_OK" 141