Re: [2.1.54/55] who owns ppp.c? (PATCH)

B. James Phillippe (bryan@Terran.ORG)
Sun, 14 Sep 1997 11:43:14 -0700 (PDT)


On Sun, 14 Sep 1997, Al Longyear wrote:

> B. James Phillippe wrote:
>
> > Pardon me if I'm not understanding something correctly, I'm a
> > little green with this. But, I've been under the impression that
> > ppp-2.3.1 is the current definitive ppp distribution, with the Linux port
> > being maintained by Al Lonyear.
>
> I try to keep it up to date. However, I have been unable to run the 2.1
> series kernels before 2.1.50 because they would not build with my
> configuration.
>
> (Also, I have been spending the past seven months trying to start a new
> business and as most anyone who has done that will tell you that it is
> a 12 hour, 7 day a week 'job'. It was much easier just working for someone
> else. :) )

Wow, I can understand the massive consumption of time and energy! I hope
all goes well for you (thanks for taking the time to write back, too).

> > Now the fun part.. the 2.1.54 patch makes changes to (the
> > original) ppp.c. The changes themselves occur after the release of
> > ppp-2.3.1's copy of ppp.c, yet the distribution copy is still dated later
> > (someone forget to update ==FILEVERSION?) I'm deducing that ppp is
> > undergoing parallel maintainance and I'm wondering if this is going to
> > confuse someone (more important than I :) down the road.
<snip>
> So, in order to try to determine if the driver in the kernel is newer than
> the one with the pppd package, I added a stamp to the files in the kernel
> and the driver. This is the ==FILEVERSION== tag.
>
> I had hoped that the people who changed the driver in the kernel by sending
> patches to Linus when the networking logic is changed would have updated the
> date tag.

I understand that. What confused me was that the changes being made to
ppp.c were being made to the older ppp driver, rather the one from 2.3.1.
If the FILEVERSION tag had been updated, it would cause the ppp package
installation script to skip installing ppp.c which would totally bust the
ppp code in the kernel. I was under the impression that if people were
going to modify the ppp driver they would modify (or incorporate) the
latest one from ppp-2.3.1. Perhaps it's time to roll the files from
ppp-2.3.1 back into 2.1?

In any case, I was able to get ppp-2.3.1 running under kernel 2.1.55 and
it seems to be working quite nicely. Additionally, I made the following
changes to the file ppp.c, to make it compile and work correctly against
2.0.30 and 2.1.55. Note that this takes precedence over the last patch I
sent (which caused an Oops :) I'd appreciate any comments on the patch.

thanks,
-bp

--
B. James Phillippe <bryan@Terran.ORG>
UNIX, Linux, networks, programming, etc.
NIC:BJP4 # http://w3.terran.org/~bryan

--- ppp.c.orig Sun Sep 14 11:37:51 1997 +++ ppp.c Sun Sep 14 11:39:18 1997 @@ -6,7 +6,7 @@ * Dynamic PPP devices by Jim Freeman <jfree@caldera.com>. * ppp_tty_receive ``noisy-raise-bug'' fixed by Ove Ewerlid <ewerlid@syscon.uu.se> * - * ==FILEVERSION 970626== + * ==FILEVERSION 970914== * * NOTE TO MAINTAINERS: * If you modify this file at all, please set the number above to the @@ -214,7 +214,6 @@ */ static int flag_time = OPTIMIZE_FLAG_TIME; -static int max_dev = PPP_MAX_DEV; #if LINUX_VERSION_CODE >= VERSION(2,1,19) MODULE_PARM(flag_time, "i"); @@ -455,7 +454,7 @@ dev->rebuild_header = ppp_dev_rebuild; #endif - dev->hard_header_len = PPP_HARD_HDR_LEN; + dev->hard_header_len = PPP_HDRLEN; /* device INFO */ dev->mtu = PPP_MTU; @@ -2196,6 +2195,7 @@ struct ppp *ppp = tty2ppp (tty); __u8 *new_data; int proto; + int error; /* * Verify the pointers. @@ -2231,7 +2231,12 @@ /* * Retrieve the user's buffer */ - if (copy_from_user (new_data, data, count)) { + COPY_FROM_USER (error, + new_data, + data, + count); + + if ( error ) { kfree (new_data); return -EFAULT; } @@ -2266,6 +2271,8 @@ /* * Send the data */ + proto = PPP_PROTOCOL (new_data); + if (proto == PPP_IP) { /* * IP frames can be sent by pppd when we're doing @@ -3149,7 +3156,11 @@ if (ppp->tbuf->locked || lock_buffer (ppp->wbuf) != 0) { dev->tbusy = 1; if (ppp->flags & SC_DEBUG) +#if LINUX_VERSION_CODE >= VERSION(2,1,0) /* FIX ME!!!!!!!!!!!!! */ + printk(KERN_DEBUG "dev_xmit blocked, t=%ld w=%ld\n", +#else printk(KERN_DEBUG "dev_xmit blocked, t=%d w=%d\n", +#endif ppp->tbuf->locked, ppp->wbuf->locked); return 1; } @@ -3257,7 +3268,7 @@ /* try to find an free device */ if_num = 0; for (ppp = ppp_list; ppp != 0; ppp = ppp->next) { - if (!set_bit(0, &ppp->inuse)) + if (!test_and_set_bit(0, &ppp->inuse)) return ppp; ++if_num; } @@ -3270,7 +3281,7 @@ memset(ppp, 0, sizeof(*ppp)); /* initialize channel control data */ - set_bit(0, &ppp->inuse); + test_and_set_bit(0, &ppp->inuse); ppp->line = if_num; ppp->tty = NULL;