Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: interface name - module name assoc SOLVED
- To: <tlug@example.com>
- Subject: Re: interface name - module name assoc SOLVED
- From: "roylo" <roylo@example.com>
- Date: Tue, 4 Sep 2001 17:32:32 -0700
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain;charset="iso-8859-1"
- Delivered-To: tlug@example.com
- List-Help: <mailto:tlug-request@example.comsubject=help>
- List-Post: <mailto:tlug@example.com>
- List-Subscribe: <mailto:tlug-request@example.comsubject=subscribe>
- List-Unsubscribe: <mailto:tlug-request@example.comsubject=unsubscribe>
- Old-Return-Path: <roylo@example.com>
- References: <Pine.GSO.4.05.10109041717470.451-100000@example.com>
- Reply-To: tlug@example.com
- Resent-From: tlug@example.com
- Resent-Message-ID: <1NdcYB.A.aTD.ZKXl7@example.com>
- Resent-Sender: tlug-request@example.com
don't know about that one the one I have is alan@example.com ----- Original Message ----- From: "Scott M. Stone" <sstone@example.com> To: <tlug@example.com> Sent: Tuesday, September 04, 2001 5:18 PM Subject: Re: interface name - module name assoc SOLVED > On Tue, 4 Sep 2001, roylo wrote: > > > Great! ^_^ > > > > why don't you submit this to Alan Cox, that way everyone can benefit from it > > ? > > yes, I'm going to do that. is it still "alan@example.com" ? > > > > > > > > > > > ----- Original Message ----- > > From: "Scott M. Stone" <sstone@example.com> > > To: "Tokyo Linux Users' Group" <tlug@example.com> > > Sent: Tuesday, September 04, 2001 4:04 PM > > Subject: interface name - module name assoc SOLVED > > > > > > > > > > Ok, well, I did have to write a kernel module, but this should work on all > > > machines and reliably tell you "what driver module is the owner of the > > > interface", assuming you're using dynamic modules for your network > > > drivers. Amazingly enough, I did NOT manage to crash my system while > > > testing this thing, I guess I got lucky this time :) > > > > > > compile with: > > > > > > gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -o ndmassoc.o -c ndmassoc.c > > > > > > then, > > > > > > insmod ./ndmassoc.o > > > > > > then > > > > > > cat /proc/ndmassoc > > > > > > the number is the "interface index number" as seen by the kernel, if > > > you're wondering. > > > > > > rmmod ndmassoc > > > > > > will get rid of it. > > > > > > > > > --cut here-- > > > > > > /* ndmassoc.c > > > this driver provides /proc/ndmassoc, which lets you associate network > > > devices with > > > the module that owns it. > > > > > > this code released under the terms of the GNU GPL > > > (C) 2001 by Scott Stone <sstone@example.com> > > > > > > This module comes with NO WARRANTY - if it breaks your kernel, reboot > > and > > > don't load it > > > again, or try it again, and be angry. It's really up to you, but I > > take > > > no responsibility either way. > > > */ > > > > > > #include <linux/kernel.h> > > > #include <linux/module.h> > > > #if CONFIG_MODVERSIONS==1 > > > #define MODVERSIONS > > > #include <linux/modversions.h> > > > #endif > > > #include <linux/proc_fs.h> > > > #include <linux/netdevice.h> > > > > > > #define MODNAME "ndmassoc" > > > #define VERSION "1.0.0" > > > #define COPYRIGHT "(C) 2001 by Scott Stone <sstone@example.com>" > > > #define MAX_INTERFACES 50 > > > #define BUFFER_SIZE ((MAX_INTERFACES * 80) + 1) > > > > > > int procfile_read(char *buffer, char **buffer_location, off_t offset, int > > buffer_length, int *eof, void *data) { > > > int len=0; > > > static char my_buffer[BUFFER_SIZE]; > > > struct net_device *nd=NULL; > > > static int zz; > > > > > > memset(my_buffer,0,BUFFER_SIZE); > > > strcpy(my_buffer,":Interfaces:\n"); > > > if (offset > 0) return 0; > > > for (zz=0;zz < MAX_INTERFACES;zz++) { > > > nd=dev_get_by_index(zz); > > > if (nd && (nd->owner) && (nd->owner->name)) { > > > sprintf(my_buffer,"%s%d:%s:%s\n", > > > my_buffer, > > > zz, > > > nd->name, > > > nd->owner->name); > > > } > > > } > > > len=strlen(my_buffer); > > > *buffer_location=my_buffer; > > > return len; > > > } > > > > > > int init_module(void) { > > > struct proc_dir_entry *p=NULL; > > > printk("%s v%s - %s\n", MODNAME, VERSION, COPYRIGHT); > > > p=create_proc_entry(MODNAME,(S_IFREG | S_IRUGO),&proc_root); > > > if (!p) { > > > printk("%s: error registering /proc/%s !!\n",MODNAME,MODNAME); > > > return -1; > > > } > > > p->read_proc=procfile_read; > > > p->data=NULL; > > > return 0; > > > } > > > > > > void cleanup_module(void) { > > > remove_proc_entry(MODNAME,&proc_root); > > > printk("%s unloaded successfully.\n",MODNAME); > > > } > > > > > > ----------------------------------------------------------------------- > > > Next Technical Meeting: Sat, Sep 15 13:30- Leading Edge Co., Place > > Canada > > > Next Nomikai Meeting: Fri, Oct 19 19:30- Tengu Tokyo Eki-Mae > > > ----------------------------------------------------------------------- > > > more info: http://www.tlug.gr.jp Sponsor: Global Online Japan > > > > ----------------------------------------------------------------------- > > Next Technical Meeting: Sat, Sep 15 13:30- Leading Edge Co., Place Canada > > Next Nomikai Meeting: Fri, Oct 19 19:30- Tengu Tokyo Eki-Mae > > ----------------------------------------------------------------------- > > more info: http://www.tlug.gr.jp Sponsor: Global Online Japan > > > > > > -------------------------- > Scott M. Stone <sstone@example.com> > Director of Information Technology, Director of Research and Development > ITIsOpen, Inc. - http://www.itisopen.com > Cisco Certified Network Associate, Sun Solaris Certified Systems Administrator > > ----------------------------------------------------------------------- > Next Technical Meeting: Sat, Sep 15 13:30- Leading Edge Co., Place Canada > Next Nomikai Meeting: Fri, Oct 19 19:30- Tengu Tokyo Eki-Mae > ----------------------------------------------------------------------- > more info: http://www.tlug.gr.jp Sponsor: Global Online Japan
- References:
- Re: interface name - module name assoc SOLVED
- From: "Scott M. Stone" <sstone@example.com>
Home | Main Index | Thread Index
- Prev by Date: Re: interface name - module name assoc SOLVED
- Next by Date: Re: getting keypad +/- on Happy Hacking Kbd Lite 2
- Prev by thread: Re: interface name - module name assoc SOLVED
- Next by thread: crc error when booting
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links