Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 33310 - Suggested IPv6 enhancement to /etc/init.d/net.IFACE
Summary: Suggested IPv6 enhancement to /etc/init.d/net.IFACE
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: x86 All
: High enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: InVCS
: 59922 (view as bug list)
Depends on:
Blocks: 6175 34653 66472
  Show dependency tree
 
Reported: 2003-11-12 09:40 UTC by Lindsay Haisley
Modified: 2004-12-04 03:57 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lindsay Haisley 2003-11-12 09:40:50 UTC
The following patch adds the ability to configure a specified global address as
the default next hop address for an IPv6-enabled interface.  By default,
apparently, radvd advertises the router using the link address of the router, and this won't work in some cases (perhaps all) for talking with the rest of the 
IPv6 world.  Debian allows the specification of an IPv6 gateway within the
approrpiate per interface section of /etc/network/interfaces (iface eth0 inet6 
static, etc) but no such facility apparently exists in Gentoo.

This is admitedly crude, and I'm sure it can be improved on, but it solves the
problem.

--- net.eth0.orig       2003-11-12 11:07:46.000000000 -0600
+++ net.eth0    2003-11-12 11:37:40.000000000 -0600
@@ -31,6 +31,7 @@
        iface_IFACE="$(eval echo \$\{iface_${iface}\})"
        dhcpcd_IFACE="$(eval echo \$\{dhcpcd_${iface}\})"
        inet6_IFACE="$(eval echo \$\{inet6_${iface}\})"
+       inet6gw_IFACE="$(eval echo \$\{inet6gw_${iface}\})"
        alias_IFACE="$(eval echo \$\{alias_${iface}\})"
        status_IFACE="$(ifconfig | gawk -v IFACE="${iface}" '/Link/ { if ($1 == IFACE) print "up" }')"
        vlans="$(eval echo \$\{iface_${IFACE}_vlans\})"
@@ -109,6 +110,11 @@
                do
                        ebegin "    ${IFACE} inet6 add ${x}"
                        /sbin/ifconfig ${IFACE} inet6 add ${x} >/dev/null
+                       if [ -n "${inet6gw_IFACE}" ]
+                       then
+                               ebegin "    Adding inet6 gateway ${inet6gw_IFACE}"
+                               route add -A inet6 ::/0 gw ${inet6gw_IFACE}
+                       fi
                        eend 0
                done
                save_options "inet6" "${inet6_IFACE}"
Comment 1 Lindsay Haisley 2003-11-12 10:17:06 UTC
A slightly more elegant version of the same patch:

--- net.eth0.orig       2003-11-12 11:07:46.000000000 -0600
+++ net.eth0    2003-11-12 12:14:48.000000000 -0600
@@ -31,6 +31,7 @@
        iface_IFACE="$(eval echo \$\{iface_${iface}\})"
        dhcpcd_IFACE="$(eval echo \$\{dhcpcd_${iface}\})"
        inet6_IFACE="$(eval echo \$\{inet6_${iface}\})"
+       inet6gw_IFACE="$(eval echo \$\{inet6gw_${iface}\})"
        alias_IFACE="$(eval echo \$\{alias_${iface}\})"
        status_IFACE="$(ifconfig | gawk -v IFACE="${iface}" '/Link/ { if ($1 == IFACE) print "up" }')"
        vlans="$(eval echo \$\{iface_${IFACE}_vlans\})"
@@ -111,6 +112,13 @@
                        /sbin/ifconfig ${IFACE} inet6 add ${x} >/dev/null
                        eend 0
                done
+               if [ -n "${inet6gw_IFACE}" ]
+               then
+                       ebegin "    Adding ${IFACE} inet6 gateway ${inet6gw_IFACE}"
+                       route add -A inet6 ::/0 gw ${inet6gw_IFACE}
+                       save_options "inet6gw" "${inet6gw_IFACE}"
+                       eend 0
+               fi
                save_options "inet6" "${inet6_IFACE}"
        fi
Comment 2 Lindsay Haisley 2003-11-12 12:42:22 UTC
The link-scope gateway address will work.  The patch isn't necessary.  Failure to 
include a mask spec in the inet6_eth0 address caused an improper entry in the ipv6 
routing table, so the problem I was trying to solve was a config problem on my
end.  It might be helpful to include a reminder to this effect in /etc/conf.d/net.
Coulda saved me some time.
Comment 3 Eric Shattow 2004-04-17 08:40:56 UTC
This suggestion is still valid for those of us who are using statically assigned IPv6 configurations. See bugs 6175, 34653.
Comment 4 Martin Holzer (RETIRED) gentoo-dev 2004-04-17 08:48:38 UTC
wrangler
Comment 5 Eric Shattow 2004-11-03 22:25:08 UTC
still not sure about this bug.   currently i have a hack in my /etc/conf.d/net:

inet6_eth0=(
    "2001:470:1f01:261::2/64"
)

routes_eth0=(
    "default gw 192.168.6.1"
    "-A inet6 default gw 2001:470:1f01:261::1"
)


there's got to be a better way.
Comment 6 Roy Marples (RETIRED) gentoo-dev 2004-11-17 07:13:17 UTC
I agree. I've got a fix in CVS to detect inet6 addresses in routes - so the below works :)

routes_eth0=(
    "default gw 192.168.6.1"
    "default gw 2001:470:1f01:261::1"
)
Comment 7 Roy Marples (RETIRED) gentoo-dev 2004-11-17 07:20:23 UTC
*** Bug 59922 has been marked as a duplicate of this bug. ***
Comment 8 Roy Marples (RETIRED) gentoo-dev 2004-12-04 03:57:17 UTC
Fixed in baselayout-1.11.7-r1