140006Sphk#!/bin/sh
240006Sphk#
366830Sobrien# Copyright (c) 2000  The FreeBSD Project
466830Sobrien# All rights reserved.
540006Sphk#
666830Sobrien# Redistribution and use in source and binary forms, with or without
766830Sobrien# modification, are permitted provided that the following conditions
866830Sobrien# are met:
966830Sobrien# 1. Redistributions of source code must retain the above copyright
1066830Sobrien#    notice, this list of conditions and the following disclaimer.
1166830Sobrien# 2. Redistributions in binary form must reproduce the above copyright
1266830Sobrien#    notice, this list of conditions and the following disclaimer in the
1366830Sobrien#    documentation and/or other materials provided with the distribution.
1466830Sobrien#
1566830Sobrien# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1666830Sobrien# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1766830Sobrien# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1866830Sobrien# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1966830Sobrien# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2066830Sobrien# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2166830Sobrien# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2266830Sobrien# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2366830Sobrien# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2466830Sobrien# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2566830Sobrien# SUCH DAMAGE.
2666830Sobrien#
2750472Speter# $FreeBSD$
2866830Sobrien#
2940006Sphk
30100280Sgordon# Start ATM daemons
3140006Sphk
32100280Sgordon# PROVIDE: atm3
33100280Sgordon# REQUIRE: atm2
34100280Sgordon# BEFORE: DAEMON
35136224Smtm# KEYWORD: nojail
3640006Sphk
37100280Sgordon. /etc/rc.subr
3840006Sphk
39118123Shartiname="atm3"
40118123Shartircvar="atm_enable"
41118123Shartistart_cmd="atm3_start"
42118123Shartistop_cmd=":"
43118123Sharti
44100280Sgordonatm3_start()
45100280Sgordon{
46100280Sgordon	echo -n 'Starting ATM daemons:'
4740006Sphk
48118123Sharti	# Get a list of network interfaces
49118123Sharti	atm_nif=`atm sh netif | { read junk ; \
50118123Sharti	    while read dev junk ; do
51118123Sharti		echo "${dev} "
52121067Sdougb	    done
53118123Sharti	}`
54118123Sharti
55118123Sharti	for net in ${atm_nif} ; do
56118123Sharti		eval atmarp_args=\$atm_arpserver_${net}
57118123Sharti		eval scsparp_args=\$atm_scsparp_${net}
58118123Sharti
59118123Sharti		case ${scsparp_args} in
60118123Sharti		[Yy][Ee][Ss])
61118123Sharti			case ${atmarp_args} in
62118123Sharti			local)
63118123Sharti				;;
64118123Sharti			*)
65118123Sharti				warn "${net}: local arpserver required for SCSP"
66118123Sharti				continue
67118123Sharti				;;
68118123Sharti			esac
69118123Sharti
70118123Sharti			atm_atmarpd="${atm_atmarpd} ${net}"
71118123Sharti			atm_scspd=1
72118123Sharti			;;
73118123Sharti		esac
74118123Sharti	done
75118123Sharti
7651231Ssheldonh	# Start SCSP daemon (if needed)
7751231Ssheldonh	case ${atm_scspd} in
7851231Ssheldonh	1)
7970108Sdougb		echo -n ' scspd'
8051231Ssheldonh		scspd
8151231Ssheldonh		;;
8251231Ssheldonh	esac
8340006Sphk
8451231Ssheldonh	# Start ATMARP daemon (if needed)
8551231Ssheldonh	if [ -n "${atm_atmarpd}" ]; then
8670108Sdougb		echo -n ' atmarpd'
8751231Ssheldonh		atmarpd ${atm_atmarpd}
8851231Ssheldonh	fi
89100280Sgordon	echo '.'
90100280Sgordon}
9140006Sphk
92118123Shartiload_rc_config $name
93118123Shartirun_rc_command "$1"
94