1998-10-06 19:24:31 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2000-10-08 19:20:36 +00: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 19:24:31 +00:00
|
|
|
#
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
2000-10-08 19:20:36 +00:00
|
|
|
#
|
1998-10-06 19:24:31 +00:00
|
|
|
|
2002-07-18 05:00:17 +00:00
|
|
|
# PROVIDE: atm1
|
|
|
|
# REQUIRE: root
|
2003-04-18 17:55:05 +00:00
|
|
|
# BEFORE: netif
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2002-07-18 05:00:17 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="atm"
|
|
|
|
rcvar="atm_enable"
|
|
|
|
start_cmd="atm_start"
|
|
|
|
stop_cmd=":"
|
|
|
|
|
2000-10-08 19:20:36 +00:00
|
|
|
# ATM networking startup script
|
1998-10-06 19:24:31 +00:00
|
|
|
#
|
|
|
|
# Initial interface configuration.
|
|
|
|
# N.B. /usr is not mounted.
|
|
|
|
#
|
2002-09-30 08:01:43 +00:00
|
|
|
atm_start()
|
2002-07-18 05:00:17 +00:00
|
|
|
{
|
2003-07-28 13:30:42 +00:00
|
|
|
if [ -n "${natm_interfaces}" ] ; then
|
|
|
|
# Load the HARP pseudo interface
|
2006-12-31 10:37:18 +00:00
|
|
|
load_kld if_harp || return 1
|
2003-07-28 13:30:42 +00:00
|
|
|
|
|
|
|
# Load all the NATM drivers that we need
|
|
|
|
for natm in ${natm_interfaces} ; do
|
|
|
|
ifconfig ${natm} up
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Load loadable HARP drivers
|
|
|
|
for dev in ${atm_load} ; do
|
2006-12-31 10:37:18 +00:00
|
|
|
load_kld ${dev} || return 1
|
2003-07-28 13:30:42 +00:00
|
|
|
done
|
|
|
|
|
1999-09-13 15:44:20 +00: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} "
|
|
|
|
;;
|
2002-09-30 08:01:43 +00:00
|
|
|
idt[0-9] | idt[0-9][0-9])
|
|
|
|
echo "${dev} "
|
|
|
|
;;
|
2003-07-28 13:30:42 +00:00
|
|
|
|
|
|
|
# NATM interfaces per pseudo driver
|
|
|
|
en[0-9] | en[0-9][0-9])
|
|
|
|
echo "${dev} "
|
|
|
|
;;
|
|
|
|
fatm[0-9] | fatm[0-9][0-9])
|
|
|
|
echo "${dev} "
|
|
|
|
;;
|
|
|
|
hatm[0-9] | hatm[0-9][0-9])
|
|
|
|
echo "${dev} "
|
|
|
|
;;
|
|
|
|
patm[0-9] | patm[0-9][0-9])
|
|
|
|
echo "${dev} "
|
|
|
|
;;
|
1999-09-13 15:44:20 +00:00
|
|
|
*)
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done`
|
1998-10-06 19:24:31 +00:00
|
|
|
|
1999-09-13 15:44:20 +00:00
|
|
|
if [ -z "${atmdev}" ]; then
|
2000-12-17 08:16:06 +00:00
|
|
|
echo 'No ATM adapters found'
|
1999-09-13 15:44:20 +00:00
|
|
|
return 0
|
1998-10-06 19:24:31 +00:00
|
|
|
fi
|
|
|
|
|
1999-09-13 15:44:20 +00:00
|
|
|
# Load microcode into FORE adapters (if needed)
|
|
|
|
if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
|
2000-02-15 13:21:43 +00:00
|
|
|
fore_dnld
|
1998-10-06 19:24:31 +00:00
|
|
|
fi
|
|
|
|
|
1999-09-13 15:44:20 +00: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 08:16:06 +00:00
|
|
|
echo ' missing network interface definition'
|
1998-10-06 19:24:31 +00:00
|
|
|
continue
|
|
|
|
fi
|
1999-09-13 15:44:20 +00: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 19:24:31 +00:00
|
|
|
else
|
2000-12-17 08:16:06 +00:00
|
|
|
echo ' missing signalling manager definition'
|
1999-09-13 15:44:20 +00:00
|
|
|
continue
|
1998-10-06 19:24:31 +00:00
|
|
|
fi
|
|
|
|
|
1999-09-13 15:44:20 +00: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 08:16:06 +00:00
|
|
|
echo ' missing NSAP prefix for UNI interface'
|
1999-09-13 15:44:20 +00:00
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
case ${prefix_args} in
|
|
|
|
ILMI)
|
|
|
|
ilmid=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
atm set prefix ${phy} ${prefix_args} || continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
1998-10-06 19:24:31 +00:00
|
|
|
|
1999-09-13 15:44:20 +00:00
|
|
|
atm_phy="${atm_phy} ${phy}"
|
2000-12-17 08:16:06 +00:00
|
|
|
echo '.'
|
1999-09-13 15:44:20 +00:00
|
|
|
done
|
1998-10-06 19:24:31 +00:00
|
|
|
|
2000-12-17 08:16:06 +00:00
|
|
|
echo -n 'Starting initial ATM daemons:'
|
1999-09-13 15:44:20 +00:00
|
|
|
# Start ILMI daemon (if needed)
|
|
|
|
case ${ilmid} in
|
|
|
|
1)
|
2000-12-17 08:16:06 +00:00
|
|
|
echo -n ' ilmid'
|
1999-09-13 15:44:20 +00:00
|
|
|
ilmid
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2000-12-17 08:16:06 +00:00
|
|
|
echo '.'
|
1998-10-06 19:24:31 +00:00
|
|
|
}
|
|
|
|
|
2002-07-18 05:00:17 +00:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|