summaryrefslogtreecommitdiff
blob: 2df3e9226dc8ec7a84cb628d6e687656310b7cf4 (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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
diff -aurN rc-scripts-1.4.2.9/etc/conf.d/net rc-scripts-1.4.2.9-latexer/etc/conf.d/net
--- rc-scripts-1.4.2.9/etc/conf.d/net	2002-11-18 14:39:22.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/etc/conf.d/net	2003-06-20 12:37:48.000000000 -0400
@@ -8,12 +8,26 @@
 iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
 #iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"
 
+# Network settings for the IPv6 attributes of the $iface
+#iface6_eth0="3ffe:aaaa:bbbb::2"
+
 # For DHCP set iface_eth? to "dhcp"
 # For passing options to dhcpcd use dhcpcd_eth?
 #
 #iface_eth0="dhcp"
 #dhcpcd_eth0="..."
 
+# For DHCPv6 set iface6_eth? to "dhcp"
+# For passing options to dhcp6c use dhcp6c_eth?
+#
+#iface6_eth0="dhcp"
+#dhcp6c_eth0="..."
+
+# For using Router Advertisment and radvd 
+# set iface6_eth? to "auto"
+#
+#iface6_eth0="auto"
+
 # For adding aliases to a interface
 #
 #alias_eth0="192.168.0.3 192.168.0.4"
@@ -32,3 +46,6 @@
 #
 #gateway="eth0/192.168.0.1"
 
+# For setting the default IPv6 gateway
+#
+#gateway6="eth0/3ffe:aaaa:bbbb::1"
diff -aurN rc-scripts-1.4.2.9/init.d/iface.eth0 rc-scripts-1.4.2.9-latexer/init.d/iface.eth0
--- rc-scripts-1.4.2.9/init.d/iface.eth0	1969-12-31 19:00:00.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/init.d/iface.eth0	2003-06-20 12:06:03.000000000 -0400
@@ -0,0 +1,86 @@
+#!/sbin/runscript
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo/users/latexer/ipv6-rc-scripts/rc-scripts-1.4.2.9-latexer-patch.diff,v 1.2 2003/06/20 20:53:49 latexer Exp $
+
+#NB: Config is in /etc/conf.d/net
+
+# For pcmcia users. note that pcmcia must be added to the same
+# runlevel as the net/iface.* script that needs it.
+depend() {
+	use pcmcia
+}
+
+check_tunnel_config() {
+	if [ -z "$(eval echo \$\{tunnel_${IFACE}\})" ]
+	then
+		eerror "Please make sure that /etc/conf.d/net has \$tunnel_$IFACE set"
+		return 1
+	fi
+}
+
+start() {
+	# bring our device up, and if there's more to do
+	# (tunnel, ppp, etc), do it.
+
+	ebegin "Bringing ${IFACE} up"
+	/sbin/ifconfig ${IFACE} up &> /dev/null || {
+		retval=$?
+		eend ${retval} "Failed to bring ${IFACE} up"
+		return ${retval}
+	}
+	# ifconfig do not always return failure ..
+	/sbin/ifconfig ${IFACE} &> /dev/null || {
+		retval=$?
+		eend ${retval} "Failed to bring ${IFACE} up"
+		return ${retval}
+	}
+	
+	if [[ "${IFACE}" == "sit*" ]]
+	then
+		#if it's a tunnel interface, figure out what to bridge to
+		check_tunnel_config || return 1
+		local endpoint="$(eval echo \$\{tunnel_${IFACE}\})"
+		/sbin/ifconfig sit0 tunnel ${endpoint} || {
+			retval=$?
+			eend ${retval} "Failed to establish a tunnel for ${IFACE}"
+			return ${retval}
+		}
+		save_options "tunnel" "$(eval echo \$\{tunnel_${IFACE}\})"
+		
+	elif [[ "${IFACE}" == "ppp*" ]]
+		#do some ppp stuff. someone help me with this? please?
+		eend "I don't know ppp stuff. please fix me"
+		return 1
+	fi
+
+	# Enabling rp_filter causes wacky packets to be auto-dropped by
+	# the kernel
+	if [ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter ]
+	then
+		echo 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
+	fi
+
+	eend 0
+}
+
+stop() {
+	ebegin "Bringing ${IFACE} down"
+	if [[ "${IFACE}" == "sit*" ]]
+	then
+		local mytunnel="$(get_options tunnel)"
+		if [ -n "${mytunnel}" ]
+		then
+			ebegin "Removing the tunnel on ${IFACE}"
+			/sbin/ifconfig sit0 del ${mytunnel} &> /dev/null
+			eend 0
+		fi
+	elif [[ "${IFACE}" == "ppp*" ]]
+	then
+		eerror "fix me. i hate ppp"
+	fi
+		ifconfig ${IFACE} down &> /dev/null
+	eend 0
+}
+
+# vim:ts=4
diff -aurN rc-scripts-1.4.2.9/init.d/net.eth0 rc-scripts-1.4.2.9-latexer/init.d/net.eth0
--- rc-scripts-1.4.2.9/init.d/net.eth0	2002-11-26 18:12:40.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/init.d/net.eth0	2003-06-20 12:33:13.000000000 -0400
@@ -5,11 +5,10 @@
 
 #NB: Config is in /etc/conf.d/net
 
-
-# For pcmcia users. note that pcmcia must be added to the same
-# runlevel as the net.* script that needs it.
 depend() {
-	use pcmcia
+	# have to figure out how to use the below instead of hard coding
+	#need iface.${IFACE}
+	need iface.eth1
 }
 
 checkconfig() {
@@ -79,19 +78,6 @@
 		save_options "alias" "$(eval echo \$\{alias_${IFACE}\})"
 	fi
 
-	if [ -n "$(eval echo \$\{inet6_${IFACE}\})" ]
-	then
-		local x=""
-		ebegin "  Adding inet6 addresses"
-		for x in $(eval echo \$\{inet6_${IFACE}\})
-		do
-			ebegin "    ${IFACE} inet6 add ${x}"
-			/sbin/ifconfig ${IFACE} inet6 add ${x} >/dev/null
-			eend 0
-		done
-		save_options "inet6" "$(eval echo \$\{inet6_${IFACE}\})"
-	fi
-	
 	if [ -n "${gateway}" ] && [ "${gateway%/*}" = "${IFACE}" ]
 	then
 		ebegin "  Setting default gateway"
@@ -99,37 +85,18 @@
 			netmask 0.0.0.0 metric 1 >/dev/null || {
 			
 			local error=$?
-			ifconfig ${IFACE} down &>/dev/null
 			eend ${error} "Failed to bring ${IFACE} up"
 			stop
 			return ${error}
 		}
 		eend 0
 	fi
-
-	# Enabling rp_filter causes wacky packets to be auto-dropped by
-	# the kernel
-	if [ -e /proc/sys/net/ipv4/conf/${IFACE}/rp_filter ]
-	then
-		echo 1 > /proc/sys/net/ipv4/conf/${IFACE}/rp_filter
-	fi
 }
 
 stop() {
 	local myalias="$(get_options alias)"
 	ebegin "Bringing ${IFACE} down"
 
-	# Also down the inet6 interfaces
-	local myinet6="$(get_options inet6)"
-	if [ -n "${myinet6}" ]
-	then
-		local x=""
-		for x in ${myinet6}
-		do
-			/sbin/ifconfig ${IFACE} inet6 del ${x} >/dev/null
-		done
-	fi
-	
 	# Do some cleanup in case the amount of aliases change
 	if [ -n "${myalias}" ]
 	then
@@ -156,8 +123,6 @@
 			count=$((count + 1))
 		done
 		echo "done"
-	else
-		/sbin/ifconfig ${IFACE} down >/dev/null
 	fi
 	eend 0
 }
diff -aurN rc-scripts-1.4.2.9/init.d/net6.eth0 rc-scripts-1.4.2.9-latexer/init.d/net6.eth0
--- rc-scripts-1.4.2.9/init.d/net6.eth0	1969-12-31 19:00:00.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/init.d/net6.eth0	2003-06-20 16:57:09.000000000 -0400
@@ -0,0 +1,95 @@
+#!/sbin/runscript
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo/users/latexer/ipv6-rc-scripts/rc-scripts-1.4.2.9-latexer-patch.diff,v 1.2 2003/06/20 20:53:49 latexer Exp $
+
+#NB: Config is in /etc/conf.d/net
+
+
+depend() {
+	# Have to figure out how to use the below instead of hard coding
+	#need iface.${IFACE}
+	need iface.eth0
+}
+
+checkconfig() {
+	if [ -z "$(eval echo \$\{iface6_${IFACE}\})" ]
+	then
+		eerror "Please make sure that /etc/conf.d/net has \$iface6_$IFACE set"
+		return 1
+	fi
+
+	if [ "$(eval echo \$\{inet6_${IFACE}\})" = "dhcp" ] && [ ! -f /etc/dhcp6c.conf ]
+	then
+		eerror "/etc/dhcp6c.conf does not exist"
+		return 1
+	fi
+}
+
+start() {
+	checkconfig || return 1
+	local iface6_args="$(eval echo \$\{iface6_${IFACE}\})"
+	local dhcp6_args="$(eval echo \$\{dhcp6c_${IFACE}\})"
+	local retval=0
+	ebegin "Bringing ${IFACE} up"
+	if [ "$(eval echo \$\{inet6_${IFACE}\})" = "dhcp" ]
+	then
+		/usr/sbin/dhcp6c ${dhcp6_args} ${IFACE} >/dev/null || {
+			retval=$?
+			eend ${retval} "Failed to bring ${IFACE} up"
+			return ${retval}
+		}
+	elif [ "$(eval echo \$\{iface6_${IFACE}\})" != "auto" ]
+	then
+		local x=""
+		ebegin "Adding inet6 addresses"
+		for x in $(eval echo \$\{inet6_${IFACE}\})
+		do
+			ebegin "    ${IFACE} inet6 add ${x}"
+			/sbin/ifconfig ${IFACE} inet6 add ${x} >/dev/null
+			eend 0
+		done
+		ebegin "Setting the default IPv6 gateway"
+		/sbin/route -A inet6 add ::/0 gw ${gateway6#*/} \
+				dev ${gateway6%/*} || {
+					local error=$?
+					eerror ${error} "Failed to set a default gateway"
+					stop
+					return ${error}
+		}
+		save_options "inet6" "$(eval echo \$\{inet6_${IFACE}\})"
+	fi
+	eend 0
+}
+
+stop() {
+	local myalias="$(get_options alias)"
+	ebegin "Bringing ${IFACE} down"
+
+	# Also down the inet6 interfaces
+	local myinet6="$(get_options inet6)"
+	if [ -n "${myinet6}" ]
+	then
+		/sbin/ifconfig ${IFACE} inet6 del ${myinet6} >/dev/null
+	fi
+
+	if [ "$(eval echo \$\{iface_${IFACE}\})" = "dhcp" ]
+	then
+		/sbin/dhcp6c -r all ${IFACE} &>/dev/null
+	
+		# Give dhcpcd time to properly shutdown
+		local count=0
+		einfon "  Waiting for dhcpcd to shutdown"
+		while [ "${count}" -lt 3 ]
+		do
+			echo -n "."
+			sleep 1
+			count=$((count + 1))
+		done
+		echo "done"
+	fi
+	eend 0
+}
+
+
+# vim:ts=4
diff -aurN rc-scripts-1.4.2.9/sbin/depscan.sh.bash rc-scripts-1.4.2.9-latexer/sbin/depscan.sh.bash
--- rc-scripts-1.4.2.9/sbin/depscan.sh.bash	2002-11-18 14:06:59.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/sbin/depscan.sh.bash	2003-06-20 00:06:42.000000000 -0400
@@ -43,7 +43,7 @@
 			#other type of interest is 'pretend' which *should* add
 			#invalid database entries (no virtual depend should ever
 			#actually have a matching rc-script).
-			if [ "${mytype}" = "need" -a "${x}" != "net" -a \
+			if [ "${mytype}" = "need" -a "${x}" != "net" -a "${x}" != "net6" -a \
 			     ! -d ${svcdir}/provide/${x} ]
 			then
 				ewarn "NEED:  can't find service \"${x}\" needed by \"${myservice}\";"
@@ -59,7 +59,7 @@
 					touch ${svcdir}/broken/${myservice}/${x}
 				fi
 				continue
-			elif [ "${mytype}" != "provide" -a "${x}" != "net" -a \
+			elif [ "${mytype}" != "provide" -a "${x}" != "net" -a "${x} != "net6" -a \
 			       ! -d ${svcdir}/provide/${x} ]
 			then
 				continue
@@ -306,7 +306,7 @@
 	do
 		counter=$((counter + 1))
 	done
-	if [ "${counter}" -gt 1 -a "${x##*/}" != "net" ]
+	if [ "${counter}" -gt 1 -a "${x##*/}" != "net" -a "${x##*/}" != "net6" ]
 	then
 		dblprovide="yes"
 		errstr="${x##*/}"
diff -aurN rc-scripts-1.4.2.9/sbin/rc-help.sh rc-scripts-1.4.2.9-latexer/sbin/rc-help.sh
--- rc-scripts-1.4.2.9/sbin/rc-help.sh	2002-11-18 14:07:00.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/sbin/rc-help.sh	2003-06-20 00:03:37.000000000 -0400
@@ -55,7 +55,7 @@
 cat <<EOHELP
       Same as 'stop', but the services that depends on it, will not be
       stopped.  This is usefull for stopping a network interface without
-      stopping all the network services that depend on 'net'.
+      stopping all the network services that depend on 'net' or 'net6'.
 	
 EOHELP
 echo -e "    ${GREEN}zap${OFF}"
diff -aurN rc-scripts-1.4.2.9/sbin/runscript.sh rc-scripts-1.4.2.9-latexer/sbin/runscript.sh
--- rc-scripts-1.4.2.9/sbin/runscript.sh	2003-01-06 14:01:54.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/sbin/runscript.sh	2003-06-20 00:01:31.000000000 -0400
@@ -23,20 +23,31 @@
 mylevel="$(cat "${svcdir}/softlevel")"
 
 
-# Set $IFACE to the name of the network interface if it is a 'net.*' script
+# Set $IFACE to the name of the network interface if it is a 'net.*', 'net6.*', or 'iface.*'script
 IFACE=""
 NETSERVICE=""
+NET6SERVICE=""
 if [ "${myservice%%.*}" = "net" -a "${myservice##*.}" != "${myservice}" ]
 then
 	IFACE="${myservice##*.}"
 	NETSERVICE="yes"
 fi
+if [ "${myservice%%.*}" = "net6" -a "${myservice##*.}" != "${myservice}" ]
+then
+	IFACE="${myservice##*.}"
+	NET6SERVICE="yes"
+fi
+if [ "${myservice%%.*}" = "iface" -a "${myservice##*.}" != "${myservice}" ]
+then
+	IFACE="${myservice##*.}"
+fi
+
 		
 # Source configuration files.
 # (1) Source /etc/conf.d/basic to get common configuration.
 # (2) Source /etc/conf.d/${myservice} to get initscript-specific
 #     configuration (if it exists).
-# (3) Source /etc/conf.d/net if it is a net.* service
+# (3) Source /etc/conf.d/net if it is a net.*, net6.*, or iface.* service
 # (4) Source /etc/rc.conf to pick up potentially overriding
 #     configuration, if the system administrator chose to put it
 #     there (if it exists).
@@ -49,6 +60,10 @@
 [ "${myservice%%.*}" = "net" ]            && \
 [ "${myservice##*.}" != "${myservice}" ]  && source /etc/conf.d/net
 
+[ -e /etc/conf.d/net ]                    && \
+[ "${myservice%%.*}" = "net6" ]            && \
+[ "${myservice##*.}" != "${myservice}" ]  && source /etc/conf.d/net
+
 [ -e /etc/rc.conf ]                       && source /etc/rc.conf
 
 usage() {
@@ -123,6 +138,24 @@
 		fi
 		
 		mydeps="${mydeps} ${myservice}"
+	elif [ "${NET6SERVICE}" = "yes" ]
+	then
+		# A net6.* service
+		if [ -L "/etc/runlevels/boot/${myservice}" -o \
+		     -L "/etc/runlevels/${mylevel}/${myservice}" ]
+		then
+			local netcount="$(ls -1 "${svcdir}"/started/net6.* 2> /dev/null | \
+				grep -v 'net\.lo' | egrep -c "\/net\.[[:alnum:]]+$")"
+
+			# Only worry about net6.* services if this is the last one running,
+			# or if RC_NET_STRICT_CHECKING is set ...
+			if [ "${netcount}" -lt "1" -o "${RC_NET_STRICT_CHECKING}" = "yes" ]
+			then
+				mydeps="net6"
+			fi
+		fi
+		
+		mydeps="${mydeps} ${myservice}"
 	else
 		mydeps="${myservice}"
 	fi
@@ -268,6 +301,35 @@
 						fi
 					fi
 				done
+			elif [ "${x}" = "net6" ]
+			then
+				local netservlist="$(dolisting "/etc/runlevels/boot/net6.*") \
+					$(dolisting "/etc/runlevels/${mylevel}/net6.*")"
+					
+				for y in ${netservlist}
+				do
+					myserv="${y##*/}"
+					if [ ! -L "${svcdir}/started/${myserv}" ]
+					then
+						/etc/init.d/"${myserv}" start
+
+						# A 'need' dependancy is critical for startup
+						if [ "$?" -ne "0" -a -L "${svcdir}/need/${x}/${myservice}" ]
+						then
+							local netcount="$(ls -1 ${svcdir}/started/net6.* 2> /dev/null | \
+								egrep -c "\/net6\.[[:alnum:]]+$")"
+								#grep -v 'net6\.lo' | egrep -c "\/net6\.[[:alnum:]]+$")"
+						
+							# Only worry about a net.* service if we do not have
+							# one up and running already, or if
+							# RC_NET_SCTRICT_CHECKING is set ....
+							if [ "${netcount}" -lt "1" -o "${RC_NET_STRICT_CHECKING}" = "yes" ]
+							then
+								startfail="yes"
+							fi
+						fi
+					fi
+				done
 			else
 				if [ ! -L "${svcdir}/started/${x}" ]
 				then
diff -aurN rc-scripts-1.4.2.9/src/awk/gendepends.awk rc-scripts-1.4.2.9-latexer/src/awk/gendepends.awk
--- rc-scripts-1.4.2.9/src/awk/gendepends.awk	2003-01-02 17:20:02.000000000 -0500
+++ rc-scripts-1.4.2.9-latexer/src/awk/gendepends.awk	2003-06-20 10:20:48.000000000 -0400
@@ -152,7 +152,9 @@
 		# actually have a matching rc-script).
 		if (!check_service(deparray[x])) {
 			
-			if ((type == NEED) && (deparray[x] != "net") && 
+			if ((type == NEED) &&
+			    (deparray[x] != "net") &&
+			    (deparray[x] != "net6") && 
 			    (!isdir(SVCDIR "/provide/" deparray[x]))) {
 
 				ewarn("NEED:  can't find service \"" deparray[x] "\" needed by \"" service "\";")
@@ -168,7 +170,9 @@
 
 				continue
 			}
-			else if ((type != PROVIDE) && (deparray[x] != "net") &&
+			else if ((type != PROVIDE) &&
+				 (deparray[x] != "net") &&
+				 (deparray[x] != "net6") &&
 			         (!isdir(SVCDIR "/provide/" deparray[x])))
 				continue
 		}
@@ -305,7 +309,9 @@
 				for (i in tmpprovidesplit)
 					counter++
 
-				if ((counter > 1) && (providesplit[y] != "net")) {
+				if ((counter > 1) &&
+				    (providesplit[y] != "net") &&
+				    (providesplit[y] != "net6")) {
 
 					dblprovide = 1
 					errstring = providesplit[y]