Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 392223 - sys-apps/openrc: Add 6rd support
Summary: sys-apps/openrc: Add 6rd support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: OpenRC Team
URL:
Whiteboard: openrc:oldnet
Keywords:
Depends on:
Blocks: 399185
  Show dependency tree
 
Reported: 2011-11-28 00:11 UTC by Christopher Byrne
Modified: 2012-02-09 09:40 UTC (History)
0 users

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


Attachments
6rd net module (ip6rd.sh,3.43 KB, text/plain)
2011-11-28 00:11 UTC, Christopher Byrne
Details
6rd net module (ip6rd.sh,3.47 KB, text/plain)
2011-11-28 09:15 UTC, Christopher Byrne
Details
6rd net module (dhclient.sh,1.75 KB, text/plain)
2011-12-14 09:13 UTC, Christopher Byrne
Details
6rd net module (ip6rd.sh,3.81 KB, text/plain)
2011-12-28 22:18 UTC, Christopher Byrne
Details
6rd net module (ip6rd.sh,4.04 KB, text/plain)
2011-12-29 00:04 UTC, Christopher Byrne
Details
297261: 6rd net module (ip6rd.sh,4.12 KB, text/plain)
2011-12-29 01:20 UTC, Christopher Byrne
Details
6rd net module (ip6rd.sh,3.85 KB, text/plain)
2011-12-29 05:12 UTC, Christopher Byrne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Byrne 2011-11-28 00:11:54 UTC
Created attachment 294007 [details]
6rd net module

This script will add 6rd to Gentoo. 6rd is similar to 6to4 (and the script itself is based on the 6to4 openrc sources), but instead of using public relays, it uses a private one with the ISP ipv6 prefix instead of 2002:: ; otherwise the IP are generated similarly, however with 6rd with possible to "shave" off some of the ipv4 to make subnets bigger (thus if an ISP has an /8 they can shave off the first 8 bits of the generated ipv4 address to add 8 extra bits for the customer.).

configuration is similar to 6to4, except the relay must be specified

link_6rd="eth0" # required
config_6rd="ip6rd" # required
rc_need_6rd="net.eth0" # optional but recommened
prefix_6rd="2602:100::/32" # required
suffix_6d="ff" # optional defaults to 1 
relay_6rd="68.114.165.1" # required
ipv4mask_6rd="0" # optional, default is 0

Note since this script is based off the 6to4 one, it has the same bugs, too, in particular bug 372575 - (I modified a copy of net.lo it to test). 

The ip6rd_inet functions are all pretty generic (except ip6rd_prefix_shave_bits) and could be split off into a separate library for the other net scripts if desired.

6rd has provisions for autoconfiguration via DHCP (option 212), obviating the need to specify it all manually, however I don't know of way how to retrieve and parse the DHCP options in a dhcp client independent way - so it currently not implemented
Comment 1 Christopher Byrne 2011-11-28 09:15:37 UTC
Created attachment 294039 [details]
6rd net module

Made an error computing the ipv6 subnet (forgot to add ipv4mask to the ISP's prefix subnet) - this corrects it.
Comment 2 Christopher Byrne 2011-12-14 09:13:38 UTC
Created attachment 295781 [details]
6rd net module

First version has more bugs than I thought. _ip6rd_inet_get_network() wasn't correct, now fixed. Now that I understand why pre_start wasn't being run, I've now fixed that. So unlike 6to4 (which this module is based off of), it will work with a custom name - I opted just to re-do the loop. 

Also I made the coding style more consist ant with the rest of module. Need documentation, its pretty much the same as ip6to4, but it requires two additional parameter: "prefix", which is the 6rd prefix for the user's ISP in the form 2001:DB8::/32, and "relay" which is the ISP's 6rd border router (ip6to4 has the latter but its optional there). 

There's an additional optional ipv4mask parameter, which is the number of the most significant bits to shave off the user's IP address to generate the IP address (so if an ISP has an entire class A, the first 8 bits could be shaved off to gave users more IP - from a /64 to a /56 ). I don't think any ISP has implemented that, but it is in the RFC.
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-12-26 23:54:34 UTC
You uploaded dhclient.sh as your latest version in comment 2, instead of your 6rd.sh script. Please re-upload.

md5:
0f3a34d6871314e219c632b0db520cc6  6rd.sh
0f3a34d6871314e219c632b0db520cc6  dhclient.sh
Comment 4 Christopher Byrne 2011-12-28 22:18:39 UTC
Created attachment 297257 [details]
6rd net module

Here's the correct script
Comment 5 Christopher Byrne 2011-12-29 00:04:01 UTC
Created attachment 297261 [details]
6rd net module

I didn't know about the service_{get/set}_value thing so I updated the script to use them to avoid looping twice. Also makes it more symmetrical to ip6to4.
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2011-12-29 00:12:25 UTC
Looks good, I think some more cleanup of the math (I think it can be refactored a bit) and it should be good to go.

Thanks for using service_get_value, it helps a lot.
Comment 7 Christopher Byrne 2011-12-29 01:20:01 UTC
Created attachment 297265 [details]
297261: 6rd net module

Forgot to check for empty relay (6rd requires the relay, prefix, and link values)
Comment 8 William Hubbs gentoo-dev 2011-12-29 02:57:02 UTC
@robbat2:
The substitutions on line 62 look like bashisms, but I'm not quite sure
whether or not they are.
We should probably be sure that this script is posix compliant before we
commit it.
Comment 9 Christopher Byrne 2011-12-29 05:12:43 UTC
Created attachment 297277 [details]
6rd net module

Forgot to add new parameters to _config_vars. Also spacing got mangled in copy/paste job so fixed it.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2012-02-09 09:40:56 UTC
InCVS now, thanks for all the revisions of it.
Not tested in depth because I don't have 6rd available to me.