Skip to contentSkip to conversation

Patch "netfilter: bridge: honor frag_max_size when refragmenting" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Dec 18, 2017

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

netfilter: bridge: honor frag_max_size when refragmenting

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
netfilter-bridge-honor-frag_max_size-when-refragmenting.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon Dec 18 14:47:43 CET 2017

From: Florian Westphal <[email protected]>
Date: Thu, 9 Mar 2017 23:22:30 +0100
Subject: netfilter: bridge: honor frag_max_size when refragmenting

From: Florian Westphal <[email protected]>

[ Upstream commit 4ca60d08cbe65f501baad64af50fceba79c19fbb ]

consider a bridge with mtu 9000, but end host sending smaller packets to another host with mtu < 9000.

In this case, after reassembly, bridge+defrag would refragment, and then attempt to send the reassembled packet as long as it was below 9k.

Instead we have to cap by the largest fragment size seen.

---
 net/bridge/br_netfilter_hooks.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
net/bridge/br_netfilter_hooks.c +7 -5
@@ -701,18 +701,20 @@ static unsigned int nf_bridge_mtu_reduct
 
 static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
-	struct nf_bridge_info *nf_bridge;
-	unsigned int mtu_reserved;
+	struct nf_bridge_info *nf_bridge = nf_bridge_info_get(skb);
+	unsigned int mtu, mtu_reserved;
 
 	mtu_reserved = nf_bridge_mtu_reduction(skb);
+	mtu = skb->dev->mtu;
 
-	if (skb_is_gso(skb) || skb->len + mtu_reserved <= skb->dev->mtu) {
+	if (nf_bridge->frag_max_size && nf_bridge->frag_max_size < mtu)
+		mtu = nf_bridge->frag_max_size;
+
+	if (skb_is_gso(skb) || skb->len + mtu_reserved <= mtu) {
 		nf_bridge_info_free(skb);
 		return br_dev_queue_push_xmit(net, sk, skb);
 	}
 
-	nf_bridge = nf_bridge_info_get(skb);
-
 	/* This is wrong! We should preserve the original fragment
 	 * boundaries by preserving frag_list rather than refragmenting.
 	 */

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/netfilter-bridge-honor-frag_max_size-when-refragmenting.patch