From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RfLY1-0005GV-IS for garchives@archives.gentoo.org; Tue, 27 Dec 2011 01:09:45 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B39F521C045; Tue, 27 Dec 2011 01:09:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6C31121C045 for ; Tue, 27 Dec 2011 01:09:37 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9F4051B4022 for ; Tue, 27 Dec 2011 01:09:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C720A80043 for ; Tue, 27 Dec 2011 01:09:35 +0000 (UTC) From: "Robin H. Johnson" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" Message-ID: Subject: [gentoo-commits] proj/openrc:master commit in: net/ X-VCS-Repository: proj/openrc X-VCS-Files: net/ip6to4.sh X-VCS-Directories: net/ X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: acf77b73afb8011a903d5ac88f6d6dcaf7b77a2f Date: Tue, 27 Dec 2011 01:09:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: cabb29a9-9e52-4b26-a8aa-ef1cfd81a7ec X-Archives-Hash: 381729d93f94729c44753096efa9e121 commit: acf77b73afb8011a903d5ac88f6d6dcaf7b77a2f Author: Robin H. Johnson gentoo org> AuthorDate: Tue Dec 27 01:07:41 2011 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Tue Dec 27 01:08:27 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3Dacf77b73 net/ip6to4: Split to use pre_start and start so that other tunnel names w= ork. 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=3D372575 Signed-off-by: Robin H. Johnson gentoo.org> --- net/ip6to4.sh | 28 ++++++++++++++++++++++------ 1 files changed, 22 insertions(+), 6 deletions(-) diff --git a/net/ip6to4.sh b/net/ip6to4.sh index 5569dee..959a2a0 100644 --- a/net/ip6to4.sh +++ b/net/ip6to4.sh @@ -8,8 +8,15 @@ ip6to4_depend() after interface } =20 -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=3D\$config_${IFVAR} + [ "$config" =3D "ip6to4" ] || return 0 + case " ${MODULES} " in *" ifconfig "*) if [ "${IFACE}" !=3D "sit0" ]; then @@ -19,7 +26,7 @@ ip6to4_start() fi esac =20 - local host=3D suffix=3D relay=3D addr=3D iface=3D${IFACE} new=3D locali= p=3D + local host=3D suffix=3D relay=3D addr=3D iface=3D${IFACE} config_ip6to4= =3D localip=3D eval host=3D\$link_${IFVAR} if [ -z "${host}" ]; then eerror "link_${IFVAR} not set" @@ -67,7 +74,7 @@ ip6to4_start() veinfo "Derived IPv6 address: ${ip6}" =20 # Now apply our IPv6 address to our config - new=3D"${new}${new:+ }${ip6}/48" + config_ip6to4=3D"${config_ip6to4}${config_ip6to4:+ }${ip6}/48" =20 if [ -n "${localip}" ]; then localip=3D"any" @@ -76,7 +83,7 @@ ip6to4_start() fi done =20 - 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=3D"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=3D$(service_get_value "config_ip6to4_$IFVAR") + local routes_ip6to4=3D$(service_get_value "routes_ip6to4_$IFVAR") =20 # Now apply our config - eval config_${config_index}=3D\'"${new}"\' + eval config_${config_index}=3D\'"${config_ip6to4}"\' : $(( config_index -=3D 1 )) =20 # Add a route for us, ensuring we don't delete anything else local routes=3D"$(_get_array "routes_${IFVAR}") -2003::/3 via ::${relay} metric 2147483647" +$routes_ip6to4" eval routes_${IFVAR}=3D\$routes }