diff options
author | Felix Fietkau <nbd@nbd.name> | 2018-03-23 17:18:00 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-03-23 19:16:12 +0100 |
commit | 48d17551b6a191b596d87a9b64ed69e96b55f1d8 (patch) | |
tree | 1fd9ade42683c05456dd2a369817bacdfa870192 /target | |
parent | 02fba1a181950e8e0b6bfc67e33000a38af82b19 (diff) | |
download | upstream-48d17551b6a191b596d87a9b64ed69e96b55f1d8.tar.gz upstream-48d17551b6a191b596d87a9b64ed69e96b55f1d8.tar.bz2 upstream-48d17551b6a191b596d87a9b64ed69e96b55f1d8.zip |
kernel: fix flow offload UDP handling issue
Only run the TCP state check for TCP connections
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/generic/backport-4.14/367-netfilter-nf_flow_table-add-missing-condition-for-TC.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/target/linux/generic/backport-4.14/367-netfilter-nf_flow_table-add-missing-condition-for-TC.patch b/target/linux/generic/backport-4.14/367-netfilter-nf_flow_table-add-missing-condition-for-TC.patch new file mode 100644 index 0000000000..2a470f77e3 --- /dev/null +++ b/target/linux/generic/backport-4.14/367-netfilter-nf_flow_table-add-missing-condition-for-TC.patch @@ -0,0 +1,48 @@ +From: Felix Fietkau <nbd@nbd.name> +Date: Fri, 23 Mar 2018 17:15:22 +0100 +Subject: [PATCH] netfilter: nf_flow_table: add missing condition for TCP state + check + +Avoid looking at unrelated fields in UDP packets + +Signed-off-by: Felix Fietkau <nbd@nbd.name> +--- + +--- a/net/netfilter/nf_flow_table_ip.c ++++ b/net/netfilter/nf_flow_table_ip.c +@@ -15,11 +15,14 @@ + #include <linux/tcp.h> + #include <linux/udp.h> + +-static int nf_flow_tcp_state_check(struct flow_offload *flow, +- struct sk_buff *skb, unsigned int thoff) ++static int nf_flow_state_check(struct flow_offload *flow, int proto, ++ struct sk_buff *skb, unsigned int thoff) + { + struct tcphdr *tcph; + ++ if (proto != IPPROTO_TCP) ++ return 0; ++ + if (!pskb_may_pull(skb, thoff + sizeof(*tcph))) + return -1; + +@@ -248,7 +251,7 @@ nf_flow_offload_ip_hook(void *priv, stru + return NF_DROP; + + thoff = ip_hdr(skb)->ihl * 4; +- if (nf_flow_tcp_state_check(flow, skb, thoff)) ++ if (nf_flow_state_check(flow, ip_hdr(skb)->protocol, skb, thoff)) + return NF_ACCEPT; + + if (flow->flags & (FLOW_OFFLOAD_SNAT | FLOW_OFFLOAD_DNAT) && +@@ -460,7 +463,8 @@ nf_flow_offload_ipv6_hook(void *priv, st + if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu))) + return NF_ACCEPT; + +- if (nf_flow_tcp_state_check(flow, skb, sizeof(*ip6h))) ++ if (nf_flow_state_check(flow, ipv6_hdr(skb)->nexthdr, skb, ++ sizeof(*ip6h))) + return NF_ACCEPT; + + if (skb_try_make_writable(skb, sizeof(*ip6h))) |