Commit 5dbaaa44 authored by Paul Mackerras's avatar Paul Mackerras Committed by Stephen Hemminger

[PPP]: Fix two bugs wrt. compression/decompression.

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.
parent 524c95c1
...@@ -2073,7 +2073,8 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound) ...@@ -2073,7 +2073,8 @@ ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound)
case CCP_CONFACK: case CCP_CONFACK:
if ((ppp->flags & (SC_CCP_OPEN | SC_CCP_UP)) != SC_CCP_OPEN) if ((ppp->flags & (SC_CCP_OPEN | SC_CCP_UP)) != SC_CCP_OPEN)
break; 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 */ return; /* too short */
dp += CCP_HDRLEN; dp += CCP_HDRLEN;
len -= CCP_HDRLEN; len -= CCP_HDRLEN;
......
...@@ -185,10 +185,9 @@ struct compressor { ...@@ -185,10 +185,9 @@ struct compressor {
#define DEFLATE_MIN_SIZE 9 #define DEFLATE_MIN_SIZE 9
#define DEFLATE_MAX_SIZE 15 #define DEFLATE_MAX_SIZE 15
#define DEFLATE_METHOD_VAL 8 #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_METHOD(x) ((x) & 0x0F)
#define DEFLATE_MAKE_OPT(w) ((((w) - DEFLATE_MIN_SIZE) << 4) \ #define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
+ DEFLATE_METHOD_VAL)
#define DEFLATE_CHK_SEQUENCE 0 #define DEFLATE_CHK_SEQUENCE 0
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment