IPv6: use anycast addresses as source addresses in echo reply
Subsystems (2)
Quoted 20 lines · David Miller
From: Hannes Frederic Sowa <[email protected]>
Date: Mon, 6 Jan 2014 00:05:05 +0100Quoted 17 lines · Francois-Xavier Le Bail
Quoted 5 lines
net/ipv6/icmp.c +0
-0@@ -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_ANYCASTthat 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.
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 +0100Quoted 20 lines · Francois-Xavier Le Bail
Quoted 5 lines
net/ipv6/icmp.c +0
-0@@ -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_ANYCASTthat 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" inicmpv6_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