1 |
commit: acf77b73afb8011a903d5ac88f6d6dcaf7b77a2f |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Dec 27 01:07:41 2011 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 27 01:08:27 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=acf77b73 |
7 |
|
8 |
net/ip6to4: Split to use pre_start and start so that other tunnel names work. |
9 |
|
10 |
We need to create interfaces of custom names before we can sucessfully |
11 |
start them. To do this, we have to add tunnels during prestart instead |
12 |
of start. Split up the ip6to4 script to do this, saving the computed |
13 |
variables for use in start with the new service data commands. |
14 |
|
15 |
X-Gentoo-Bug: 372575 |
16 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=372575 |
17 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
18 |
|
19 |
--- |
20 |
net/ip6to4.sh | 28 ++++++++++++++++++++++------ |
21 |
1 files changed, 22 insertions(+), 6 deletions(-) |
22 |
|
23 |
diff --git a/net/ip6to4.sh b/net/ip6to4.sh |
24 |
index 5569dee..959a2a0 100644 |
25 |
--- a/net/ip6to4.sh |
26 |
+++ b/net/ip6to4.sh |
27 |
@@ -8,8 +8,15 @@ ip6to4_depend() |
28 |
after interface |
29 |
} |
30 |
|
31 |
-ip6to4_start() |
32 |
+ip6to4_pre_start() |
33 |
{ |
34 |
+ # ALL interfaces run pre_start blocks, not just those with something |
35 |
+ # assigned, so we must check if we need to run on this interface before we |
36 |
+ # do so. |
37 |
+ local config |
38 |
+ eval config=\$config_${IFVAR} |
39 |
+ [ "$config" = "ip6to4" ] || return 0 |
40 |
+ |
41 |
case " ${MODULES} " in |
42 |
*" ifconfig "*) |
43 |
if [ "${IFACE}" != "sit0" ]; then |
44 |
@@ -19,7 +26,7 @@ ip6to4_start() |
45 |
fi |
46 |
esac |
47 |
|
48 |
- local host= suffix= relay= addr= iface=${IFACE} new= localip= |
49 |
+ local host= suffix= relay= addr= iface=${IFACE} config_ip6to4= localip= |
50 |
eval host=\$link_${IFVAR} |
51 |
if [ -z "${host}" ]; then |
52 |
eerror "link_${IFVAR} not set" |
53 |
@@ -67,7 +74,7 @@ ip6to4_start() |
54 |
veinfo "Derived IPv6 address: ${ip6}" |
55 |
|
56 |
# Now apply our IPv6 address to our config |
57 |
- new="${new}${new:+ }${ip6}/48" |
58 |
+ config_ip6to4="${config_ip6to4}${config_ip6to4:+ }${ip6}/48" |
59 |
|
60 |
if [ -n "${localip}" ]; then |
61 |
localip="any" |
62 |
@@ -76,7 +83,7 @@ ip6to4_start() |
63 |
fi |
64 |
done |
65 |
|
66 |
- if [ -z "${new}" ]; then |
67 |
+ if [ -z "${config_ip6to4}" ]; then |
68 |
eerror "No global IPv4 addresses found on interface ${host}" |
69 |
return 1 |
70 |
fi |
71 |
@@ -87,13 +94,22 @@ ip6to4_start() |
72 |
eend $? || return 1 |
73 |
_up |
74 |
fi |
75 |
+ routes_ip6to4="2003::/3 via ::${relay} metric 2147483647" |
76 |
+ service_set_value "config_ip6to4_$IFVAR" "$config_ip6to4" |
77 |
+ service_set_value "routes_ip6to4_$IFVAR" "$routes_ip6to4" |
78 |
+} |
79 |
+ |
80 |
+ip6to4_start() |
81 |
+{ |
82 |
+ local config_ip6to4=$(service_get_value "config_ip6to4_$IFVAR") |
83 |
+ local routes_ip6to4=$(service_get_value "routes_ip6to4_$IFVAR") |
84 |
|
85 |
# Now apply our config |
86 |
- eval config_${config_index}=\'"${new}"\' |
87 |
+ eval config_${config_index}=\'"${config_ip6to4}"\' |
88 |
: $(( config_index -= 1 )) |
89 |
|
90 |
# Add a route for us, ensuring we don't delete anything else |
91 |
local routes="$(_get_array "routes_${IFVAR}") |
92 |
-2003::/3 via ::${relay} metric 2147483647" |
93 |
+$routes_ip6to4" |
94 |
eval routes_${IFVAR}=\$routes |
95 |
} |