atm2 revision 100280
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: head/etc/rc.d/atm2 100280 2002-07-18 05:00:17Z gordon $
2866830Sobrien#
2940006Sphk
30100280Sgordon# PROVIDE: atm2
31100280Sgordon# REQUIRE: atm1 network1
32100280Sgordon# BEFORE: network2
33100280Sgordon# KEYWORD: FreeBSD
3440006Sphk
3540006Sphk#
36100280Sgordon# Additional ATM interface configuration
3740006Sphk#
3840006Sphk
39100280Sgordon. /etc/rc.subr
4040006Sphk
41100280Sgordonatm2_start()
42100280Sgordon{
4351231Ssheldonh	# Configure network interfaces
4451231Ssheldonh	for phy in ${atm_phy}; do
4551231Ssheldonh		eval netif_args=\$atm_netif_${phy}
4651231Ssheldonh		set -- ${netif_args}
4751231Ssheldonh		netname=$1
4851231Ssheldonh		netcnt=$2
4951231Ssheldonh		netindx=0
5051231Ssheldonh		while [ ${netindx} -lt ${netcnt} ]; do
5151231Ssheldonh			net="${netname}${netindx}"
5286342Ssheldonh			netindx=$((${netindx} + 1))
5351231Ssheldonh			echo -n " ${net}"
5440006Sphk
5551231Ssheldonh			# Configure atmarp server
5651231Ssheldonh			eval atmarp_args=\$atm_arpserver_${net}
5751231Ssheldonh			if [ -n "${atmarp_args}" ]; then
5851231Ssheldonh				atm set arpserver ${net} ${atmarp_args} ||
59100280Sgordon				    continue
6040006Sphk			fi
6151231Ssheldonh			eval scsparp_args=\$atm_scsparp_${net}
6240006Sphk
6351231Ssheldonh			case ${scsparp_args} in
6451231Ssheldonh			[Yy][Ee][Ss])
6551231Ssheldonh				case ${atmarp_args} in
6651231Ssheldonh				local)
6751231Ssheldonh					;;
6851231Ssheldonh				*)
6970108Sdougb					echo ' local arpserver required for SCSP'
7051231Ssheldonh					continue
7151231Ssheldonh					;;
7251231Ssheldonh				esac
7351231Ssheldonh
7451231Ssheldonh				atm_atmarpd="${atm_atmarpd} ${net}"
7551231Ssheldonh				atm_scspd=1
76100280Sgordon				;;
7751231Ssheldonh			esac
7851231Ssheldonh		done
7940006Sphk	done
8070108Sdougb	echo '.'
8140006Sphk
8251231Ssheldonh	# Define any permanent ARP entries.
8351231Ssheldonh	if [ -n "${atm_arps}" ]; then
8451231Ssheldonh		for i in ${atm_arps}; do
8551231Ssheldonh			eval arp_args=\$atm_arp_${i}
8651231Ssheldonh			atm add arp ${arp_args}
8751231Ssheldonh		done
8851231Ssheldonh	fi
89100280Sgordon
90100280Sgordon	# XXX - required by atm3.sh. I don't like having one script depend
91100280Sgordon	#       on variables in another script (especially in a dynamic
92100280Sgordon	#       ordered system like this), but it's necessary for the moment.
93100280Sgordon	# 
94100280Sgordon	export atm_atmarpd
95100280Sgordon	export atm_scspd
9640006Sphk}
9740006Sphk
98100280Sgordonload_rc_config "XXX"
9940006Sphk
100100280Sgordoncase ${atm_enable} in
101100280Sgordon[Yy][Ee][Ss])
102100280Sgordon	atm2_start
103100280Sgordon	;;
104100280Sgordonesac
105