]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/rc.atm
Bump the number of vtys created to compensate for new demands created
[FreeBSD/FreeBSD.git] / etc / rc.atm
1 #!/bin/sh
2 #
3
4 # ATM networking startup script
5 #
6 #       $Id$
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}" -a "${macaddr_args}" != "NO" ]; then
55                 atm set mac ${phy} ${macaddr_args} || continue
56         fi
57
58         # Configure signalling manager
59         eval sigmgr_args=\$atm_sigmgr_${phy}
60         if [ -n "${sigmgr_args}" ]; then
61                 atm attach ${phy} ${sigmgr_args} || continue
62         else
63                 echo "missing signalling manager definition"
64                 continue
65         fi
66
67         # Configure UNI NSAP prefix
68         eval prefix_args=\$atm_prefix_${phy}
69         if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
70                 if [ -z "${prefix_args}" ]; then
71                         echo "missing NSAP prefix for UNI interface"
72                         continue
73                 fi
74                 if [ "${prefix_args}" = "ILMI" ]; then
75                         ilmid=1
76                 else
77                         atm set prefix ${phy} ${prefix_args} || continue
78                 fi
79         fi
80
81         atm_phy="${atm_phy} ${phy}"
82         echo "."
83     done
84
85     echo -n "Starting initial ATM daemons:"
86     # Start ILMI daemon (if needed)
87     if [ ${ilmid} -eq 1 ]; then
88         echo -n " ilmid"
89         ilmid
90     fi
91
92     echo "."
93     atm_pass1_done=YES
94 }
95
96 #
97 # Finish up configuration.
98 # N.B. /usr is not mounted.
99 #
100 atm_pass2() {
101     echo -n "Configuring ATM network interfaces:"
102
103     atm_scspd=0
104     atm_atmarpd=""
105
106     # Configure network interfaces
107     for phy in ${atm_phy}; do
108         eval netif_args=\$atm_netif_${phy}
109         set -- ${netif_args}
110         netname=$1
111         netcnt=$2
112         netindx=0
113         while [ ${netindx} -lt ${netcnt} ]; do
114
115                 net="${netname}${netindx}"
116                 netindx=`expr ${netindx} + 1`
117                 echo -n " ${net}"
118
119                 # Configure atmarp server
120                 eval atmarp_args=\$atm_arpserver_${net}
121                 if [ -n "${atmarp_args}" ]; then
122                         atm set arpserver ${net} ${atmarp_args} || continue
123                 fi
124                 eval scsparp_args=\$atm_scsparp_${net}
125                 if [ "X${scsparp_args}" = X"YES" ]; then
126                         if [ "${atmarp_args}" != "local" ]; then
127                                 echo "local arpserver required for SCSP"
128                                 continue
129                         fi
130                         atm_atmarpd="${atm_atmarpd} ${net}"
131                         atm_scspd=1
132                 fi
133         done
134     done
135     echo "."
136
137     # Define any PVCs.
138     if [ "X${atm_pvcs}" != "X" ]; then
139         for i in ${atm_pvcs}; do
140                 eval pvc_args=\$atm_pvc_${i}
141                 atm add pvc ${pvc_args}
142         done
143     fi
144
145     # Define any permanent ARP entries.
146     if [ "X${atm_arps}" != "X" ]; then
147         for i in ${atm_arps}; do
148                 eval arp_args=\$atm_arp_${i}
149                 atm add arp ${arp_args}
150         done
151     fi
152     atm_pass2_done=YES
153 }
154
155 #
156 # Start any necessary daemons.
157 #
158 atm_pass3() {
159     # Start SCSP daemon (if needed)
160     if [ ${atm_scspd} -eq 1 ]; then
161         echo -n " scspd"
162         scspd
163     fi
164
165     # Start ATMARP daemon (if needed)
166     if [ -n "${atm_atmarpd}" ]; then
167         echo -n " atmarpd"
168         atmarpd ${atm_atmarpd}
169     fi
170
171     atm_pass3_done=YES
172 }