Convert the atm{2,3}.sh rc scripts to normal rc.d scripts. Add support

for the harp(4) pseudo driver and for loadable native HARP drivers
(like hfa_pci).

To use harp(4) the rc variable natm_interfaces must be set to the
list of NATM interfaces to be used for HARP. These interfaces
will be brought up with ifconfig and the harp(4) will be loaded.

To use loadable native HARP drivers atm_load must be set to
the list of drivers to load.

Reviewed by:	mtm, gordon (partly)
This commit is contained in:
harti 2003-07-28 13:30:42 +00:00
parent 82dc439c6c
commit b943fbe285
7 changed files with 110 additions and 215 deletions

View File

@ -4,7 +4,7 @@
.include <bsd.own.mk>
FILES= DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz amd \
apm apmd archdep atm1 atm2.sh atm3.sh bgfsck bootparams ccd cleanvar \
apm apmd archdep atm1 atm2 atm3 bgfsck bootparams ccd cleanvar \
cleartmp cron devd devfs dhclient diskless dmesg dumpon fsck \
hostname inetd initdiskless initrandom ip6fw ipfilter ipfs ipfw ipmon \
ipnat ipsec ipxrouted isdnd jail \

View File

@ -46,6 +46,21 @@ stop_cmd=":"
#
atm_start()
{
if [ -n "${natm_interfaces}" ] ; then
# Load the HARP pseudo interface
kldstat -v | grep -q if_harp || kldload if_harp
# 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
kldstat -v | grep -q ${dev} || kldload ${dev}
done
# Locate all probed ATM adapters
atmdev=`atm sh stat int | while read dev junk; do
case ${dev} in
@ -58,6 +73,20 @@ atm_start()
idt[0-9] | idt[0-9][0-9])
echo "${dev} "
;;
# 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} "
;;
*)
continue
;;

View File

@ -35,15 +35,37 @@
#
# Additional ATM interface configuration
#
. /etc/rc.subr
name="atm2"
rcvar="atm_enable"
start_cmd="atm2_start"
stop_cmd=":"
atm2_start()
{
# Configure network interfaces
# get a list of physical interfaces
atm_phy=`atm show stat int | { read junk ; read junk ; \
while read dev junk ; do
case ${dev} in
en[0-9] | en[0-9][0-9])
;;
*)
echo "${dev} "
;;
esac
done ; }`
for phy in ${atm_phy}; do
eval netif_args=\$atm_netif_${phy}
set -- ${netif_args}
# skip unused physical interfaces
if [ $# -lt 2 ] ; then
continue
fi
netname=$1
netcnt=$2
netindx=0
@ -58,23 +80,6 @@ atm2_start()
atm set arpserver ${net} ${atmarp_args} ||
continue
fi
eval scsparp_args=\$atm_scsparp_${net}
case ${scsparp_args} in
[Yy][Ee][Ss])
case ${atmarp_args} in
local)
;;
*)
echo ' local arpserver required for SCSP'
continue
;;
esac
atm_atmarpd="${atm_atmarpd} ${net}"
atm_scspd=1
;;
esac
done
done
echo '.'
@ -86,19 +91,7 @@ atm2_start()
atm add arp ${arp_args}
done
fi
# XXX - required by atm3.sh. I don't like having one script depend
# on variables in another script (especially in a dynamic
# ordered system like this), but it's necessary for the moment.
#
export atm_atmarpd
export atm_scspd
}
load_rc_config "XXX"
case ${atm_enable} in
[Yy][Ee][Ss])
atm2_start
;;
esac
load_rc_config $name
run_rc_command "$1"

View File

@ -1,104 +0,0 @@
#!/bin/sh
#
# 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.
#
# $FreeBSD$
#
# PROVIDE: atm2
# REQUIRE: atm1 netif
# BEFORE: routing
# KEYWORD: FreeBSD
#
# Additional ATM interface configuration
#
. /etc/rc.subr
atm2_start()
{
# 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=$((${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
fi
eval scsparp_args=\$atm_scsparp_${net}
case ${scsparp_args} in
[Yy][Ee][Ss])
case ${atmarp_args} in
local)
;;
*)
echo ' local arpserver required for SCSP'
continue
;;
esac
atm_atmarpd="${atm_atmarpd} ${net}"
atm_scspd=1
;;
esac
done
done
echo '.'
# 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
# XXX - required by atm3.sh. I don't like having one script depend
# on variables in another script (especially in a dynamic
# ordered system like this), but it's necessary for the moment.
#
export atm_atmarpd
export atm_scspd
}
load_rc_config "XXX"
case ${atm_enable} in
[Yy][Ee][Ss])
atm2_start
;;
esac

View File

@ -28,9 +28,6 @@
#
# Start ATM daemons
# XXX - This script uses global variables set by scripts atm1 and atm2.
# Ideally this shouldn't be the case.
#
# PROVIDE: atm3
# REQUIRE: atm2
@ -39,10 +36,43 @@
. /etc/rc.subr
name="atm3"
rcvar="atm_enable"
start_cmd="atm3_start"
stop_cmd=":"
atm3_start()
{
echo -n 'Starting ATM daemons:'
# Get a list of network interfaces
atm_nif=`atm sh netif | { read junk ; \
while read dev junk ; do
echo "${dev} "
done
}`
for net in ${atm_nif} ; do
eval atmarp_args=\$atm_arpserver_${net}
eval scsparp_args=\$atm_scsparp_${net}
case ${scsparp_args} in
[Yy][Ee][Ss])
case ${atmarp_args} in
local)
;;
*)
warn "${net}: local arpserver required for SCSP"
continue
;;
esac
atm_atmarpd="${atm_atmarpd} ${net}"
atm_scspd=1
;;
esac
done
# Start SCSP daemon (if needed)
case ${atm_scspd} in
1)
@ -59,10 +89,5 @@ atm3_start()
echo '.'
}
load_rc_config "XXX"
case ${atm_enable} in
[Yy][Ee][Ss])
atm3_start
;;
esac
load_rc_config $name
run_rc_command "$1"

View File

@ -1,68 +0,0 @@
#!/bin/sh
#
# 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.
#
# $FreeBSD$
#
# Start ATM daemons
# XXX - This script uses global variables set by scripts atm1 and atm2.
# Ideally this shouldn't be the case.
#
# PROVIDE: atm3
# REQUIRE: atm2
# BEFORE: DAEMON
# KEYWORD: FreeBSD
. /etc/rc.subr
atm3_start()
{
echo -n 'Starting ATM daemons:'
# Start SCSP daemon (if needed)
case ${atm_scspd} in
1)
echo -n ' scspd'
scspd
;;
esac
# Start ATMARP daemon (if needed)
if [ -n "${atm_atmarpd}" ]; then
echo -n ' atmarpd'
atmarpd ${atm_atmarpd}
fi
echo '.'
}
load_rc_config "XXX"
case ${atm_enable} in
[Yy][Ee][Ss])
atm3_start
;;
esac

View File

@ -1794,6 +1794,12 @@ man page for further details on the available command parameters.
Also refer to the files in
.Pa /usr/share/examples/atm
for more detailed configuration information.
.It Va atm_load
.Pq Vt str
This is a list of physical ATM interface drivers to load. Typical values are
.Dq Li hfa_pci
and/or
.Dq Li hea_pci .
.It Va atm_netif_ Ns Aq Ar intf
.Pq Vt str
For the ATM physical interface
@ -1892,6 +1898,20 @@ The value of each of these variables
will be passed as the parameters of an
.Dq Nm atm Cm "add arp"
command.
.It Va natm_interfaces
.Pq Vt str
Set to the list of
.Xr natm 4
interfaces that will also be used for HARP through
.Xr harp 4 .
If this list is not empty all interfaces in the list will be brought up
with
.Xr ifconfig 9
and
.Xr harp 4
will be loaded.
For this to work the interface drivers must be either compiled into the
kernel or must reside on the root partition.
.It Va keybell
.Pq Vt str
The keyboard bell sound.