]> git.ozlabs.org Git - ppp.git/blobdiff - linux/mppe/linux-2.2.20-pad.patch
Added kernel MPPE patches (2.2.20 kernel only!) from Frank Cusack.
[ppp.git] / linux / mppe / linux-2.2.20-pad.patch
diff --git a/linux/mppe/linux-2.2.20-pad.patch b/linux/mppe/linux-2.2.20-pad.patch
new file mode 100644 (file)
index 0000000..a0b714a
--- /dev/null
@@ -0,0 +1,45 @@
+--- linux/drivers/net/ppp.c.orig       Sun Mar 25 08:31:15 2001
++++ linux/drivers/net/ppp.c    Tue Mar 19 07:15:40 2002
+@@ -2468,10 +2468,14 @@
+           (proto != PPP_LCP)                  &&
+           (proto != PPP_CCP)) {
+               struct sk_buff *new_skb;
++              int new_skb_size = ppp->mtu + PPP_HDRLEN;
+               int new_count;
+               /* Allocate an skb for the compressed frame. */
+-              new_skb = alloc_skb(ppp->mtu + PPP_HDRLEN, GFP_ATOMIC);
++              if (ppp->sc_xcomp->compress_proto == CI_MPPE)
++                      /* CCP [must have] reduced MTU by MPPE_PAD. */
++                      new_skb_size += MPPE_PAD;
++              new_skb = alloc_skb(new_skb_size, GFP_ATOMIC);
+               if (new_skb == NULL) {
+                       printk(KERN_ERR "ppp_send_frame: no memory\n");
+                       kfree_skb(skb);
+@@ -2489,12 +2493,25 @@
+                       skb_put(new_skb, new_count);
+                       kfree_skb(skb);
+                       skb = new_skb;
+-              } else {
++              } else if (new_count == 0) {
+                       /*
+                        * The frame could not be compressed, or it could not
+                        * be sent in compressed form because CCP is down.
+                        */
+                       kfree_skb(new_skb);
++              } else {
++                      /*
++                       * (new_count < 0)
++                       * MPPE requires that we do not send unencrypted
++                       * frames.  The compressor will return -1 if we
++                       * should drop the frame.  We cannot simply test
++                       * the compress_proto because MPPE and MPPC share
++                       * the same number.
++                       */
++                      printk(KERN_ERR "ppp: compressor dropped pkt\n");
++                      kfree_skb(new_skb);
++                      ppp->xmit_busy = 0;
++                      return;
+               }
+       }