1 From: Pablo Neira Ayuso <pablo@netfilter.org>
2 Date: Tue, 23 Mar 2021 00:56:24 +0100
3 Subject: [PATCH] netfilter: flowtable: move FLOW_OFFLOAD_DIR_MAX away
6 This allows to remove the default case which should not ever happen and
7 that was added to avoid gcc warnings on unhandled FLOW_OFFLOAD_DIR_MAX
10 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
13 --- a/include/net/netfilter/nf_flow_table.h
14 +++ b/include/net/netfilter/nf_flow_table.h
15 @@ -86,8 +86,8 @@ static inline bool nf_flowtable_hw_offlo
16 enum flow_offload_tuple_dir {
17 FLOW_OFFLOAD_DIR_ORIGINAL = IP_CT_DIR_ORIGINAL,
18 FLOW_OFFLOAD_DIR_REPLY = IP_CT_DIR_REPLY,
19 - FLOW_OFFLOAD_DIR_MAX = IP_CT_DIR_MAX
21 +#define FLOW_OFFLOAD_DIR_MAX IP_CT_DIR_MAX
23 struct flow_offload_tuple {
25 --- a/net/netfilter/nf_flow_table_core.c
26 +++ b/net/netfilter/nf_flow_table_core.c
27 @@ -454,8 +454,6 @@ int nf_flow_snat_port(const struct flow_
28 new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_port;
35 return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
36 @@ -482,8 +480,6 @@ int nf_flow_dnat_port(const struct flow_
37 new_port = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_port;
38 hdr->source = new_port;
44 return nf_flow_nat_port(skb, thoff, protocol, port, new_port);
45 --- a/net/netfilter/nf_flow_table_ip.c
46 +++ b/net/netfilter/nf_flow_table_ip.c
47 @@ -96,8 +96,6 @@ static int nf_flow_snat_ip(const struct
48 new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v4.s_addr;
49 iph->daddr = new_addr;
54 csum_replace4(&iph->check, addr, new_addr);
56 @@ -121,8 +119,6 @@ static int nf_flow_dnat_ip(const struct
57 new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v4.s_addr;
58 iph->saddr = new_addr;
63 csum_replace4(&iph->check, addr, new_addr);
65 @@ -371,8 +367,6 @@ static int nf_flow_snat_ipv6(const struc
66 new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.src_v6;
67 ip6h->daddr = new_addr;
73 return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);
74 @@ -396,8 +390,6 @@ static int nf_flow_dnat_ipv6(const struc
75 new_addr = flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_v6;
76 ip6h->saddr = new_addr;
82 return nf_flow_nat_ipv6_l4proto(skb, ip6h, thoff, &addr, &new_addr);