1 |
slords |
1.1 |
--- net/ppp_generic.c 2003-09-27 20:51:03.000000000 -0400 |
2 |
|
|
+++ net/ppp_generic.c 2003-10-08 19:08:21.000000000 -0400 |
3 |
|
|
@@ -1045,8 +1045,15 @@ |
4 |
|
|
/* try to do packet compression */ |
5 |
|
|
if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0 |
6 |
|
|
&& proto != PPP_LCP && proto != PPP_CCP) { |
7 |
|
|
- new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len, |
8 |
|
|
- GFP_ATOMIC); |
9 |
|
|
+ int new_skb_size = ppp->dev->mtu + ppp->dev->hard_header_len; |
10 |
|
|
+ int compressor_skb_size = ppp->dev->mtu + PPP_HDRLEN; |
11 |
|
|
+ |
12 |
|
|
+ if (ppp->xcomp->compress_proto == CI_MPPE) { |
13 |
|
|
+ /* CCP [must have] reduced MTU by MPPE_PAD. */ |
14 |
|
|
+ new_skb_size += MPPE_PAD; |
15 |
|
|
+ compressor_skb_size += MPPE_PAD; |
16 |
|
|
+ } |
17 |
|
|
+ new_skb = alloc_skb(new_skb_size, GFP_ATOMIC); |
18 |
|
|
if (new_skb == 0) { |
19 |
|
|
printk(KERN_ERR "PPP: no memory (comp pkt)\n"); |
20 |
|
|
goto drop; |
21 |
|
|
@@ -1058,15 +1065,27 @@ |
22 |
|
|
/* compressor still expects A/C bytes in hdr */ |
23 |
|
|
len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2, |
24 |
|
|
new_skb->data, skb->len + 2, |
25 |
|
|
- ppp->dev->mtu + PPP_HDRLEN); |
26 |
|
|
+ compressor_skb_size); |
27 |
|
|
if (len > 0 && (ppp->flags & SC_CCP_UP)) { |
28 |
|
|
kfree_skb(skb); |
29 |
|
|
skb = new_skb; |
30 |
|
|
skb_put(skb, len); |
31 |
|
|
skb_pull(skb, 2); /* pull off A/C bytes */ |
32 |
|
|
- } else { |
33 |
|
|
+ } else if (len == 0) { |
34 |
|
|
/* didn't compress, or CCP not up yet */ |
35 |
|
|
kfree_skb(new_skb); |
36 |
|
|
+ } else { |
37 |
|
|
+ /* |
38 |
|
|
+ * (len < 0) |
39 |
|
|
+ * MPPE requires that we do not send unencrypted |
40 |
|
|
+ * frames. The compressor will return -1 if we |
41 |
|
|
+ * should drop the frame. We cannot simply test |
42 |
|
|
+ * the compress_proto because MPPE and MPPC share |
43 |
|
|
+ * the same number. |
44 |
|
|
+ */ |
45 |
|
|
+ printk(KERN_ERR "ppp: compressor dropped pkt\n"); |
46 |
|
|
+ kfree_skb(new_skb); |
47 |
|
|
+ goto drop; |
48 |
|
|
} |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
@@ -1571,7 +1590,7 @@ |
52 |
|
|
goto err; |
53 |
|
|
|
54 |
|
|
if (proto == PPP_COMP) { |
55 |
|
|
- ns = dev_alloc_skb(ppp->mru + PPP_HDRLEN); |
56 |
|
|
+ ns = dev_alloc_skb(ppp->mru + 128 + PPP_HDRLEN); |
57 |
|
|
if (ns == 0) { |
58 |
|
|
printk(KERN_ERR "ppp_decompress_frame: no memory\n"); |
59 |
|
|
goto err; |