A tunnel_key action flagged skip_sw never routes packets and the
dst_cache helpers handle a missing cache. A replace leaves the flags of
an existing action unchanged, check these rather than the request ones.
Signed-off-by: Alexandre Cassen <redacted>
---
net/sched/act_tunnel_key.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 503834853306..28d9cc080101 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -481,9 +481,13 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
}
#ifdef CONFIG_DST_CACHE
- ret = dst_cache_init(&metadata->u.tun_info.dst_cache, GFP_KERNEL);
- if (ret)
- goto release_tun_meta;
+ if (!((exists ? (*a)->tcfa_flags : act_flags) &
+ TCA_ACT_FLAGS_SKIP_SW)) {
+ ret = dst_cache_init(&metadata->u.tun_info.dst_cache,
+ GFP_KERNEL);
+ if (ret)
+ goto release_tun_meta;
+ }
#endif
if (opts_len) {--
2.43.0