IPv6: use anycast addresses as source addresses in echo reply
Subsystems (2)
Quoted 8 lines · Hannes Frederic Sowa
Quoted 5 lines
Quoted 2 lines
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?
Yes :
box with eth1, eth2, forwarding enable.
echo request arrives on eth2
-------------------------------> eth2 (2a01:3::1) {forwarding enable} eth1 (2a01:2::1)
if dest == 2a01:3::
Jan 7 10:36:36 localhost kernel: [ 59.155376] icmpv6_echo_reply: saddr == 2a01:3::
Jan 7 10:36:36 localhost kernel: [ 59.155395] icmpv6_echo_reply: skb->dev->name == eth2
Jan 7 10:36:36 localhost kernel: [ 59.155398] icmpv6_echo_reply: ipv6_chk_acast_addr(net, skb->dev, saddr) == 1 Jan 7 10:36:36 localhost kernel: [ 59.155400] icmpv6_echo_reply: ipv6_chk_acast_addr(net, NULL, saddr) == 1 if dest == 2a01:2::
Jan 7 10:36:46 localhost kernel: [ 68.807565] icmpv6_echo_reply: saddr == 2a01:2::
Jan 7 10:36:46 localhost kernel: [ 68.807580] icmpv6_echo_reply: skb->dev->name == eth2
Jan 7 10:36:46 localhost kernel: [ 68.807583] icmpv6_echo_reply: ipv6_chk_acast_addr(net, skb->dev, saddr) == 0 Jan 7 10:36:46 localhost kernel: [ 68.807586] icmpv6_echo_reply: ipv6_chk_acast_addr(net, NULL, saddr) == 1
So, as 2a01:2:: is a address on eth1, ipv6_chk_acast_addr(net, skb->dev, saddr) with dev == eth2 return 0.
It is the reason why I use dev == NULL.
Do your tests show something different ?
Anyway, although I think that this solution is valid, I am testing another way to do this change.
BR,
Francois-Xavier
Quoted 29 lines · François-Xavier Le Bail
Quoted 8 lines · Hannes Frederic Sowa
Quoted 5 lines
Quoted 2 lines
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?
Yes :
box with eth1, eth2, forwarding enable.echo request arrives on eth2
-------------------------------> eth2 (2a01:3::1) {forwarding enable} eth1 (2a01:2::1)if dest == 2a01:3::
Jan 7 10:36:36 localhost kernel: [ 59.155376]icmpv6_echo_reply: saddr == 2a01:3::
Jan 7 10:36:36 localhost kernel: [ 59.155395]icmpv6_echo_reply:skb->dev->name== eth2
Jan 7 10:36:36 localhost kernel: [ 59.155398]icmpv6_echo_reply:ipv6_chk_acast_addr(net, skb->dev, saddr)== 1 Jan 7 10:36:36 localhost kernel: [ 59.155400]icmpv6_echo_reply:ipv6_chk_acast_addr(net, NULL, saddr)== 1 if dest == 2a01:2::
Jan 7 10:36:46 localhost kernel: [ 68.807565]icmpv6_echo_reply: saddr == 2a01:2::
Jan 7 10:36:46 localhost kernel: [ 68.807580]icmpv6_echo_reply:skb->dev->name== eth2
Jan 7 10:36:46 localhost kernel: [ 68.807583]icmpv6_echo_reply:ipv6_chk_acast_addr(net, skb->dev, saddr)== 0 Jan 7 10:36:46 localhost kernel: [ 68.807586]icmpv6_echo_reply:ipv6_chk_acast_addr(net, NULL, saddr)== 1
Quoted 5 lines
So, as 2a01:2:: is a address on eth1,
ipv6_chk_acast_addr(net, skb->dev, saddr)with dev == eth2 return 0.It is the reason why I use dev == NULL.
Do your tests show something different ?
I haven't tested this particular setup.
Quoted 2 lines
Anyway, although I think that this solution is valid, I am testing another way to do this change.
Ok, thanks for explaining, I see now, of course.
Maybe we could just do (ipv6_addr_type(addr) & IPV6_ADDR_LINKLOCAL) ? skb->dev : NULL?
I guess the NULL solution would be ok now, too. You can decide. I just think we can be a bit more defensive here with no additional cost. Routing table behaviour is pretty complicated and maybe can change in future.
Thank you,
Hannes
Quoted 5 lines · Hannes Frederic Sowa
Quoted 2 lines
Anyway, although I think that this solution is valid, I am testing another way to do this change.
Ok, thanks for explaining, I see now, of course.
Quoted 7 lines
Maybe we could just do
(ipv6_addr_type(addr)&IPV6_ADDR_LINKLOCAL) ?skb->dev: NULL?I guess the NULL solution would be ok now, too. You can
decide. I just think we can be a bit more defensive here with no additional cost. Routing table behaviour is pretty complicated and maybe can change in future.
I see.
first solution : I add this "defensive" update.
second solution : the v5 patch I will send soon.
Thanks for the review.
François-Xavier