Added kernel MPPE patches (2.2.20 kernel only!) from Frank Cusack.
[ppp.git] / linux / mppe / linux-2.2.20-pad.patch
1 --- linux/drivers/net/ppp.c.orig        Sun Mar 25 08:31:15 2001
2 +++ linux/drivers/net/ppp.c     Tue Mar 19 07:15:40 2002
3 @@ -2468,10 +2468,14 @@
4             (proto != PPP_LCP)                  &&
5             (proto != PPP_CCP)) {
6                 struct sk_buff *new_skb;
7 +               int new_skb_size = ppp->mtu + PPP_HDRLEN;
8                 int new_count;
9  
10                 /* Allocate an skb for the compressed frame. */
11 -               new_skb = alloc_skb(ppp->mtu + PPP_HDRLEN, GFP_ATOMIC);
12 +               if (ppp->sc_xcomp->compress_proto == CI_MPPE)
13 +                       /* CCP [must have] reduced MTU by MPPE_PAD. */
14 +                       new_skb_size += MPPE_PAD;
15 +               new_skb = alloc_skb(new_skb_size, GFP_ATOMIC);
16                 if (new_skb == NULL) {
17                         printk(KERN_ERR "ppp_send_frame: no memory\n");
18                         kfree_skb(skb);
19 @@ -2489,12 +2493,25 @@
20                         skb_put(new_skb, new_count);
21                         kfree_skb(skb);
22                         skb = new_skb;
23 -               } else {
24 +               } else if (new_count == 0) {
25                         /*
26                          * The frame could not be compressed, or it could not
27                          * be sent in compressed form because CCP is down.
28                          */
29                         kfree_skb(new_skb);
30 +               } else {
31 +                       /*
32 +                        * (new_count < 0)
33 +                        * MPPE requires that we do not send unencrypted
34 +                        * frames.  The compressor will return -1 if we
35 +                        * should drop the frame.  We cannot simply test
36 +                        * the compress_proto because MPPE and MPPC share
37 +                        * the same number.
38 +                        */
39 +                       printk(KERN_ERR "ppp: compressor dropped pkt\n");
40 +                       kfree_skb(new_skb);
41 +                       ppp->xmit_busy = 0;
42 +                       return;
43                 }
44         }
45