summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-07-28 13:30:42 +0000
committerharti <harti@FreeBSD.org>2003-07-28 13:30:42 +0000
commit33549ec7ad9964be49b9d2a7ea2fb73d188b8d14 (patch)
tree29b421aea59e200f6b87d1e1de470c13b1bd53c2 /etc/rc.d
parentdf37a5270c965c0d1d1461fce913ee30a095d353 (diff)
downloadFreeBSD-src-33549ec7ad9964be49b9d2a7ea2fb73d188b8d14.zip
FreeBSD-src-33549ec7ad9964be49b9d2a7ea2fb73d188b8d14.tar.gz
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)
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/Makefile2
-rw-r--r--etc/rc.d/atm129
-rw-r--r--etc/rc.d/atm257
-rw-r--r--etc/rc.d/atm2.sh104
-rw-r--r--etc/rc.d/atm345
-rw-r--r--etc/rc.d/atm3.sh68
6 files changed, 90 insertions, 215 deletions
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index 35ea920..bdfd83c 100755
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -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 \
diff --git a/etc/rc.d/atm1 b/etc/rc.d/atm1
index 5c4426a..01cd7c0 100644
--- a/etc/rc.d/atm1
+++ b/etc/rc.d/atm1
@@ -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
;;
diff --git a/etc/rc.d/atm2 b/etc/rc.d/atm2
index ad69f72..be1404f 100644
--- a/etc/rc.d/atm2
+++ b/etc/rc.d/atm2
@@ -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"
diff --git a/etc/rc.d/atm2.sh b/etc/rc.d/atm2.sh
deleted file mode 100644
index ad69f72..0000000
--- a/etc/rc.d/atm2.sh
+++ /dev/null
@@ -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
diff --git a/etc/rc.d/atm3 b/etc/rc.d/atm3
index 6cbb206..df4c98c 100644
--- a/etc/rc.d/atm3
+++ b/etc/rc.d/atm3
@@ -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"
diff --git a/etc/rc.d/atm3.sh b/etc/rc.d/atm3.sh
deleted file mode 100644
index 6cbb206..0000000
--- a/etc/rc.d/atm3.sh
+++ /dev/null
@@ -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
OpenPOWER on IntegriCloud