Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / etc / rc.atm
CommitLineData
984263bc
MD
1#!/bin/sh
2#
3# Copyright (c) 2000 The FreeBSD Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD: src/etc/rc.atm,v 1.6.2.3 2001/11/19 10:42:28 sheldonh Exp $
1de703da 28# $DragonFly: src/etc/Attic/rc.atm,v 1.2 2003/06/17 04:24:45 dillon Exp $
984263bc
MD
29#
30
31#
32# ATM networking startup script
33#
34# Initial interface configuration.
35# N.B. /usr is not mounted.
36#
37atm_pass1() {
38 # Locate all probed ATM adapters
39 atmdev=`atm sh stat int | while read dev junk; do
40 case ${dev} in
41 hea[0-9] | hea[0-9][0-9])
42 echo "${dev} "
43 ;;
44 hfa[0-9] | hfa[0-9][0-9])
45 echo "${dev} "
46 ;;
47 *)
48 continue
49 ;;
50 esac
51 done`
52
53 if [ -z "${atmdev}" ]; then
54 echo 'No ATM adapters found'
55 return 0
56 fi
57
58 # Load microcode into FORE adapters (if needed)
59 if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
60 fore_dnld
61 fi
62
63 # Configure physical interfaces
64 ilmid=0
65 for phy in ${atmdev}; do
66 echo -n "Configuring ATM device ${phy}:"
67
68 # Define network interfaces
69 eval netif_args=\$atm_netif_${phy}
70 if [ -n "${netif_args}" ]; then
71 atm set netif ${phy} ${netif_args} || continue
72 else
73 echo ' missing network interface definition'
74 continue
75 fi
76
77 # Override physical MAC address
78 eval macaddr_args=\$atm_macaddr_${phy}
79 if [ -n "${macaddr_args}" ]; then
80 case ${macaddr_args} in
81 [Nn][Oo] | '')
82 ;;
83 *)
84 atm set mac ${phy} ${macaddr_args} || continue
85 ;;
86 esac
87 fi
88
89 # Configure signalling manager
90 eval sigmgr_args=\$atm_sigmgr_${phy}
91 if [ -n "${sigmgr_args}" ]; then
92 atm attach ${phy} ${sigmgr_args} || continue
93 else
94 echo ' missing signalling manager definition'
95 continue
96 fi
97
98 # Configure UNI NSAP prefix
99 eval prefix_args=\$atm_prefix_${phy}
100 if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
101 if [ -z "${prefix_args}" ]; then
102 echo ' missing NSAP prefix for UNI interface'
103 continue
104 fi
105
106 case ${prefix_args} in
107 ILMI)
108 ilmid=1
109 ;;
110 *)
111 atm set prefix ${phy} ${prefix_args} || continue
112 ;;
113 esac
114 fi
115
116 atm_phy="${atm_phy} ${phy}"
117 echo '.'
118 done
119
120 echo -n 'Starting initial ATM daemons:'
121 # Start ILMI daemon (if needed)
122 case ${ilmid} in
123 1)
124 echo -n ' ilmid'
125 ilmid
126 ;;
127 esac
128
129 echo '.'
130 atm_pass1_done=YES
131}
132
133#
134# Finish up configuration.
135# N.B. /usr is not mounted.
136#
137atm_pass2() {
138 echo -n 'Configuring ATM network interfaces:'
139
140 atm_scspd=0
141 atm_atmarpd=""
142
143 # Configure network interfaces
144 for phy in ${atm_phy}; do
145 eval netif_args=\$atm_netif_${phy}
146 set -- ${netif_args}
147 netname=$1
148 netcnt=$2
149 netindx=0
150 while [ ${netindx} -lt ${netcnt} ]; do
151 net="${netname}${netindx}"
152 netindx=$((${netindx} + 1))
153 echo -n " ${net}"
154
155 # Configure atmarp server
156 eval atmarp_args=\$atm_arpserver_${net}
157 if [ -n "${atmarp_args}" ]; then
158 atm set arpserver ${net} ${atmarp_args} ||
159 continue
160 fi
161 eval scsparp_args=\$atm_scsparp_${net}
162
163 case ${scsparp_args} in
164 [Yy][Ee][Ss])
165 case ${atmarp_args} in
166 local)
167 ;;
168 *)
169 echo ' local arpserver required for SCSP'
170 continue
171 ;;
172 esac
173
174 atm_atmarpd="${atm_atmarpd} ${net}"
175 atm_scspd=1
176 esac
177 done
178 done
179 echo '.'
180
181 # Define any PVCs.
182 if [ -n "${atm_pvcs}" ]; then
183 for i in ${atm_pvcs}; do
184 eval pvc_args=\$atm_pvc_${i}
185 atm add pvc ${pvc_args}
186 done
187 fi
188
189 # Define any permanent ARP entries.
190 if [ -n "${atm_arps}" ]; then
191 for i in ${atm_arps}; do
192 eval arp_args=\$atm_arp_${i}
193 atm add arp ${arp_args}
194 done
195 fi
196 atm_pass2_done=YES
197}
198
199#
200# Start any necessary daemons.
201#
202atm_pass3() {
203 # Start SCSP daemon (if needed)
204 case ${atm_scspd} in
205 1)
206 echo -n ' scspd'
207 scspd
208 ;;
209 esac
210
211 # Start ATMARP daemon (if needed)
212 if [ -n "${atm_atmarpd}" ]; then
213 echo -n ' atmarpd'
214 atmarpd ${atm_atmarpd}
215 fi
216
217 atm_pass3_done=YES
218}