Skip to contentSkip to conversation

ppp_generic: fix multilink fragment MTU calculation (again)

PATCH Applied Henry Wong 3 participants 4 messages Sep 18, 2011 – Sep 20, 2011

Subsystems (2)
lore
Share & tools
lore

Henry Wong

author
#0 lore raw

When using MLPPP, the maximum size of a fragment is incorrectly calculated with an offset of -2. This patch reverses the changes in the patch found here: http://marc.info/?l=linux-netdev&m=123541324010539&w=2

The value of hdrlen includes the size of both the 2-byte PPP protocol field and the 2- or 4-byte multilink header (2+4=6 for long sequence numbers, 2+2=4 for short sequence numbers). Section 2 of RFC1661 says that the MRU that is negotiated (i.e., the MTU of the sending system) includes only the PPP payload but not the protocol field, thus the correct MTU should be the link's MTU minus the multilink header (mtu - (hdrlen-2)).

The incorrect calculation causes Linux to fragment packets to a size two bytes smaller than the allowed MTU. While not technically illegal, this behaviour confounds MRU-tuning to avoid PPP-layer fragmentation.

drivers/net/ppp_generic.c +7 -2
diff -urp linux-orig/drivers/net/ppp_generic.c linux-new/drivers/net/ppp_generic.c
@@ -1464,8 +1464,13 @@ static int ppp_mp_explode(struct ppp *pp
 			spin_unlock_bh(&pch->downl);
 			continue;
 		}
-
-		mtu = pch->chan->mtu - hdrlen;
+		
+		/* 
+		 * hdrlen includes the 2-byte PPP protocol field, but the
+		 * MTU counts only the payload excluding the protocol field.
+		 * (RFC1661 Section 2)
+		 */
+		mtu = pch->chan->mtu - (hdrlen - 2);
 		if (mtu < 4)
 			mtu = 4;
 		if (flen > mtu)
Applied
#1 lore raw

From: Henry Wong <[email protected]>
Date: Sun, 18 Sep 2011 19:41:49 -0400

Quoted 13 lines

When using MLPPP, the maximum size of a fragment is incorrectly calculated with an offset of -2.
This patch reverses the changes in the patch found here:
http://marc.info/?l=linux-netdev&m=123541324010539&w=2

The value of hdrlen includes the size of both the 2-byte PPP protocol field and the 2- or 4-byte multilink header (2+4=6 for long sequence numbers, 2+2=4 for short sequence numbers). Section 2 of RFC1661 says that the MRU that is negotiated (i.e., the MTU of the sending system) includes only the PPP payload but not the protocol field, thus the correct MTU should be the link's MTU minus the multilink header (mtu - (hdrlen-2)).

Quoted 5 lines

The incorrect calculation causes Linux to fragment packets to a size two bytes smaller than the allowed MTU. While not technically illegal, this behaviour confounds MRU-tuning to avoid PPP-layer fragmentation.

Applied, thanks.

There were several cases of trailing whitespace in your patch which I needed to fix up. Please don't be so careless in the future.

Thanks.

author
#2 lore raw
Quoted 20 lines · David Miller

From: Henry Wong<[email protected]>
Date: Sun, 18 Sep 2011 19:41:49 -0400

Quoted 17 lines

When using MLPPP, the maximum size of a fragment is incorrectly calculated with an offset of -2.
This patch reverses the changes in the patch found here:
http://marc.info/?l=linux-netdev&m=123541324010539&w=2

The value of hdrlen includes the size of both the 2-byte PPP protocol field and the 2- or 4-byte multilink header (2+4=6 for long sequence numbers, 2+2=4 for short sequence numbers). Section 2 of RFC1661 says that the MRU that is negotiated (i.e., the MTU of the sending system) includes only the PPP payload but not the protocol field, thus the correct MTU should be the link's MTU minus the multilink header (mtu - (hdrlen-2)).

The incorrect calculation causes Linux to fragment packets to a size two bytes smaller than the allowed MTU. While not technically illegal, this behaviour confounds MRU-tuning to avoid PPP-layer fragmentation.

Quoted 8 lines
Quoted 1 line

Applied, thanks.

There were several cases of trailing whitespace in your patch which I needed to fix up. Please don't be so careless in the future.

Thanks.

Thanks.

Out of curiosity, were the trailing whitespaces on Lines 10 and 11? Or was there a problem with file attachments that cause some whitespace I don't see? I'll be more careful next time :)

maintainer
#3 lore raw

From: Henry Wong <[email protected]>
Date: Tue, 20 Sep 2011 15:54:32 -0400

Quoted 3 lines

Out of curiosity, were the trailing whitespaces on Lines 10 and 11? Or was there a problem with file attachments that cause some whitespace I don't see? I'll be more careful next time :)

Both the line before the comment (2 tabs) and the first line of the comment (one space).