atm2 revision 117020
1344779Sdim#!/bin/sh
2336809Sdim#
3353358Sdim# Copyright (c) 2000  The FreeBSD Project
4353358Sdim# All rights reserved.
5353358Sdim#
6336809Sdim# Redistribution and use in source and binary forms, with or without
7336809Sdim# modification, are permitted provided that the following conditions
8336809Sdim# are met:
9336809Sdim# 1. Redistributions of source code must retain the above copyright
10360784Sdim#    notice, this list of conditions and the following disclaimer.
11360784Sdim# 2. Redistributions in binary form must reproduce the above copyright
12336809Sdim#    notice, this list of conditions and the following disclaimer in the
13336809Sdim#    documentation and/or other materials provided with the distribution.
14336809Sdim#
15344779Sdim# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16336809Sdim# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17336809Sdim# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18336809Sdim# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19336809Sdim# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20336809Sdim# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21336809Sdim# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22336809Sdim# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23344779Sdim# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24344779Sdim# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25344779Sdim# SUCH DAMAGE.
26344779Sdim#
27344779Sdim# $FreeBSD: head/etc/rc.d/atm2 117020 2003-06-29 05:15:57Z mtm $
28344779Sdim#
29344779Sdim
30344779Sdim# PROVIDE: atm2
31353358Sdim# REQUIRE: atm1 netif
32344779Sdim# BEFORE:  routing
33344779Sdim# KEYWORD: FreeBSD
34344779Sdim
35344779Sdim#
36353358Sdim# Additional ATM interface configuration
37344779Sdim#
38344779Sdim
39344779Sdim. /etc/rc.subr
40344779Sdim
41353358Sdimatm2_start()
42344779Sdim{
43344779Sdim	# Configure network interfaces
44344779Sdim	for phy in ${atm_phy}; do
45344779Sdim		eval netif_args=\$atm_netif_${phy}
46344779Sdim		set -- ${netif_args}
47344779Sdim		netname=$1
48344779Sdim		netcnt=$2
49344779Sdim		netindx=0
50344779Sdim		while [ ${netindx} -lt ${netcnt} ]; do
51344779Sdim			net="${netname}${netindx}"
52344779Sdim			netindx=$((${netindx} + 1))
53344779Sdim			echo -n " ${net}"
54344779Sdim
55344779Sdim			# Configure atmarp server
56344779Sdim			eval atmarp_args=\$atm_arpserver_${net}
57344779Sdim			if [ -n "${atmarp_args}" ]; then
58344779Sdim				atm set arpserver ${net} ${atmarp_args} ||
59344779Sdim				    continue
60344779Sdim			fi
61344779Sdim			eval scsparp_args=\$atm_scsparp_${net}
62344779Sdim
63344779Sdim			case ${scsparp_args} in
64344779Sdim			[Yy][Ee][Ss])
65344779Sdim				case ${atmarp_args} in
66344779Sdim				local)
67344779Sdim					;;
68344779Sdim				*)
69344779Sdim					echo ' local arpserver required for SCSP'
70344779Sdim					continue
71344779Sdim					;;
72344779Sdim				esac
73344779Sdim
74344779Sdim				atm_atmarpd="${atm_atmarpd} ${net}"
75344779Sdim				atm_scspd=1
76344779Sdim				;;
77344779Sdim			esac
78344779Sdim		done
79344779Sdim	done
80344779Sdim	echo '.'
81344779Sdim
82360784Sdim	# Define any permanent ARP entries.
83360784Sdim	if [ -n "${atm_arps}" ]; then
84360784Sdim		for i in ${atm_arps}; do
85360784Sdim			eval arp_args=\$atm_arp_${i}
86344779Sdim			atm add arp ${arp_args}
87360784Sdim		done
88360784Sdim	fi
89360784Sdim
90360784Sdim	# XXX - required by atm3.sh. I don't like having one script depend
91344779Sdim	#       on variables in another script (especially in a dynamic
92344779Sdim	#       ordered system like this), but it's necessary for the moment.
93344779Sdim	#
94360784Sdim	export atm_atmarpd
95344779Sdim	export atm_scspd
96344779Sdim}
97344779Sdim
98344779Sdimload_rc_config "XXX"
99344779Sdim
100344779Sdimcase ${atm_enable} in
101344779Sdim[Yy][Ee][Ss])
102344779Sdim	atm2_start
103360784Sdim	;;
104344779Sdimesac
105344779Sdim