[ipv6calc] [PATCH] 6rd local prefix calculation

Peter Bieringer peter at bieringer.de
Fri Sep 16 21:54:57 CEST 2011

Hi Raphael,

I did now some adjustments, autodetection and checks and also extend the 
online help.

$ ./ipv6calc --action -h

  Available action types:
   auto             : Automatic selection of action (default)
   geneui64         : Converts a MAC address to an EUI-64 address
   conv6to4         : Converts IPv4 address <-> 6to4 IPv6 address (prefix)
   genprivacyiid    : Generates a privacy interface ID out of a given 
one and a token
   prefixmac2ipv6   : Generates an IPv6 address out of a prefix and a 
MAC address
   anonymize        : Anonymize IPv4/IPv6 address without loosing much 
   6rd_local_prefix : Calculate the 6rd prefix from given IPv6 prefix & 
relay prefix and IPv4
                       Required options:
                        --6rd_prefix ...
                        --6rd_relay_prefix ...

Command line:

$ ./ipv6calc/ipv6calc --action 6rd_local_prefix --6rd_prefix 
2607:fedc:ff40::/43  --6rd_relay_prefix No 
input type specified, try autodetection...found type: ipv4addr
No output type specified, try autodetection...found type: ipv6addr

(autodetect messages can be suppressed using -q)

Please try latest version from CVS and confirm proper working - thank you!


Am 15.09.2011 20:07, schrieb Raphael Assenat:
> Hello Peter,
> It is true that generally, the IPv6 prefix may change
> less often. As long as the local IP stays in the same subnet,
> we can reasonably expect the relay prefix and relay IP
> (not used here) to stay the same.
> However, with my ISP, I receive this informations from DHCP so I
> consider all the parameters to be dyanamic anyway. I will always
> call ipv6calc with values according to variables within
> a script based on the most recently received information.
> Therefore, at least for my use case, having the local IP or
> the IPv6 prefix as main parameter makes no difference.
> Best regards,
> Raphaël Assénat
> On Thu, Sep 15, 2011 at 07:17:39PM +0200, Peter Bieringer wrote:
>> Hi Raphael,
>> patch applied, working.
>> But I have a question regarding the main input argument:
>> Your implementation:
>> ./ipv6calc --action 6rd_local_prefix --in ipv6addr --out ipv6addr
>> --6rd_relay_prefix --6rd_local_ip
>> 2607:fedc:ff40::/43
>> 2607:fedc:ff52:210::/60
>> But I assume, the IPv6 prefix is a more static one that the local IP.
>> Because ipv6calc also supports bulk calculations by taking the variable
>> argument from stdin, this would be currently the prefix, while I assume,
>> the local IP is better.
>> echo "2607:fedc:ff40::/43" | ./ipv6calc --action 6rd_local_prefix --in
>> ipv6addr --out ipv6addr --6rd_relay_prefix --6rd_local_ip
>> vs. (implementation must be changed):
>> echo "" | ./ipv6calc --action 6rd_local_prefix --in ipv4addr
>> --out ipv6addr --6rd_prefix 2607:fedc:ff40::/43 --6rd_relay_prefix
>> --6rd_local_ip
>> Opinion?
>> 	Peter
>> At 15.09.2011 05:00, Raphael Assenat wrote:
>>> Hello Peter,
>>> Here's the patch I omitted in my previous message...
>>> Best regards,
>>> Raphaël Assénat
>>> On Wed, Sep 14, 2011 at 08:39:57PM +0200, Peter Bieringer wrote:
>>>> Hi Raphael,
>>>> I can apply your patch but it did not compile:
>>>> librfc5569.c: In function 'librfc5569_calc_6rd_local_prefix':
>>>> librfc5569.c:32:26: error: 'struct in6_addr' has no member named 'in6_u'
>>>> Problem is here:
>>>>   sixrd_prefix->in6_addr.in6_u.u6_addr8[i>>3] |= 0x80>>  (i&0x7);
>>>> Looks like on Fedora 15, the header files are different than on your system.
>>>> Can you rewrite this section using my independend wrapper functions
>>>> ipv6addr_getoctett and ipv6addr_setoctett (looks I have to fix the "tt"
>>>> on next release...) instead of deep structure manipulations?
>>>> Please send a patch on top of your previous one.
>>>> Thank you!
>>>> 	Peter
>>>> At 13.09.2011 19:07, Raphael Assenat wrote:
>>>>> Hello,
>>>>> I recently began playing with the IPv6 service my ISP provides with 6rd. Calculating
>>>>> the local prefix manually was tedious so I wrote the attached patch for ipv6calc.
>>>>> The local prefix is obtained by specifying the 6rd prefix, 6rd relay prefix
>>>>> and local IPv4 address to ipv6calc.
>>>>> The operation is in fact a simple concatenation of the 6rd prefix with part of the
>>>>> local IPv4 address (according to the relay prefix length).
>>>>> Consider the following (fictive) parameters:
>>>>> 6rd prefix: 2607:fedc:ff40::/43
>>>>> 6rd_relay_prefix:
>>>>> local ip:
>>>>> ./ipv6calc --action 6rd_local_prefix --in ipv6addr 2607:fedc:ff40::/43 --out ipv6addr --6rd_relay_prefix --6rd_local_ip
>>>>> 2607:fedc:ff52:210::/60
>>>>> Please review and consider applying. In any case, I think equivalent functionality
>>>>> would be a very useful feature to have in ipv6calc.
>>>>> Best regards,
>>>>> Raphaël Assénat

More information about the ipv6calc mailing list