generic: 5.15: copy config and patch from 5.10
[openwrt/staging/dedeckeh.git] / target / linux / generic / backport-5.15 / 610-v5.13-08-netfilter-flowtable-call-dst_check-to-fall-back-to-c.patch
1 From: Pablo Neira Ayuso <pablo@netfilter.org>
2 Date: Tue, 23 Mar 2021 00:56:26 +0100
3 Subject: [PATCH] netfilter: flowtable: call dst_check() to fall back to
4 classic forwarding
5
6 In case the route is stale, pass up the packet to the classic forwarding
7 path for re-evaluation and schedule this flow entry for removal.
8
9 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
10 ---
11
12 --- a/net/netfilter/nf_flow_table_ip.c
13 +++ b/net/netfilter/nf_flow_table_ip.c
14 @@ -197,14 +197,6 @@ static bool nf_flow_exceeds_mtu(const st
15 return true;
16 }
17
18 -static int nf_flow_offload_dst_check(struct dst_entry *dst)
19 -{
20 - if (unlikely(dst_xfrm(dst)))
21 - return dst_check(dst, 0) ? 0 : -1;
22 -
23 - return 0;
24 -}
25 -
26 static unsigned int nf_flow_xmit_xfrm(struct sk_buff *skb,
27 const struct nf_hook_state *state,
28 struct dst_entry *dst)
29 @@ -256,7 +248,7 @@ nf_flow_offload_ip_hook(void *priv, stru
30
31 flow_offload_refresh(flow_table, flow);
32
33 - if (nf_flow_offload_dst_check(&rt->dst)) {
34 + if (!dst_check(&rt->dst, 0)) {
35 flow_offload_teardown(flow);
36 return NF_ACCEPT;
37 }
38 @@ -476,7 +468,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
39
40 flow_offload_refresh(flow_table, flow);
41
42 - if (nf_flow_offload_dst_check(&rt->dst)) {
43 + if (!dst_check(&rt->dst, 0)) {
44 flow_offload_teardown(flow);
45 return NF_ACCEPT;
46 }