]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.atm
Add cs_CZ
[FreeBSD/FreeBSD.git] / etc / rc.atm
1 #!/bin/sh
2 #
3
4 # ATM networking startup script
5 #
6 # $FreeBSD$
7
8 #
9 # Initial interface configuration.
10 # N.B. /usr is not mounted.
11 #
12 atm_pass1() {
13         # Locate all probed ATM adapters
14         atmdev=`atm sh stat int | while read dev junk; do
15                 case ${dev} in
16                 hea[0-9] | hea[0-9][0-9])
17                         echo "${dev} "
18                         ;;
19                 hfa[0-9] | hfa[0-9][0-9])
20                         echo "${dev} "
21                         ;;
22                 *)
23                         continue
24                         ;;
25                 esac
26         done`
27
28         if [ -z "${atmdev}" ]; then
29                 echo "No ATM adapters found."
30                 return 0
31         fi
32
33         # Load microcode into FORE adapters (if needed)
34         if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
35                 fore_dnld -d /etc
36         fi
37
38         # Configure physical interfaces
39         ilmid=0
40         for phy in ${atmdev}; do
41                 echo -n "Configuring ATM device ${phy}:"
42
43                 # Define network interfaces
44                 eval netif_args=\$atm_netif_${phy}
45                 if [ -n "${netif_args}" ]; then
46                         atm set netif ${phy} ${netif_args} || continue
47                 else
48                         echo "missing network interface definition"
49                         continue
50                 fi
51
52                 # Override physical MAC address
53                 eval macaddr_args=\$atm_macaddr_${phy}
54                 if [ -n "${macaddr_args}" ]; then
55                         case ${macaddr_args} in
56                         [Nn][Oo] | '')
57                                 ;;
58                         *)
59                                 atm set mac ${phy} ${macaddr_args} || continue
60                                 ;;
61                         esac
62                 fi
63
64                 # Configure signalling manager
65                 eval sigmgr_args=\$atm_sigmgr_${phy}
66                 if [ -n "${sigmgr_args}" ]; then
67                         atm attach ${phy} ${sigmgr_args} || continue
68                 else
69                         echo "missing signalling manager definition"
70                         continue
71                 fi
72
73                 # Configure UNI NSAP prefix
74                 eval prefix_args=\$atm_prefix_${phy}
75                 if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
76                         if [ -z "${prefix_args}" ]; then
77                                 echo "missing NSAP prefix for UNI interface"
78                                 continue
79                         fi
80
81                         case ${prefix_args} in
82                         ILMI)
83                                 ilmid=1
84                                 ;;
85                         *)
86                                 atm set prefix ${phy} ${prefix_args} || continue
87                                 ;;
88                         esac
89                 fi
90
91                 atm_phy="${atm_phy} ${phy}"
92                 echo "."
93         done
94
95         echo -n "Starting initial ATM daemons:"
96         # Start ILMI daemon (if needed)
97         case ${ilmid} in
98         1)
99                 echo -n " ilmid"
100                 ilmid
101                 ;;
102         esac
103
104         echo "."
105         atm_pass1_done=YES
106 }
107
108 #
109 # Finish up configuration.
110 # N.B. /usr is not mounted.
111 #
112 atm_pass2() {
113         echo -n "Configuring ATM network interfaces:"
114
115         atm_scspd=0
116         atm_atmarpd=""
117
118         # Configure network interfaces
119         for phy in ${atm_phy}; do
120                 eval netif_args=\$atm_netif_${phy}
121                 set -- ${netif_args}
122                 netname=$1
123                 netcnt=$2
124                 netindx=0
125                 while [ ${netindx} -lt ${netcnt} ]; do
126                         net="${netname}${netindx}"
127                         netindx=`expr ${netindx} + 1`
128                         echo -n " ${net}"
129
130                         # Configure atmarp server
131                         eval atmarp_args=\$atm_arpserver_${net}
132                         if [ -n "${atmarp_args}" ]; then
133                                 atm set arpserver ${net} ${atmarp_args} ||
134                                         continue
135                         fi
136                         eval scsparp_args=\$atm_scsparp_${net}
137
138                         case ${scsparp_args} in
139                         [Yy][Ee][Ss])
140                                 case ${atmarp_args} in
141                                 local)
142                                         ;;
143                                 *)
144                                         echo "local arpserver required for SCSP"
145                                         continue
146                                         ;;
147                                 esac
148
149                                 atm_atmarpd="${atm_atmarpd} ${net}"
150                                 atm_scspd=1
151                         esac
152                 done
153         done
154         echo "."
155
156         # Define any PVCs.
157         if [ -n "${atm_pvcs}" ]; then
158                 for i in ${atm_pvcs}; do
159                         eval pvc_args=\$atm_pvc_${i}
160                         atm add pvc ${pvc_args}
161                 done
162         fi
163
164         # Define any permanent ARP entries.
165         if [ -n "${atm_arps}" ]; then
166                 for i in ${atm_arps}; do
167                         eval arp_args=\$atm_arp_${i}
168                         atm add arp ${arp_args}
169                 done
170         fi
171         atm_pass2_done=YES
172 }
173
174 #
175 # Start any necessary daemons.
176 #
177 atm_pass3() {
178         # Start SCSP daemon (if needed)
179         case ${atm_scspd} in
180         1)
181                 echo -n " scspd"
182                 scspd
183                 ;;
184         esac
185
186         # Start ATMARP daemon (if needed)
187         if [ -n "${atm_atmarpd}" ]; then
188                 echo -n " atmarpd"
189                 atmarpd ${atm_atmarpd}
190         fi
191
192         atm_pass3_done=YES
193 }