Bring RCNG in from 5.x and adjust config files and scripts accordingly.
[dragonfly.git] / etc / rc.d / atm1
CommitLineData
984263bc
MD
1#!/bin/sh
2#
3# Copyright (c) 2000 The FreeBSD Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
9c600e7d
MD
27# $FreeBSD: src/etc/rc.d/atm1,v 1.12 2003/04/18 17:55:05 mtm Exp $
28# $DragonFly: src/etc/rc.d/atm1,v 1.1 2003/07/24 06:35:37 dillon Exp $
984263bc
MD
29#
30
9c600e7d
MD
31# PROVIDE: atm1
32# REQUIRE: root
33# BEFORE: netif
34# KEYWORD: DragonFly FreeBSD
35
36. /etc/rc.subr
37
38name="atm"
39rcvar="atm_enable"
40start_cmd="atm_start"
41stop_cmd=":"
42
984263bc
MD
43# ATM networking startup script
44#
45# Initial interface configuration.
46# N.B. /usr is not mounted.
47#
9c600e7d
MD
48atm_start()
49{
984263bc
MD
50 # Locate all probed ATM adapters
51 atmdev=`atm sh stat int | while read dev junk; do
52 case ${dev} in
53 hea[0-9] | hea[0-9][0-9])
54 echo "${dev} "
55 ;;
56 hfa[0-9] | hfa[0-9][0-9])
57 echo "${dev} "
58 ;;
9c600e7d
MD
59 idt[0-9] | idt[0-9][0-9])
60 echo "${dev} "
61 ;;
984263bc
MD
62 *)
63 continue
64 ;;
65 esac
66 done`
67
68 if [ -z "${atmdev}" ]; then
69 echo 'No ATM adapters found'
70 return 0
71 fi
72
73 # Load microcode into FORE adapters (if needed)
74 if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
75 fore_dnld
76 fi
77
78 # Configure physical interfaces
79 ilmid=0
80 for phy in ${atmdev}; do
81 echo -n "Configuring ATM device ${phy}:"
82
83 # Define network interfaces
84 eval netif_args=\$atm_netif_${phy}
85 if [ -n "${netif_args}" ]; then
86 atm set netif ${phy} ${netif_args} || continue
87 else
88 echo ' missing network interface definition'
89 continue
90 fi
91
92 # Override physical MAC address
93 eval macaddr_args=\$atm_macaddr_${phy}
94 if [ -n "${macaddr_args}" ]; then
95 case ${macaddr_args} in
96 [Nn][Oo] | '')
97 ;;
98 *)
99 atm set mac ${phy} ${macaddr_args} || continue
100 ;;
101 esac
102 fi
103
104 # Configure signalling manager
105 eval sigmgr_args=\$atm_sigmgr_${phy}
106 if [ -n "${sigmgr_args}" ]; then
107 atm attach ${phy} ${sigmgr_args} || continue
108 else
109 echo ' missing signalling manager definition'
110 continue
111 fi
112
113 # Configure UNI NSAP prefix
114 eval prefix_args=\$atm_prefix_${phy}
115 if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
116 if [ -z "${prefix_args}" ]; then
117 echo ' missing NSAP prefix for UNI interface'
118 continue
119 fi
120
121 case ${prefix_args} in
122 ILMI)
123 ilmid=1
124 ;;
125 *)
126 atm set prefix ${phy} ${prefix_args} || continue
127 ;;
128 esac
129 fi
130
131 atm_phy="${atm_phy} ${phy}"
132 echo '.'
133 done
134
135 echo -n 'Starting initial ATM daemons:'
136 # Start ILMI daemon (if needed)
137 case ${ilmid} in
138 1)
139 echo -n ' ilmid'
140 ilmid
141 ;;
142 esac
143
144 echo '.'
984263bc
MD
145}
146
9c600e7d
MD
147load_rc_config $name
148run_rc_command "$1"