]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, vxlan, geneve, gre: fix usage of dst_cache on xmit
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 4 Mar 2016 14:15:07 +0000 (15:15 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Mar 2016 18:58:47 +0000 (13:58 -0500)
commitfbf60c86c268715447b442a6fabc31c67f83c537
tree04107358f090b9af10804520f5c613a1b9547267
parent04dee2cf45c527f085f1bdc066fe55783f912eef
bpf, vxlan, geneve, gre: fix usage of dst_cache on xmit

The assumptions from commit 27c0044b7f7f ("net: use dst_cache for vxlan
device"), 8318c30c7b6f ("geneve: add dst caching support") and 1d793a6d29ec
("net/ipv4: add dst cache support for gre lwtunnels") on dst_cache usage
when ip_tunnel_info is used is unfortunately not always valid as assumed.

While it seems correct for ip_tunnel_info front-ends such as OVS, eBPF
however can fill in ip_tunnel_info for consumers like vxlan, geneve or gre
with different remote dsts, tos, etc, therefore they cannot be assumed as
packet independent.

Right now vxlan, geneve, gre would cache the dst for eBPF and every packet
would reuse the same entry that was first created on the initial route
lookup. eBPF doesn't store/cache the ip_tunnel_info, so each skb may have
a different one.

Fix it by adding a flag that checks the ip_tunnel_info. Also the !tos test
in vxlan needs to be handeled differently in this context as it is currently
inferred from ip_tunnel_info as well if present. ip_tunnel_dst_cache_usable()
helper is added for the three tunnel cases, which checks if we can use dst
cache.

Fixes: 27c0044b7f7f ("net: use dst_cache for vxlan device")
Fixes: 8318c30c7b6f ("geneve: add dst caching support")
Fixes: 1d793a6d29ec ("net/ipv4: add dst cache support for gre lwtunnels")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/geneve.c
drivers/net/vxlan.c
include/net/ip_tunnels.h
net/core/filter.c
net/ipv4/ip_gre.c