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 xpad; /* ECP or CCP (MPPE) transmit padding */
20 if (get_user(val, (int *) arg))
23 + ppp->mru_alloc = ppp->mru = val;
24 + if (ppp->mru_alloc < PPP_MRU)
25 + ppp->mru_alloc = PPP_MRU; /* increase for broken peers */
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,
35 + new_skb = alloc_skb(ppp->dev->mtu + ppp->dev->hard_header_len
36 + + ppp->xpad, GFP_ATOMIC);
38 printk(KERN_ERR "PPP: no memory (comp pkt)\n");
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
47 if (len > 0 && (ppp->flags & SC_CCP_UP)) {
51 skb_pull(skb, 2); /* pull off A/C bytes */
53 + } else if (len == 0) {
54 /* didn't compress, or CCP not up yet */
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
65 + printk(KERN_ERR "ppp: compressor dropped pkt\n");
71 @@ -1515,14 +1532,15 @@
74 if (proto == PPP_COMP) {
75 - ns = dev_alloc_skb(ppp->mru + PPP_HDRLEN);
76 + ns = dev_alloc_skb(ppp->mru_alloc + PPP_HDRLEN);
78 printk(KERN_ERR "ppp_decompress_frame: no memory\n");
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);
87 /* Pass the compressed frame to pppd as an
89 @@ -1949,6 +1967,20 @@
93 + if (ccp_option[0] == CI_MPPE)
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
104 + ppp->xpad = MPPE_PAD;
110 @@ -2229,6 +2261,7 @@
112 ppp->file.index = unit;
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)