sit: allow encapsulated IPv6 traffic to be delivered locally
authorIgnat Korchagin <ignat@cloudflare.com>
Fri, 7 Jan 2022 12:38:42 +0000 (12:38 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 12 Jan 2022 21:56:07 +0000 (13:56 -0800)
commited6ae5ca437d9d238117d90e95f7f2cc27da1b31
tree7b67fa1be906f12ae4237dab17c19f735f8e68c6
parente179f045f90d8947d3c2addebd620341b7daa4a1
sit: allow encapsulated IPv6 traffic to be delivered locally

While experimenting with FOU encapsulation Amir noticed that encapsulated IPv6
traffic fails to be delivered, if the peer IP address is configured locally.

It can be easily verified by creating a sit interface like below:

$ sudo ip link add name fou_test type sit remote 127.0.0.1 encap fou encap-sport auto encap-dport 1111
$ sudo ip link set fou_test up

and sending some IPv4 and IPv6 traffic to it

$ ping -I fou_test -c 1 1.1.1.1
$ ping6 -I fou_test -c 1 fe80::d0b0:dfff:fe4c:fcbc

"tcpdump -i any udp dst port 1111" will confirm that only the first IPv4 ping
was encapsulated and attempted to be delivered.

This seems like a limitation: for example, in a cloud environment the "peer"
service may be arbitrarily scheduled on any server within the cluster, where all
nodes are trying to send encapsulated traffic. And the unlucky node will not be
able to. Moreover, delivering encapsulated IPv4 traffic locally is allowed.

But I may not have all the context about this restriction and this code predates
the observable git history.

Reported-by: Amir Razmjou <arazmjou@cloudflare.com>
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20220107123842.211335-1-ignat@cloudflare.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/sit.c