ip_tunnel: replace dst_cache with generic implementation
The current ip_tunnel cache implementation is prone to a race that will cause the wrong dst to be cached on cuncurrent dst cache miss and ip tunnel update via netlink. Replacing with the generic implementation fix the issue. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Suggested-and-acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
607f725f6f
commit
e09acddf87
@@ -13,6 +13,7 @@
|
||||
#include <net/netns/generic.h>
|
||||
#include <net/rtnetlink.h>
|
||||
#include <net/lwtunnel.h>
|
||||
#include <net/dst_cache.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
#include <net/ipv6.h>
|
||||
@@ -85,11 +86,6 @@ struct ip_tunnel_prl_entry {
|
||||
struct rcu_head rcu_head;
|
||||
};
|
||||
|
||||
struct ip_tunnel_dst {
|
||||
struct dst_entry __rcu *dst;
|
||||
__be32 saddr;
|
||||
};
|
||||
|
||||
struct metadata_dst;
|
||||
|
||||
struct ip_tunnel {
|
||||
@@ -108,7 +104,7 @@ struct ip_tunnel {
|
||||
int tun_hlen; /* Precalculated header length */
|
||||
int mlink;
|
||||
|
||||
struct ip_tunnel_dst __percpu *dst_cache;
|
||||
struct dst_cache dst_cache;
|
||||
|
||||
struct ip_tunnel_parm parms;
|
||||
|
||||
@@ -247,7 +243,6 @@ int ip_tunnel_changelink(struct net_device *dev, struct nlattr *tb[],
|
||||
int ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
|
||||
struct ip_tunnel_parm *p);
|
||||
void ip_tunnel_setup(struct net_device *dev, int net_id);
|
||||
void ip_tunnel_dst_reset_all(struct ip_tunnel *t);
|
||||
int ip_tunnel_encap_setup(struct ip_tunnel *t,
|
||||
struct ip_tunnel_encap *ipencap);
|
||||
|
||||
|
Reference in New Issue
Block a user