Deleted Added
full compact
atm3 (86342) atm3 (100280)
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:

--- 10 unchanged lines hidden (view full) ---

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#
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:

--- 10 unchanged lines hidden (view full) ---

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: head/etc/rc.d/atm3 86342 2001-11-14 06:35:43Z sheldonh $
27# $FreeBSD: head/etc/rc.d/atm3 100280 2002-07-18 05:00:17Z gordon $
28#
29
28#
29
30# Start ATM daemons
31# XXX - This script uses global variables set by scripts atm1 and atm2.
32# Ideally this shouldn't be the case.
30#
33#
31# ATM networking startup script
32#
33# Initial interface configuration.
34# N.B. /usr is not mounted.
35#
36atm_pass1() {
37 # Locate all probed ATM adapters
38 atmdev=`atm sh stat int | while read dev junk; do
39 case ${dev} in
40 hea[0-9] | hea[0-9][0-9])
41 echo "${dev} "
42 ;;
43 hfa[0-9] | hfa[0-9][0-9])
44 echo "${dev} "
45 ;;
46 *)
47 continue
48 ;;
49 esac
50 done`
51
34
52 if [ -z "${atmdev}" ]; then
53 echo 'No ATM adapters found'
54 return 0
55 fi
35# PROVIDE: atm3
36# REQUIRE: atm2
37# BEFORE: DAEMON
38# KEYWORD: FreeBSD
56
39
57 # Load microcode into FORE adapters (if needed)
58 if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
59 fore_dnld
60 fi
40. /etc/rc.subr
61
41
62 # Configure physical interfaces
63 ilmid=0
64 for phy in ${atmdev}; do
65 echo -n "Configuring ATM device ${phy}:"
42atm3_start()
43{
44 echo -n 'Starting ATM daemons:'
66
45
67 # Define network interfaces
68 eval netif_args=\$atm_netif_${phy}
69 if [ -n "${netif_args}" ]; then
70 atm set netif ${phy} ${netif_args} || continue
71 else
72 echo ' missing network interface definition'
73 continue
74 fi
75
76 # Override physical MAC address
77 eval macaddr_args=\$atm_macaddr_${phy}
78 if [ -n "${macaddr_args}" ]; then
79 case ${macaddr_args} in
80 [Nn][Oo] | '')
81 ;;
82 *)
83 atm set mac ${phy} ${macaddr_args} || continue
84 ;;
85 esac
86 fi
87
88 # Configure signalling manager
89 eval sigmgr_args=\$atm_sigmgr_${phy}
90 if [ -n "${sigmgr_args}" ]; then
91 atm attach ${phy} ${sigmgr_args} || continue
92 else
93 echo ' missing signalling manager definition'
94 continue
95 fi
96
97 # Configure UNI NSAP prefix
98 eval prefix_args=\$atm_prefix_${phy}
99 if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
100 if [ -z "${prefix_args}" ]; then
101 echo ' missing NSAP prefix for UNI interface'
102 continue
103 fi
104
105 case ${prefix_args} in
106 ILMI)
107 ilmid=1
108 ;;
109 *)
110 atm set prefix ${phy} ${prefix_args} || continue
111 ;;
112 esac
113 fi
114
115 atm_phy="${atm_phy} ${phy}"
116 echo '.'
117 done
118
119 echo -n 'Starting initial ATM daemons:'
120 # Start ILMI daemon (if needed)
121 case ${ilmid} in
122 1)
123 echo -n ' ilmid'
124 ilmid
125 ;;
126 esac
127
128 echo '.'
129 atm_pass1_done=YES
130}
131
132#
133# Finish up configuration.
134# N.B. /usr is not mounted.
135#
136atm_pass2() {
137 echo -n 'Configuring ATM network interfaces:'
138
139 atm_scspd=0
140 atm_atmarpd=""
141
142 # Configure network interfaces
143 for phy in ${atm_phy}; do
144 eval netif_args=\$atm_netif_${phy}
145 set -- ${netif_args}
146 netname=$1
147 netcnt=$2
148 netindx=0
149 while [ ${netindx} -lt ${netcnt} ]; do
150 net="${netname}${netindx}"
151 netindx=$((${netindx} + 1))
152 echo -n " ${net}"
153
154 # Configure atmarp server
155 eval atmarp_args=\$atm_arpserver_${net}
156 if [ -n "${atmarp_args}" ]; then
157 atm set arpserver ${net} ${atmarp_args} ||
158 continue
159 fi
160 eval scsparp_args=\$atm_scsparp_${net}
161
162 case ${scsparp_args} in
163 [Yy][Ee][Ss])
164 case ${atmarp_args} in
165 local)
166 ;;
167 *)
168 echo ' local arpserver required for SCSP'
169 continue
170 ;;
171 esac
172
173 atm_atmarpd="${atm_atmarpd} ${net}"
174 atm_scspd=1
175 esac
176 done
177 done
178 echo '.'
179
180 # Define any PVCs.
181 if [ -n "${atm_pvcs}" ]; then
182 for i in ${atm_pvcs}; do
183 eval pvc_args=\$atm_pvc_${i}
184 atm add pvc ${pvc_args}
185 done
186 fi
187
188 # Define any permanent ARP entries.
189 if [ -n "${atm_arps}" ]; then
190 for i in ${atm_arps}; do
191 eval arp_args=\$atm_arp_${i}
192 atm add arp ${arp_args}
193 done
194 fi
195 atm_pass2_done=YES
196}
197
198#
199# Start any necessary daemons.
200#
201atm_pass3() {
202 # Start SCSP daemon (if needed)
203 case ${atm_scspd} in
204 1)
205 echo -n ' scspd'
206 scspd
207 ;;
208 esac
209
210 # Start ATMARP daemon (if needed)
211 if [ -n "${atm_atmarpd}" ]; then
212 echo -n ' atmarpd'
213 atmarpd ${atm_atmarpd}
214 fi
46 # Start SCSP daemon (if needed)
47 case ${atm_scspd} in
48 1)
49 echo -n ' scspd'
50 scspd
51 ;;
52 esac
53
54 # Start ATMARP daemon (if needed)
55 if [ -n "${atm_atmarpd}" ]; then
56 echo -n ' atmarpd'
57 atmarpd ${atm_atmarpd}
58 fi
215
216 atm_pass3_done=YES
59 echo '.'
217}
60}
61
62load_rc_config "XXX"
63
64case ${atm_enable} in
65[Yy][Ee][Ss])
66 atm3_start
67 ;;
68esac