mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: "David S. Miller" <davem@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix PPP deflate compression
Date: Fri, 8 Aug 2003 09:45:24 +1000	[thread overview]
Message-ID: <16178.58516.629644.824883@cargo.ozlabs.ibm.com> (raw)

This patch fixes two bugs that were stopping PPP compression (and in
particular, Deflate compression) from working.

The first bug was pointed out by Richard Moats.  In the conversion to
use pskb_may_pull, we ended up with a bogus test which basically meant
that the kernel driver never saw the CCP conf-ack packets and thus
never enabled compression.

The second bug crept in with the change of DEFLATE_MIN_SIZE from 8 to
9.  Changing that definition had the unfortunate side-effect of
changing the way that the code interpreted the encoded Deflate
parameter bytes.  This meant that we were using the wrong window size,
twice what we had actually negotiated with the peer.

Please apply.

Paul.

diff -urN linux-2.5/drivers/net/ppp_generic.c pmac-2.5/drivers/net/ppp_generic.c
--- linux-2.5/drivers/net/ppp_generic.c	2003-07-11 10:41:26.000000000 +1000
+++ pmac-2.5/drivers/net/ppp_generic.c	2003-08-07 14:59:13.000000000 +1000
@@ -2073,7 +2073,8 @@
 	case CCP_CONFACK:
 		if ((ppp->flags & (SC_CCP_OPEN | SC_CCP_UP)) != SC_CCP_OPEN)
 			break;
-		if (!pskb_may_pull(skb, len = CCP_LENGTH(dp)) + 2)
+		len = CCP_LENGTH(dp);
+		if (!pskb_may_pull(skb, len + 2))
 			return;		/* too short */
 		dp += CCP_HDRLEN;
 		len -= CCP_HDRLEN;
diff -urN linux-2.5/include/linux/ppp-comp.h pmac-2.5/include/linux/ppp-comp.h
--- linux-2.5/include/linux/ppp-comp.h	2003-06-15 12:12:49.000000000 +1000
+++ pmac-2.5/include/linux/ppp-comp.h	2003-08-07 16:10:06.000000000 +1000
@@ -185,10 +185,9 @@
 #define DEFLATE_MIN_SIZE	9
 #define DEFLATE_MAX_SIZE	15
 #define DEFLATE_METHOD_VAL	8
-#define DEFLATE_SIZE(x)		(((x) >> 4) + DEFLATE_MIN_SIZE)
+#define DEFLATE_SIZE(x)		(((x) >> 4) + 8)
 #define DEFLATE_METHOD(x)	((x) & 0x0F)
-#define DEFLATE_MAKE_OPT(w)	((((w) - DEFLATE_MIN_SIZE) << 4) \
-				 + DEFLATE_METHOD_VAL)
+#define DEFLATE_MAKE_OPT(w)	((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
 #define DEFLATE_CHK_SEQUENCE	0
 
 /*

             reply	other threads:[~2003-08-07 23:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-07 23:45 Paul Mackerras [this message]
2003-08-07 23:56 ` David S. 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=16178.58516.629644.824883@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®