netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org, nbd@nbd.name
Subject: [RFC 7/9] netfilter: nf_flow_table: move ip header check out of nf_flow_exceeds_mtu
Date: Sat, 17 Feb 2018 12:12:04 +0100	[thread overview]
Message-ID: <20180217111206.37312-7-nbd@nbd.name> (raw)
In-Reply-To: <20180217111206.37312-1-nbd@nbd.name>

Allows the function to be shared with the IPv6 hook code

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/netfilter/nf_flow_table_ip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index 7c97126ace0e..79976c25891b 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -181,9 +181,6 @@ static bool nf_flow_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
 	if (skb->len <= mtu)
 		return false;
 
-	if ((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0)
-		return false;
-
 	if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu))
 		return false;
 
@@ -222,7 +219,8 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
 	flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
 	rt = (const struct rtable *)flow->tuplehash[dir].tuple.dst_cache;
 
-	if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)))
+	if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)) &&
+	    (ip_hdr(skb)->frag_off & htons(IP_DF)) != 0)
 		return NF_ACCEPT;
 
 	if (skb_try_make_writable(skb, sizeof(*iph)))
-- 
2.14.2


  parent reply	other threads:[~2018-02-17 11:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-17 11:11 [RFC 1/9] netfilter: nf_flow_table: use IP_CT_DIR_* values for FLOW_OFFLOAD_DIR_* Felix Fietkau
2018-02-17 11:11 ` [RFC 2/9] netfilter: nf_flow_table: clean up flow_offload_alloc Felix Fietkau
2018-02-17 11:12 ` [RFC 3/9] ipv6: make ip6_dst_mtu_forward inline Felix Fietkau
2018-02-17 11:12 ` [RFC 4/9] netfilter: nf_flow_table: cache mtu in struct flow_offload_tuple Felix Fietkau
2018-02-17 11:12 ` [RFC 5/9] netfilter: nf_flow_table: rename nf_flow_table.c to nf_flow_table_core.c Felix Fietkau
2018-02-17 11:12 ` [RFC 6/9] netfilter: nf_flow_table: move ipv4 offload hook code to nf_flow_table Felix Fietkau
2018-02-17 11:12 ` Felix Fietkau [this message]
2018-02-17 11:12 ` [RFC 8/9] netfilter: nf_flow_table: move ipv6 " Felix Fietkau
2018-02-17 11:12 ` [RFC 9/9] netfilter: nf_flow_table: relax mixed ipv4/ipv6 flowtable dependencies Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180217111206.37312-7-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).