Skip to contentSkip to conversation

IPv6: use anycast addresses as source addresses in echo reply

PATCH François-Xavier Le Bail 2 participants 2 messages Jan 6, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Quoted 20 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Mon, 6 Jan 2014 00:05:05 +0100

Quoted 17 lines · Francois-Xavier Le Bail
Quoted 5 lines
net/ipv6/icmp.c +0 -0
index 5d42009..65c8619 100644
@@ -556,7 +556,9 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
Quoted 8 lines


      saddr = &ipv6_hdr(skb)->daddr;

-    if (!ipv6_unicast_destination(skb))
+    if (!ipv6_unicast_destination(skb) && +        !(net->ipv6.anycast_src_echo_reply && +          ipv6_chk_acast_addr(net, NULL, saddr))) saddr = NULL;

I am not sure why you left out the device at ipv6_chk_acast_addr?

Quoted 8 lines
Quoted 5 lines

IMHO this logic is a bit more complex, we can pass NULL for ipv6 addresses of scope global but need to check the interface for scope link.

It is already possible via setsockopt JOIN_ANYCAST that an ll address is anycast on another interface which may not be checked here.

I think we should pass a valid device in unless it breaks something obvious.

The problem is that "saddr" is not necessarily an address on "skb->dev" in icmpv6_echo_reply(). It may be an address on another interface.

If dev arg is NULL, ipv6_chk_acast_addr() searches all devices for "saddr", that what we need.

It works for global scope and link-local anycast address.

So passing a valid device to ipv6_chk_acast_addr() breaks the goal of the patch.

Thanks.

#1 lore raw
Quoted 25 lines · François-Xavier Le Bail
Quoted 23 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Mon, 6 Jan 2014 00:05:05 +0100

Quoted 20 lines · Francois-Xavier Le Bail
Quoted 5 lines
net/ipv6/icmp.c +0 -0
index 5d42009..65c8619 100644
@@ -556,7 +556,9 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
Quoted 8 lines


      saddr = &ipv6_hdr(skb)->daddr;

-    if (!ipv6_unicast_destination(skb))
+    if (!ipv6_unicast_destination(skb) && +        !(net->ipv6.anycast_src_echo_reply && +          ipv6_chk_acast_addr(net, NULL, saddr))) saddr = NULL;

I am not sure why you left out the device at ipv6_chk_acast_addr?

IMHO this logic is a bit more complex, we can pass NULL for ipv6 addresses of scope global but need to check the interface for scope link.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

It is already possible via setsockopt JOIN_ANYCAST that an ll address is anycast on another interface which may not be checked here.

I think we should pass a valid device in unless it breaks something obvious.

The problem is that "saddr" is not necessarily an address on "skb->dev" in icmpv6_echo_reply(). It may be an address on another interface.

Maybe you're right, but then I don't get it. Could you make an example?

Thanks,

Hannes