summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/atm2
blob: 7e72aebd1bbda696a8ee0fa080a4db67ddd9c013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/bin/sh
#

# ATM networking startup script
#
# $FreeBSD$

#
# Initial interface configuration.
# N.B. /usr is not mounted.
#
atm_pass1() {
	# 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`

	if [ -z "${atmdev}" ]; then
		echo "No ATM adapters found."
		return 0
	fi

	# Load microcode into FORE adapters (if needed)
	if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
		fore_dnld -d /etc
	fi

	# 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
			echo "missing network interface definition"
			continue
		fi

		# 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
		else
			echo "missing signalling manager definition"
			continue
		fi

		# 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
				echo "missing NSAP prefix for UNI interface"
				continue
			fi

			case ${prefix_args} in
			ILMI)
				ilmid=1
				;;
			*)
				atm set prefix ${phy} ${prefix_args} || continue
				;;
			esac
		fi

		atm_phy="${atm_phy} ${phy}"
		echo "."
	done

	echo -n "Starting initial ATM daemons:"
	# Start ILMI daemon (if needed)
	case ${ilmid} in
	1)
		echo -n " ilmid"
		ilmid
		;;
	esac

	echo "."
	atm_pass1_done=YES
}

#
# Finish up configuration.
# N.B. /usr is not mounted.
#
atm_pass2() {
	echo -n "Configuring ATM network interfaces:"

	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
			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 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
}

#
# Start any necessary daemons.
#
atm_pass3() {
	# 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

	atm_pass3_done=YES
}
OpenPOWER on IntegriCloud