A bug, a quirk/buglet, a minor cleanup, and a question...

Greg Alexander (galexand@sietch.bloomington.in.us)
Fri, 20 Mar 1998 16:25:45 -0500 (EST)


The bug is this: the ppp0 interface no longer downs itself when it
hangs up. I'm not sure why the code was ripped out of ppp_release() that
did this, but I put it back. This code needs to be there or else the
MOD_DEC_USE; is improper (if it gets removed with the device up, the net
device list gets corrupted and reads from /proc/net/dev cause oopses and
sometimes the whole shebang goes splat). The first attached patch should
fix problems people may have been having with kmod unloading the ppp module
and causing Bad Things.
The buglet is this: An ioctl(SIOCGIFFLAGS) with ifr.ifr_name="ppp0"
will cause request_module("ppp0"); to get called, even if the ppp module is
already loaded. This can happen because the ppp module doesn't actually
register net devices until they're needed. This is a problem because I have
a program reporting system status on LED's (modified version of portato)
that calls ioctl(SIOCGIFFLAGS) to see if ppp0 is up. It calls the ioctl
fairly frequently, resulting in a fairly heavy system load if each ioctl
results in modprobe being launched. I don't know how or if this should be
fixed, I'll just make portato only call the ioctl if /proc/modules includes
ppp.
The minor cleanup is just making two functions static that don't
need to be global in net/core/dev.c. I don't know how much everyone cares,
but I think it's quite messy to randomly clutter kernel space, even if it is
with fairly unique stuff like dev_get_info. I only bother to change the
ones that I see, I'm not actually searching for them unless someone thinks I
should.
I was wondering why my klogd seems to die now during bootup, but
then it stays up okay if I run klogd manually. I was also wondering why
klogd complained about not being able to seek in /dev/kmem and why /dev/kmem
has changed (it shouldn't be that small, should it?).

Greg Alexander - also <gralexan@indiana.edu> - http://sietch.home.ml.org/
----
"Text processing has made it possible to right-justify any idea, even
one which cannot be justified on any other grounds."
-- J. Finnegan, USC.
-----------------------------------------------------------------------
--- drivers/net/ppp.c.orig Thu Mar 12 13:33:21 1998
+++ drivers/net/ppp.c Fri Mar 20 15:03:07 1998
@@ -8,7 +8,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 980123==
+ * ==FILEVERSION 980320==
*
* NOTE TO MAINTAINERS:
* If you modify this file at all, please set the number above to the
@@ -312,9 +312,9 @@
* INITIALIZATION
*************************************************************/

-/* This procedure is called once and once only to define who we are to
- * the operating system and the various procedures that it may use in
- * accessing the ppp protocol.
+/* This procedure is called once on kernel boot or once for every time that
+ * the ppp module is loaded to register ourselves with the tty code as a
+ * line discipline.
*/

__initfunc(static int
@@ -685,6 +685,11 @@
if (tty != NULL && tty->disc_data == ppp)
tty->disc_data = NULL; /* Break the tty->ppp link */

+ if (dev && dev->flags & IFF_UP) {
+ dev_close (dev); /* close the device properly */
+ dev->flags &= ~IFF_UP; /* prevent recursion */
+ }
+
ppp_free_buf (ppp->rbuf);
ppp_free_buf (ppp->wbuf);
ppp_free_buf (ppp->cbuf);
@@ -3267,7 +3272,7 @@
status = ppp_first_time();
if (status != 0)
printk (KERN_INFO
- "PPP: ppp_init() failure %d\n", status);
+ "PPP: ppp_first_time() failure %d\n", status);
return (status);
}

-----------------------------------------------------------------------
--- net/core/dev.c.orig Fri Mar 20 12:35:59 1998
+++ net/core/dev.c Fri Mar 20 12:40:12 1998
@@ -1123,7 +1123,7 @@
* to create /proc/net/dev
*/

-int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
+static int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy)
{
int len=0;
off_t begin=0;
@@ -1239,7 +1239,7 @@
* Print info for /proc/net/wireless (print all entries)
* This is a clone of /proc/net/dev (just above)
*/
-int dev_get_wireless_info(char * buffer, char **start, off_t offset,
+static int dev_get_wireless_info(char * buffer, char **start, off_t offset,
int length, int dummy)
{
int len = 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu