]> git.ozlabs.org Git - ppp.git/blob - linux/mppe/linux-2.4.19-pad.patch
Run ntlm_auth as the user that invoked pppd.
[ppp.git] / linux / mppe / linux-2.4.19-pad.patch
1 --- linux-2.4.19/drivers/net/ppp_generic.c.orig Mon May 12 01:36:31 2003
2 +++ linux-2.4.19/drivers/net/ppp_generic.c      Mon May 12 03:09:13 2003
3 @@ -99,6 +99,7 @@
4         spinlock_t      rlock;          /* lock for receive side 58 */
5         spinlock_t      wlock;          /* lock for transmit side 5c */
6         int             mru;            /* max receive unit 60 */
7 +       int             mru_alloc;      /* MAX(1500,MRU) for dev_alloc_skb() */
8         unsigned int    flags;          /* control bits 64 */
9         unsigned int    xstate;         /* transmit state bits 68 */
10         unsigned int    rstate;         /* receive state bits 6c */
11 @@ -126,6 +127,7 @@
12         struct sock_fprog pass_filter;  /* filter for packets to pass */
13         struct sock_fprog active_filter;/* filter for pkts to reset idle */
14  #endif /* CONFIG_PPP_FILTER */
15 +       int             xpad;           /* ECP or CCP (MPPE) transmit padding */
16  };
17  
18  /*
19 @@ -531,6 +533,8 @@
20                 if (get_user(val, (int *) arg))
21                         break;
22 -               ppp->mru = val;
23 +               ppp->mru_alloc = ppp->mru = val;
24 +               if (ppp->mru_alloc < PPP_MRU)
25 +                   ppp->mru_alloc = PPP_MRU;   /* increase for broken peers */
26                 err = 0;
27                 break;
28  
29 @@ -1006,8 +1010,8 @@
30         /* try to do packet compression */
31         if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0
32             && proto != PPP_LCP && proto != PPP_CCP) {
33 -               new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len,
34 -                                   GFP_ATOMIC);
35 +               new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len
36 +                                   + ppp->xpad, GFP_ATOMIC);
37                 if (new_skb == 0) {
38                         printk(KERN_ERR "PPP: no memory (comp pkt)\n");
39                         goto drop;
40 @@ -1019,15 +1023,28 @@
41                 /* compressor still expects A/C bytes in hdr */
42                 len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2,
43                                            new_skb->data, skb->len + 2,
44 -                                          ppp->dev->mtu + PPP_HDRLEN);
45 +                                          ppp->dev->mtu + ppp->xpad
46 +                                          + PPP_HDRLEN);
47                 if (len > 0 && (ppp->flags & SC_CCP_UP)) {
48                         kfree_skb(skb);
49                         skb = new_skb;
50                         skb_put(skb, len);
51                         skb_pull(skb, 2);       /* pull off A/C bytes */
52 -               } else {
53 +               } else if (len == 0) {
54                         /* didn't compress, or CCP not up yet */
55                         kfree_skb(new_skb);
56 +               } else {
57 +                       /*
58 +                        * (len < 0)
59 +                        * MPPE requires that we do not send unencrypted
60 +                        * frames.  The compressor will return -1 if we
61 +                        * should drop the frame.  We cannot simply test
62 +                        * the compress_proto because MPPE and MPPC share
63 +                        * the same number.
64 +                        */
65 +                       printk(KERN_ERR "ppp: compressor dropped pkt\n");
66 +                       kfree_skb(new_skb);
67 +                       goto drop;
68                 }
69         }
70  
71 @@ -1515,14 +1532,15 @@
72         int len;
73  
74         if (proto == PPP_COMP) {
75 -               ns = dev_alloc_skb(ppp->mru + PPP_HDRLEN);
76 +               ns = dev_alloc_skb(ppp->mru_alloc + PPP_HDRLEN);
77                 if (ns == 0) {
78                         printk(KERN_ERR "ppp_decompress_frame: no memory\n");
79                         goto err;
80                 }
81                 /* the decompressor still expects the A/C bytes in the hdr */
82                 len = ppp->rcomp->decompress(ppp->rc_state, skb->data - 2,
83 -                               skb->len + 2, ns->data, ppp->mru + PPP_HDRLEN);
84 +                               skb->len + 2, ns->data,
85 +                               ppp->mru_alloc + PPP_HDRLEN);
86                 if (len < 0) {
87                         /* Pass the compressed frame to pppd as an
88                            error indication. */
89 @@ -1949,6 +1967,20 @@
90                         ppp_xmit_unlock(ppp);
91                         err = 0;
92                 }
93 +               if (ccp_option[0] == CI_MPPE)
94 +                       /*
95 +                        * pppd (userland) has reduced the MTU by MPPE_PAD,
96 +                        * to accomodate "compressor" growth.  We must
97 +                        * increase the space allocated for compressor
98 +                        * output in ppp_send_frame() accordingly.  Note
99 +                        * that from a purist's view, it may be more correct
100 +                        * to require multilink and fragment large packets,
101 +                        * but that seems inefficient compared to this
102 +                        * little trick.
103 +                        */
104 +                       ppp->xpad = MPPE_PAD;
105 +               else
106 +                       ppp->xpad = 0;
107  
108         } else {
109                 ppp_recv_lock(ppp);
110 @@ -2229,6 +2261,7 @@
111  
112         ppp->file.index = unit;
113         ppp->mru = PPP_MRU;
114 +       ppp->mru_alloc = PPP_MRU;
115         init_ppp_file(&ppp->file, INTERFACE);
116         ppp->file.hdrlen = PPP_HDRLEN - 2;      /* don't count proto bytes */
117         for (i = 0; i < NUM_NP; ++i)