1#!/bin/sh 2# 3 4# ATM networking startup script 5#
| 1#!/bin/sh 2# 3 4# ATM networking startup script 5#
|
6# $FreeBSD: head/etc/rc.d/atm3 50472 1999-08-27 23:37:10Z peter $
| 6# $FreeBSD: head/etc/rc.d/atm3 51231 1999-09-13 15:44:20Z sheldonh $
|
7 8# 9# Initial interface configuration. 10# N.B. /usr is not mounted. 11# 12atm_pass1() {
| 7 8# 9# Initial interface configuration. 10# N.B. /usr is not mounted. 11# 12atm_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`
| 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
| 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
| 28 if [ -z "${atmdev}" ]; then 29 echo "No ATM adapters found." 30 return 0
|
50 fi 51
| 31 fi 32
|
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
| 33 # Load microcode into FORE adapters (if needed) 34 if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then 35 fore_dnld -d /etc
|
56 fi 57
| 36 fi 37
|
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
| 38 # Configure physical interfaces 39 ilmid=0 40 for phy in ${atmdev}; do 41 echo -n "Configuring ATM device ${phy}:"
|
66
| 42
|
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"
| 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"
|
72 continue 73 fi
| 49 continue 50 fi
|
74 if [ "${prefix_args}" = "ILMI" ]; then 75 ilmid=1
| 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
|
76 else
| 68 else
|
77 atm set prefix ${phy} ${prefix_args} || continue
| 69 echo "missing signalling manager definition" 70 continue
|
78 fi
| 71 fi
|
79 fi
| |
80
| 72
|
81 atm_phy="${atm_phy} ${phy}" 82 echo "." 83 done
| 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
|
84
| 80
|
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
| 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
|
91
| 90
|
92 echo "." 93 atm_pass1_done=YES
| 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
|
94} 95 96# 97# Finish up configuration. 98# N.B. /usr is not mounted. 99# 100atm_pass2() {
| 106} 107 108# 109# Finish up configuration. 110# N.B. /usr is not mounted. 111# 112atm_pass2() {
|
101 echo -n "Configuring ATM network interfaces:"
| 113 echo -n "Configuring ATM network interfaces:"
|
102
| 114
|
103 atm_scspd=0 104 atm_atmarpd=""
| 115 atm_scspd=0 116 atm_atmarpd=""
|
105
| 117
|
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
| 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}"
|
114
| 129
|
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 [ "${scsparp_args}" = "YES" ]; then 126 if [ "${atmarp_args}" != "local" ]; then 127 echo "local arpserver required for SCSP" 128 continue
| 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
|
129 fi
| 135 fi
|
130 atm_atmarpd="${atm_atmarpd} ${net}" 131 atm_scspd=1 132 fi 133 done 134 done 135 echo "."
| 136 eval scsparp_args=\$atm_scsparp_${net}
|
136
| 137
|
137 # Define any PVCs. 138 if [ -n "${atm_pvcs}" ]; 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
| 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
|
144
| 148
|
145 # Define any permanent ARP entries. 146 if [ -n "${atm_arps}" ]; then 147 for i in ${atm_arps}; do 148 eval arp_args=\$atm_arp_${i} 149 atm add arp ${arp_args}
| 149 atm_atmarpd="${atm_atmarpd} ${net}" 150 atm_scspd=1 151 esac 152 done
|
150 done
| 153 done
|
151 fi 152 atm_pass2_done=YES
| 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
|
153} 154 155# 156# Start any necessary daemons. 157# 158atm_pass3() {
| 172} 173 174# 175# Start any necessary daemons. 176# 177atm_pass3() {
|
159 # Start SCSP daemon (if needed) 160 if [ "${atm_scspd}" -eq 1 ]; then 161 echo -n " scspd" 162 scspd 163 fi
| 178 # Start SCSP daemon (if needed) 179 case ${atm_scspd} in 180 1) 181 echo -n " scspd" 182 scspd 183 ;; 184 esac
|
164
| 185
|
165 # Start ATMARP daemon (if needed) 166 if [ -n "${atm_atmarpd}" ]; then 167 echo -n " atmarpd" 168 atmarpd ${atm_atmarpd} 169 fi
| 186 # Start ATMARP daemon (if needed) 187 if [ -n "${atm_atmarpd}" ]; then 188 echo -n " atmarpd" 189 atmarpd ${atm_atmarpd} 190 fi
|
170
| 191
|
171 atm_pass3_done=YES
| 192 atm_pass3_done=YES
|
172}
| 193}
|