1 --- linux-2.4.18/drivers/net/ppp_generic.c.orig Mon May 12 01:36:31 2003
2 +++ linux-2.4.18/drivers/net/ppp_generic.c Mon May 12 03:09:13 2003
4 spinlock_t rlock; /* lock for receive side */
5 spinlock_t wlock; /* lock for transmit side */
6 int mru; /* max receive unit */
7 + int mru_alloc; /* MAX(1500,MRU) for dev_alloc_skb() */
8 unsigned int flags; /* control bits */
9 unsigned int xstate; /* transmit state bits */
10 unsigned int rstate; /* receive state bits */
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 comp_pad; /* padding for compressor (MPPE) */
20 if (get_user(val, (int *) arg))
23 + if (ppp->mru > ppp->mru_alloc)
24 + ppp->mru_alloc = ppp->mru;
25 + else if (ppp->mru < PPP_MRU)
26 + ppp->mru_alloc = PPP_MRU; /* shrink to minimum */
31 /* try to do packet compression */
32 if ((ppp->xstate & SC_COMP_RUN) && ppp->xc_state != 0
33 && proto != PPP_LCP && proto != PPP_CCP) {
34 - new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len,
36 + new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len
37 + + ppp->comp_pad, GFP_ATOMIC);
39 printk(KERN_ERR "PPP: no memory (comp pkt)\n");
41 @@ -1019,15 +1025,28 @@
42 /* compressor still expects A/C bytes in hdr */
43 len = ppp->xcomp->compress(ppp->xc_state, skb->data - 2,
44 new_skb->data, skb->len + 2,
45 - ppp->dev->mtu + PPP_HDRLEN);
46 + ppp->dev->mtu + ppp->comp_pad
48 if (len > 0 && (ppp->flags & SC_CCP_UP)) {
52 skb_pull(skb, 2); /* pull off A/C bytes */
54 + } else if (len == 0) {
55 /* didn't compress, or CCP not up yet */
60 + * MPPE requires that we do not send unencrypted
61 + * frames. The compressor will return -1 if we
62 + * should drop the frame. We cannot simply test
63 + * the compress_proto because MPPE and MPPC share
66 + printk(KERN_ERR "ppp: compressor dropped pkt\n");
72 @@ -1515,14 +1534,15 @@
75 if (proto == PPP_COMP) {
76 - ns = dev_alloc_skb(ppp->mru + PPP_HDRLEN);
77 + ns = dev_alloc_skb(ppp->mru_alloc + PPP_HDRLEN);
79 printk(KERN_ERR "ppp_decompress_frame: no memory\n");
82 /* the decompressor still expects the A/C bytes in the hdr */
83 len = ppp->rcomp->decompress(ppp->rc_state, skb->data - 2,
84 - skb->len + 2, ns->data, ppp->mru + PPP_HDRLEN);
85 + skb->len + 2, ns->data,
86 + ppp->mru_alloc + PPP_HDRLEN);
88 /* Pass the compressed frame to pppd as an
90 @@ -1949,6 +1969,20 @@
94 + if (ccp_option[0] == CI_MPPE)
96 + * pppd (userland) has reduced the MTU by MPPE_PAD,
97 + * to accomodate "compressor" growth. We must
98 + * increase the space allocated for compressor
99 + * output in ppp_send_frame() accordingly. Note
100 + * that from a purist's view, it may be more correct
101 + * to require multilink and fragment large packets,
102 + * but that seems inefficient compared to this
105 + ppp->comp_pad = MPPE_PAD;
111 @@ -2229,6 +2263,7 @@
113 ppp->file.index = unit;
115 + ppp->mru_alloc = PPP_MRU;
116 init_ppp_file(&ppp->file, INTERFACE);
117 ppp->file.hdrlen = PPP_HDRLEN - 2; /* don't count proto bytes */
118 for (i = 0; i < NUM_NP; ++i)