From: Henry Wong <v4l@stuffedcow•net>
To: netdev@vger•kernel.org
Subject: ppp_generic: fix multilink fragment MTU calculation (again)
Date: Sun, 18 Sep 2011 19:41:49 -0400 [thread overview]
Message-ID: <4E7681BD.2040902@stuffedcow.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
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.
Signed-off-by: Henry Wong <henry@stuffedcow•net>
[-- Attachment #2: mlppp-frag-mtu.patch --]
[-- Type: text/x-patch, Size: 646 bytes --]
diff -urp linux-orig/drivers/net/ppp_generic.c linux-new/drivers/net/ppp_generic.c
--- linux-orig/drivers/net/ppp_generic.c 2011-09-18 17:59:18.000000000 -0400
+++ linux-new/drivers/net/ppp_generic.c 2011-09-18 18:05:29.000000000 -0400
@@ -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)
next reply other threads:[~2011-09-18 23:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-18 23:41 Henry Wong [this message]
2011-09-20 19:21 ` ppp_generic: fix multilink fragment MTU calculation (again) David Miller
2011-09-20 19:54 ` Henry Wong
2011-09-20 20:01 ` David Miller
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=4E7681BD.2040902@stuffedcow.net \
--to=v4l@stuffedcow$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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