1998-10-06 21:24:31 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2000-10-08 21:20:36 +02:00
|
|
|
# Copyright (c) 2000 The FreeBSD Project
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
# SUCH DAMAGE.
|
1998-10-06 21:24:31 +02:00
|
|
|
#
|
1999-08-28 01:37:10 +02:00
|
|
|
# $FreeBSD$
|
2000-10-08 21:20:36 +02:00
|
|
|
#
|
1998-10-06 21:24:31 +02:00
|
|
|
|
2000-10-08 21:20:36 +02:00
|
|
|
#
|
|
|
|
# ATM networking startup script
|
1998-10-06 21:24:31 +02:00
|
|
|
#
|
|
|
|
# Initial interface configuration.
|
|
|
|
# N.B. /usr is not mounted.
|
|
|
|
#
|
|
|
|
atm_pass1() {
|
1999-09-13 17:44:20 +02:00
|
|
|
# Locate all probed ATM adapters
|
|
|
|
atmdev=`atm sh stat int | while read dev junk; do
|
|
|
|
case ${dev} in
|
|
|
|
hea[0-9] | hea[0-9][0-9])
|
|
|
|
echo "${dev} "
|
|
|
|
;;
|
|
|
|
hfa[0-9] | hfa[0-9][0-9])
|
|
|
|
echo "${dev} "
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done`
|
1998-10-06 21:24:31 +02:00
|
|
|
|
1999-09-13 17:44:20 +02:00
|
|
|
if [ -z "${atmdev}" ]; then
|
2000-12-17 09:16:06 +01:00
|
|
|
echo 'No ATM adapters found'
|
1999-09-13 17:44:20 +02:00
|
|
|
return 0
|
1998-10-06 21:24:31 +02:00
|
|
|
fi
|
|
|
|
|
1999-09-13 17:44:20 +02:00
|
|
|
# Load microcode into FORE adapters (if needed)
|
|
|
|
if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
|
2000-02-15 14:21:43 +01:00
|
|
|
fore_dnld
|
1998-10-06 21:24:31 +02:00
|
|
|
fi
|
|
|
|
|
1999-09-13 17:44:20 +02:00
|
|
|
# Configure physical interfaces
|
|
|
|
ilmid=0
|
|
|
|
for phy in ${atmdev}; do
|
|
|
|
echo -n "Configuring ATM device ${phy}:"
|
|
|
|
|
|
|
|
# Define network interfaces
|
|
|
|
eval netif_args=\$atm_netif_${phy}
|
|
|
|
if [ -n "${netif_args}" ]; then
|
|
|
|
atm set netif ${phy} ${netif_args} || continue
|
|
|
|
else
|
2000-12-17 09:16:06 +01:00
|
|
|
echo ' missing network interface definition'
|
1998-10-06 21:24:31 +02:00
|
|
|
continue
|
|
|
|
fi
|
1999-09-13 17:44:20 +02:00
|
|
|
|
|
|
|
# Override physical MAC address
|
|
|
|
eval macaddr_args=\$atm_macaddr_${phy}
|
|
|
|
if [ -n "${macaddr_args}" ]; then
|
|
|
|
case ${macaddr_args} in
|
|
|
|
[Nn][Oo] | '')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
atm set mac ${phy} ${macaddr_args} || continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Configure signalling manager
|
|
|
|
eval sigmgr_args=\$atm_sigmgr_${phy}
|
|
|
|
if [ -n "${sigmgr_args}" ]; then
|
|
|
|
atm attach ${phy} ${sigmgr_args} || continue
|
1998-10-06 21:24:31 +02:00
|
|
|
else
|
2000-12-17 09:16:06 +01:00
|
|
|
echo ' missing signalling manager definition'
|
1999-09-13 17:44:20 +02:00
|
|
|
continue
|
1998-10-06 21:24:31 +02:00
|
|
|
fi
|
|
|
|
|
1999-09-13 17:44:20 +02:00
|
|
|
# Configure UNI NSAP prefix
|
|
|
|
eval prefix_args=\$atm_prefix_${phy}
|
|
|
|
if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
|
|
|
|
if [ -z "${prefix_args}" ]; then
|
2000-12-17 09:16:06 +01:00
|
|
|
echo ' missing NSAP prefix for UNI interface'
|
1999-09-13 17:44:20 +02:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
case ${prefix_args} in
|
|
|
|
ILMI)
|
|
|
|
ilmid=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
atm set prefix ${phy} ${prefix_args} || continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
1998-10-06 21:24:31 +02:00
|
|
|
|
1999-09-13 17:44:20 +02:00
|
|
|
atm_phy="${atm_phy} ${phy}"
|
2000-12-17 09:16:06 +01:00
|
|
|
echo '.'
|
1999-09-13 17:44:20 +02:00
|
|
|
done
|
1998-10-06 21:24:31 +02:00
|
|
|
|
2000-12-17 09:16:06 +01:00
|
|
|
echo -n 'Starting initial ATM daemons:'
|
1999-09-13 17:44:20 +02:00
|
|
|
# Start ILMI daemon (if needed)
|
|
|
|
case ${ilmid} in
|
|
|
|
1)
|
2000-12-17 09:16:06 +01:00
|
|
|
echo -n ' ilmid'
|
1999-09-13 17:44:20 +02:00
|
|
|
ilmid
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2000-12-17 09:16:06 +01:00
|
|
|
echo '.'
|
1999-09-13 17:44:20 +02:00
|
|
|
atm_pass1_done=YES
|
1998-10-06 21:24:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Finish up configuration.
|
|
|
|
# N.B. /usr is not mounted.
|
|
|
|
#
|
|
|
|
atm_pass2() {
|
2000-12-17 09:16:06 +01:00
|
|
|
echo -n 'Configuring ATM network interfaces:'
|
1999-09-13 17:44:20 +02:00
|
|
|
|
|
|
|
atm_scspd=0
|
|
|
|
atm_atmarpd=""
|
|
|
|
|
|
|
|
# Configure network interfaces
|
|
|
|
for phy in ${atm_phy}; do
|
|
|
|
eval netif_args=\$atm_netif_${phy}
|
|
|
|
set -- ${netif_args}
|
|
|
|
netname=$1
|
|
|
|
netcnt=$2
|
|
|
|
netindx=0
|
|
|
|
while [ ${netindx} -lt ${netcnt} ]; do
|
|
|
|
net="${netname}${netindx}"
|
|
|
|
netindx=`expr ${netindx} + 1`
|
|
|
|
echo -n " ${net}"
|
|
|
|
|
|
|
|
# Configure atmarp server
|
|
|
|
eval atmarp_args=\$atm_arpserver_${net}
|
|
|
|
if [ -n "${atmarp_args}" ]; then
|
|
|
|
atm set arpserver ${net} ${atmarp_args} ||
|
|
|
|
continue
|
1998-10-06 21:24:31 +02:00
|
|
|
fi
|
1999-09-13 17:44:20 +02:00
|
|
|
eval scsparp_args=\$atm_scsparp_${net}
|
|
|
|
|
|
|
|
case ${scsparp_args} in
|
|
|
|
[Yy][Ee][Ss])
|
|
|
|
case ${atmarp_args} in
|
|
|
|
local)
|
|
|
|
;;
|
|
|
|
*)
|
2000-12-17 09:16:06 +01:00
|
|
|
echo ' local arpserver required for SCSP'
|
1999-09-13 17:44:20 +02:00
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
atm_atmarpd="${atm_atmarpd} ${net}"
|
|
|
|
atm_scspd=1
|
|
|
|
esac
|
|
|
|
done
|
1998-10-06 21:24:31 +02:00
|
|
|
done
|
2000-12-17 09:16:06 +01:00
|
|
|
echo '.'
|
1998-10-06 21:24:31 +02:00
|
|
|
|
1999-09-13 17:44:20 +02:00
|
|
|
# Define any PVCs.
|
|
|
|
if [ -n "${atm_pvcs}" ]; then
|
|
|
|
for i in ${atm_pvcs}; do
|
|
|
|
eval pvc_args=\$atm_pvc_${i}
|
|
|
|
atm add pvc ${pvc_args}
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Define any permanent ARP entries.
|
|
|
|
if [ -n "${atm_arps}" ]; then
|
|
|
|
for i in ${atm_arps}; do
|
|
|
|
eval arp_args=\$atm_arp_${i}
|
|
|
|
atm add arp ${arp_args}
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
atm_pass2_done=YES
|
1998-10-06 21:24:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Start any necessary daemons.
|
|
|
|
#
|
|
|
|
atm_pass3() {
|
1999-09-13 17:44:20 +02:00
|
|
|
# Start SCSP daemon (if needed)
|
|
|
|
case ${atm_scspd} in
|
|
|
|
1)
|
2000-12-17 09:16:06 +01:00
|
|
|
echo -n ' scspd'
|
1999-09-13 17:44:20 +02:00
|
|
|
scspd
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Start ATMARP daemon (if needed)
|
|
|
|
if [ -n "${atm_atmarpd}" ]; then
|
2000-12-17 09:16:06 +01:00
|
|
|
echo -n ' atmarpd'
|
1999-09-13 17:44:20 +02:00
|
|
|
atmarpd ${atm_atmarpd}
|
|
|
|
fi
|
|
|
|
|
|
|
|
atm_pass3_done=YES
|
1998-10-06 21:24:31 +02:00
|
|
|
}
|