]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Set flow flag to allow any source IP in bpf_tunnel_key
authorPaul Chaignon <paul@isovalent.com>
Mon, 25 Jul 2022 14:32:34 +0000 (16:32 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 26 Jul 2022 10:43:16 +0000 (12:43 +0200)
commit478c83fc646db0b04c35f39741b7fbdd74105f8a
treec3238061d9e4ea67bd193ee5b3e25ff839641e67
parentfb7fa0b7981c7ff439fcd70b9bd79967e40b4f97
bpf: Set flow flag to allow any source IP in bpf_tunnel_key

Commit 4b4e5af1f714 ("bpf: Add source ip in "struct bpf_tunnel_key"")
added support for getting and setting the outer source IP of encapsulated
packets via the bpf_skb_{get,set}_tunnel_key BPF helper. This change
allows BPF programs to set any IP address as the source, including for
example the IP address of a container running on the same host.

In that last case, however, the encapsulated packets are dropped when
looking up the route because the source IP address isn't assigned to any
interface on the host. To avoid this, we need to set the
FLOWI_FLAG_ANYSRC flag.

Fixes: 4b4e5af1f714 ("bpf: Add source ip in "struct bpf_tunnel_key"")
Signed-off-by: Paul Chaignon <paul@isovalent.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/76873d384e21288abe5767551a0799ac93ec07fb.1658759380.git.paul@isovalent.com
net/core/filter.c