aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2011-12-26 17:07:41 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2011-12-26 17:08:27 -0800
commitacf77b73afb8011a903d5ac88f6d6dcaf7b77a2f (patch)
treeb1f32a0399fd0344324e21f21913a00594f00aa8 /net
parent9a01f6851533c808ff0665a3749a20f710a3ee57 (diff)
net/ip6to4: Split to use pre_start and start so that other tunnel names work.
We need to create interfaces of custom names before we can sucessfully start them. To do this, we have to add tunnels during prestart instead of start. Split up the ip6to4 script to do this, saving the computed variables for use in start with the new service data commands. X-Gentoo-Bug: 372575 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=372575 Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'net')
-rw-r--r--net/ip6to4.sh28
1 files changed, 22 insertions, 6 deletions
diff --git a/net/ip6to4.sh b/net/ip6to4.sh
index 5569dee9..959a2a0b 100644
--- a/net/ip6to4.sh
+++ b/net/ip6to4.sh
@@ -8,8 +8,15 @@ ip6to4_depend()
after interface
}
-ip6to4_start()
+ip6to4_pre_start()
{
+ # ALL interfaces run pre_start blocks, not just those with something
+ # assigned, so we must check if we need to run on this interface before we
+ # do so.
+ local config
+ eval config=\$config_${IFVAR}
+ [ "$config" = "ip6to4" ] || return 0
+
case " ${MODULES} " in
*" ifconfig "*)
if [ "${IFACE}" != "sit0" ]; then
@@ -19,7 +26,7 @@ ip6to4_start()
fi
esac
- local host= suffix= relay= addr= iface=${IFACE} new= localip=
+ local host= suffix= relay= addr= iface=${IFACE} config_ip6to4= localip=
eval host=\$link_${IFVAR}
if [ -z "${host}" ]; then
eerror "link_${IFVAR} not set"
@@ -67,7 +74,7 @@ ip6to4_start()
veinfo "Derived IPv6 address: ${ip6}"
# Now apply our IPv6 address to our config
- new="${new}${new:+ }${ip6}/48"
+ config_ip6to4="${config_ip6to4}${config_ip6to4:+ }${ip6}/48"
if [ -n "${localip}" ]; then
localip="any"
@@ -76,7 +83,7 @@ ip6to4_start()
fi
done
- if [ -z "${new}" ]; then
+ if [ -z "${config_ip6to4}" ]; then
eerror "No global IPv4 addresses found on interface ${host}"
return 1
fi
@@ -87,13 +94,22 @@ ip6to4_start()
eend $? || return 1
_up
fi
+ routes_ip6to4="2003::/3 via ::${relay} metric 2147483647"
+ service_set_value "config_ip6to4_$IFVAR" "$config_ip6to4"
+ service_set_value "routes_ip6to4_$IFVAR" "$routes_ip6to4"
+}
+
+ip6to4_start()
+{
+ local config_ip6to4=$(service_get_value "config_ip6to4_$IFVAR")
+ local routes_ip6to4=$(service_get_value "routes_ip6to4_$IFVAR")
# Now apply our config
- eval config_${config_index}=\'"${new}"\'
+ eval config_${config_index}=\'"${config_ip6to4}"\'
: $(( config_index -= 1 ))
# Add a route for us, ensuring we don't delete anything else
local routes="$(_get_array "routes_${IFVAR}")
-2003::/3 via ::${relay} metric 2147483647"
+$routes_ip6to4"
eval routes_${IFVAR}=\$routes
}