* IPv6 /127 address
@ 2011-06-30 17:47 Stephen Hemminger
2011-07-01 11:22 ` [PATCH] Disable router anycast address for /127 prefixes Bjørn Mork
0 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2011-06-30 17:47 UTC (permalink / raw)
To: Herbert Xu; +Cc: netdev
There is a new RFC out for supporting /127 addresses for
router interconnect and point-to-point links.
Right now the kernel gets confused by the /127 and doesn't
disable the anycast address. Any ideas?
http://tools.ietf.org/html/rfc6164
http://lists.debian.org/debian-ipv6/2011/05/msg00018.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Disable router anycast address for /127 prefixes
2011-06-30 17:47 IPv6 /127 address Stephen Hemminger
@ 2011-07-01 11:22 ` Bjørn Mork
2011-07-01 14:45 ` Brian Haley
0 siblings, 1 reply; 8+ messages in thread
From: Bjørn Mork @ 2011-07-01 11:22 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Herbert Xu, Bjørn Mork
RFC 6164 requires that routers MUST disable Subnet-Router anycast
for the prefix when /127 prefixes are used.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
How about something like this?
net/ipv6/addrconf.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 498b927..179c0f4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1470,6 +1470,8 @@ void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr)
static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
{
struct in6_addr addr;
+ if (ifp->prefix_len == 127) /* RFC 6164 */
+ return;
ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
if (ipv6_addr_any(&addr))
return;
@@ -1479,6 +1481,8 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
{
struct in6_addr addr;
+ if (ifp->prefix_len == 127) /* RFC 6164 */
+ return;
ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
if (ipv6_addr_any(&addr))
return;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Disable router anycast address for /127 prefixes
2011-07-01 11:22 ` [PATCH] Disable router anycast address for /127 prefixes Bjørn Mork
@ 2011-07-01 14:45 ` Brian Haley
2011-07-01 18:26 ` Bjørn Mork
0 siblings, 1 reply; 8+ messages in thread
From: Brian Haley @ 2011-07-01 14:45 UTC (permalink / raw)
To: Bjørn Mork; +Cc: netdev, Stephen Hemminger, Herbert Xu
On 07/01/2011 07:22 AM, Bjørn Mork wrote:
> RFC 6164 requires that routers MUST disable Subnet-Router anycast
> for the prefix when /127 prefixes are used.
>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
> ---
> @@ -1479,6 +1481,8 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
> static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
> {
> struct in6_addr addr;
> + if (ifp->prefix_len == 127) /* RFC 6164 */
> + return;
> ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
> if (ipv6_addr_any(&addr))
> return;
I'm not sure you'd need this part as there shouldn't be a /127 in the list to remove.
-Brian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Disable router anycast address for /127 prefixes
2011-07-01 14:45 ` Brian Haley
@ 2011-07-01 18:26 ` Bjørn Mork
2011-07-01 19:09 ` Brian Haley
0 siblings, 1 reply; 8+ messages in thread
From: Bjørn Mork @ 2011-07-01 18:26 UTC (permalink / raw)
To: netdev
Brian Haley <brian.haley@hp.com> writes:
> On 07/01/2011 07:22 AM, Bjørn Mork wrote:
>> RFC 6164 requires that routers MUST disable Subnet-Router anycast
>> for the prefix when /127 prefixes are used.
>>
>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>> ---
>
>> @@ -1479,6 +1481,8 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
>> static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
>> {
>> struct in6_addr addr;
>> + if (ifp->prefix_len == 127) /* RFC 6164 */
>> + return;
>> ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
>> if (ipv6_addr_any(&addr))
>> return;
>
> I'm not sure you'd need this part as there shouldn't be a /127 in the list to remove.
I don't understand exactly what you mean here....
The addrconf_{join,leave}_anycast() functions are definitely called
regardless of prefix length, including both 127 and 128. The latter is
not a problem because it is handled by ipv6_addr_prefix(). But /127
prefixes are not handled according to RFC 6164.
Just to be sure I didn't miss something, I added a simple printk to the
beginning of addrconf_{join,leave}_anycast():
printk(KERN_INFO "%s(): ifp->prefix_len=%d\n", __FUNCTION__, ifp->prefix_len);
and got this as expected after doing
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
[ 73.710174] addrconf_join_anycast(): ifp->prefix_len=128
[ 73.712879] addrconf_join_anycast(): ifp->prefix_len=64
[ 73.716799] addrconf_join_anycast(): ifp->prefix_len=64
[ 73.719798] addrconf_join_anycast(): ifp->prefix_len=64
Notice the /128 prefix, which is the loopback address.
Adding a new interface, and setting a /127 on it:
ifconfig dummy0 up
[ 134.434901] addrconf_join_anycast(): ifp->prefix_len=64
ip addr add 2001:db8:f00::3/127 dev dummy0
[ 198.292972] addrconf_join_anycast(): ifp->prefix_len=127
And verifying that it actually answers the anycast address (which is the
problem since that is supposed to be the other end of the point-to-point
link):
frtest1:~# ping6 2001:db8:f00::2
PING 2001:db8:f00::2(2001:db8:f00::2) 56 data bytes
64 bytes from 2001:db8:f00::3: icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from 2001:db8:f00::3: icmp_seq=2 ttl=64 time=0.049 ms
64 bytes from 2001:db8:f00::3: icmp_seq=3 ttl=64 time=0.039 ms
^C
--- 2001:db8:f00::2 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.035/0.041/0.049/0.005 ms
Disabling forwarding again:
echo 0 > /proc/sys/net/ipv6/conf/all/forwarding
[ 247.281543] addrconf_leave_anycast(): ifp->prefix_len=128
[ 247.284220] addrconf_leave_anycast(): ifp->prefix_len=64
[ 247.287959] addrconf_leave_anycast(): ifp->prefix_len=64
[ 247.290178] addrconf_leave_anycast(): ifp->prefix_len=64
[ 247.293390] addrconf_leave_anycast(): ifp->prefix_len=127
[ 247.295476] addrconf_leave_anycast(): ifp->prefix_len=64
With the patch, we still get anycast addresses for the shorter prefix
lengths, but not for /127 prefixes:
frtest1:~# echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
frtest1:~# ifconfig dummy0 up
frtest1:~#
frtest1:~# ip addr add 2001:db8:f00::3/127 dev dummy0
frtest1:~# ip -6 addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 fe80::5054:ff:feff:100/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 2001:4620:9:29a:5054:ff:feff:106/64 scope global dynamic
valid_lft 86356sec preferred_lft 14356sec
inet6 fe80::5054:ff:feff:106/64 scope link
valid_lft forever preferred_lft forever
4: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500
inet6 2001:db8:f00::3/127 scope global
valid_lft forever preferred_lft forever
inet6 fe80::d8b4:bcff:fe81:172/64 scope link
valid_lft forever preferred_lft forever
frtest1:~# ping6 2001:4620:9:29a::
PING 2001:4620:9:29a::(2001:4620:9:29a::) 56 data bytes
64 bytes from 2001:4620:9:29a:5054:ff:feff:106: icmp_seq=1 ttl=64 time=0.032 ms
64 bytes from 2001:4620:9:29a:5054:ff:feff:106: icmp_seq=2 ttl=64 time=0.040 ms
^C
--- 2001:4620:9:29a:: ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.032/0.036/0.040/0.004 ms
frtest1:~# ping6 2001:db8:f00::2
PING 2001:db8:f00::2(2001:db8:f00::2) 56 data bytes
^C
--- 2001:db8:f00::2 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1008ms
Bjørn
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Disable router anycast address for /127 prefixes
2011-07-01 18:26 ` Bjørn Mork
@ 2011-07-01 19:09 ` Brian Haley
2011-07-02 9:38 ` Bjørn Mork
0 siblings, 1 reply; 8+ messages in thread
From: Brian Haley @ 2011-07-01 19:09 UTC (permalink / raw)
To: Bjørn Mork; +Cc: netdev
On 07/01/2011 02:26 PM, Bjørn Mork wrote:
> Brian Haley <brian.haley@hp.com> writes:
>> On 07/01/2011 07:22 AM, Bjørn Mork wrote:
>>> RFC 6164 requires that routers MUST disable Subnet-Router anycast
>>> for the prefix when /127 prefixes are used.
>>>
>>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
>>> ---
>>
>>> @@ -1479,6 +1481,8 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
>>> static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
>>> {
>>> struct in6_addr addr;
>>> + if (ifp->prefix_len == 127) /* RFC 6164 */
>>> + return;
>>> ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
>>> if (ipv6_addr_any(&addr))
>>> return;
>>
>> I'm not sure you'd need this part as there shouldn't be a /127 in the list to remove.
>
> I don't understand exactly what you mean here....
If you never add an anycast address when the prefix length is 127, the address
wouldn't be there when you went to remove it. In other words, the call to
__ipv6_dev_ac_dec() would return -ENOENT, which is ignored anyways.
It's not a common codepath so the two lines of code wouldn't hurt anything
I guess...
-Brian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Disable router anycast address for /127 prefixes
2011-07-01 19:09 ` Brian Haley
@ 2011-07-02 9:38 ` Bjørn Mork
2011-07-06 9:04 ` [PATCH v2] " Bjørn Mork
0 siblings, 1 reply; 8+ messages in thread
From: Bjørn Mork @ 2011-07-02 9:38 UTC (permalink / raw)
To: Brian Haley; +Cc: netdev
Brian Haley <brian.haley@hp.com> writes:
> On 07/01/2011 02:26 PM, Bjørn Mork wrote:
>> Brian Haley <brian.haley@hp.com> writes:
>>
>>> I'm not sure you'd need this part as there shouldn't be a /127 in the list to remove.
>>
>> I don't understand exactly what you mean here....
>
> If you never add an anycast address when the prefix length is 127, the address
> wouldn't be there when you went to remove it. In other words, the call to
> __ipv6_dev_ac_dec() would return -ENOENT, which is ignored anyways.
Doh! Of course. Sorry for being that slow...
And thanks for taking the time to feed it to me with a small enough
spoon :-)
> It's not a common codepath so the two lines of code wouldn't hurt anything
> I guess...
Personally I prefer "symmetric" coding because it leaves fewer questions
unanswered (necessary for the slow among us, as demonstrated above).
But I think that's for those actually maintaining this code to decide.
I can post an updated patch if required, or feel free to apply only the
first hunk.
Bjørn
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] Disable router anycast address for /127 prefixes
2011-07-02 9:38 ` Bjørn Mork
@ 2011-07-06 9:04 ` Bjørn Mork
2011-07-07 11:15 ` David Miller
0 siblings, 1 reply; 8+ messages in thread
From: Bjørn Mork @ 2011-07-06 9:04 UTC (permalink / raw)
To: netdev; +Cc: Stephen Hemminger, Herbert Xu, Brian Haley, Bjørn Mork
RFC 6164 requires that routers MUST disable Subnet-Router anycast
for the prefix when /127 prefixes are used.
No need for matching code in addrconf_leave_anycast() as it
will silently ignore any attempt to leave an unknown anycast
address.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
Changes since v1:
* removed unneeded change based on review comments from Brian Haley
Thought a bit more about this and found that adding less code
makes more sense, given that the meaning is clear enough. But I
really don't have any strong meanings about this. Please apply either
version 1 or version 2 depending on your preferences.
Bjørn
net/ipv6/addrconf.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 498b927..fef2e2e 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1470,6 +1470,8 @@ void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr)
static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
{
struct in6_addr addr;
+ if (ifp->prefix_len == 127) /* RFC 6164 */
+ return;
ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
if (ipv6_addr_any(&addr))
return;
--
1.7.2.5
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] Disable router anycast address for /127 prefixes
2011-07-06 9:04 ` [PATCH v2] " Bjørn Mork
@ 2011-07-07 11:15 ` David Miller
0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2011-07-07 11:15 UTC (permalink / raw)
To: bjorn; +Cc: netdev, shemminger, herbert, brian.haley
From: Bjørn Mork <bjorn@mork.no>
Date: Wed, 6 Jul 2011 11:04:13 +0200
> RFC 6164 requires that routers MUST disable Subnet-Router anycast
> for the prefix when /127 prefixes are used.
>
> No need for matching code in addrconf_leave_anycast() as it
> will silently ignore any attempt to leave an unknown anycast
> address.
>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
Applied to net-next-2.6, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-07-07 11:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-30 17:47 IPv6 /127 address Stephen Hemminger
2011-07-01 11:22 ` [PATCH] Disable router anycast address for /127 prefixes Bjørn Mork
2011-07-01 14:45 ` Brian Haley
2011-07-01 18:26 ` Bjørn Mork
2011-07-01 19:09 ` Brian Haley
2011-07-02 9:38 ` Bjørn Mork
2011-07-06 9:04 ` [PATCH v2] " Bjørn Mork
2011-07-07 11:15 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.