Skip to content

Commit

Permalink
netfilter: nf_flow_table: remove unnecessary nat flag check code
Browse files Browse the repository at this point in the history
nf_flow_offload_{ip/ipv6}_hook() check nat flag then, call
nf_flow_nat_{ip/ipv6} but that also check nat flag. so that
nat flag check code in nf_flow_offload_{ip/ipv6}_hook() are unnecessary.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Taehee Yoo authored and Pablo Neira Ayuso committed Sep 28, 2018
1 parent b473a1f commit 28c5ed2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/netfilter/nf_flow_table_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
if (nf_flow_state_check(flow, ip_hdr(skb)->protocol, skb, thoff))
return NF_ACCEPT;

if (flow->flags & (FLOW_OFFLOAD_SNAT | FLOW_OFFLOAD_DNAT) &&
nf_flow_nat_ip(flow, skb, thoff, dir) < 0)
if (nf_flow_nat_ip(flow, skb, thoff, dir) < 0)
return NF_DROP;

flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT;
Expand Down Expand Up @@ -471,8 +470,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
if (skb_try_make_writable(skb, sizeof(*ip6h)))
return NF_DROP;

if (flow->flags & (FLOW_OFFLOAD_SNAT | FLOW_OFFLOAD_DNAT) &&
nf_flow_nat_ipv6(flow, skb, dir) < 0)
if (nf_flow_nat_ipv6(flow, skb, dir) < 0)
return NF_DROP;

flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT;
Expand Down

0 comments on commit 28c5ed2

Please sign in to comment.