linux-ppp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylvain Rochet <sylvain.rochet@finsecur.com>
To: Paul Mackerras <paulus@samba.org>,
	linux-ppp@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>
Cc: Sylvain Rochet <sylvain.rochet@finsecur.com>
Subject: [PATCH 2/2] ppp: mppe: discard late packet in stateless mode
Date: Sun, 26 Apr 2015 18:40:53 +0000	[thread overview]
Message-ID: <1430073653-22131-3-git-send-email-sylvain.rochet@finsecur.com> (raw)
In-Reply-To: <1430073653-22131-1-git-send-email-sylvain.rochet@finsecur.com>

When PPP is used over a link which does not guarantee packet ordering,
we might get late MPPE packets. This is a problem because MPPE must be
kept synchronized and the current implementation does not drop them and
rekey 4095 times instead of 0, which is wrong.

In order to prevent rekeying about a whole count space times (~ 4095
times), drop packets which are not within the forward 4096/2 window and
increase sanity error counter.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
---
 drivers/net/ppp/ppp_mppe.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ppp/ppp_mppe.c b/drivers/net/ppp/ppp_mppe.c
index 692ee0f..05005c6 100644
--- a/drivers/net/ppp/ppp_mppe.c
+++ b/drivers/net/ppp/ppp_mppe.c
@@ -533,6 +533,13 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
 	 */
 
 	if (!state->stateful) {
+		/* Discard late packet */
+		if ((ccount - state->ccount) % MPPE_CCOUNT_SPACE
+						> MPPE_CCOUNT_SPACE / 2) {
+			state->sanity_errors++;
+			goto sanity_error;
+		}
+
 		/* RFC 3078, sec 8.1.  Rekey for every packet. */
 		while (state->ccount != ccount) {
 			mppe_rekey(state, 0);
-- 
2.1.4


  parent reply	other threads:[~2015-04-26 18:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26 18:40 [PATCH 0/2] ppp: mppe: fixes MPPE desync on links which don't guarantee packet ordering Sylvain Rochet
2015-04-26 18:40 ` [PATCH 1/2] ppp: mppe: sanity error path rework Sylvain Rochet
2015-04-26 18:40 ` Sylvain Rochet [this message]
2015-04-27  3:26 ` [PATCH 0/2] ppp: mppe: fixes MPPE desync on links which don't guarantee packet ordering 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=1430073653-22131-3-git-send-email-sylvain.rochet@finsecur.com \
    --to=sylvain.rochet@finsecur.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulus@samba.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).