Networking Forums

Networking Forums > Computer Networking > Linux Networking > need the network driver to notify when link up/down

Reply
Thread Tools Display Modes

need the network driver to notify when link up/down

 
 
zix
Guest
Posts: n/a

 
      12-10-2008, 09:25 AM
Hi Everybody,
I have a module which is suposed to do some work
when the network(eth0) is up and running, so i guess some where in the
driver should be knowing when this is happenning....so i want to
declare a global variable and notify my module about it in the driver.
My module will wait for the event and do thework following. I wish to
know if this approach is right...if I am right, I need to know where
exactly in the driver, I can find out if the link is up/down....can
anybody help me with the file in 2.6 kernel? I think its already
there, as so many user space applications depend on that.....please
help me in figuring where the stuff is...


Thanks a lot,
zix
 
Reply With Quote
 
 
 
 
david
Guest
Posts: n/a

 
      12-10-2008, 10:11 AM
On Wed, 10 Dec 2008 02:25:30 -0800, zix rearranged some electrons to say:

> Hi Everybody,
> I have a module which is suposed to do some work
> when the network(eth0) is up and running, so i guess some where in the
> driver should be knowing when this is happenning....so i want to declare
> a global variable and notify my module about it in the driver. My module
> will wait for the event and do thework following. I wish to know if this
> approach is right...if I am right, I need to know where exactly in the
> driver, I can find out if the link is up/down....can anybody help me
> with the file in 2.6 kernel? I think its already there, as so many user
> space applications depend on that.....please help me in figuring where
> the stuff is...
>
>
> Thanks a lot,
> zix


Surely, something in /proc/net could be useful for you.
 
Reply With Quote
 
Bit Twister
Guest
Posts: n/a

 
      12-10-2008, 12:53 PM
On Wed, 10 Dec 2008 02:25:30 -0800 (PST), zix wrote:
> Hi Everybody,
> I have a module which is suposed to do some work
> when the network(eth0) is up and running, so i guess some where in the
> driver should be knowing when this is happenning....so i want to
> declare a global variable and notify my module about it in the driver.


I have no idea about the kernel module, but when I want to hook into
the network going up/down, I place my script in the interface up/down
directory. You may want to look around in the */ifup and */ifdown
directories. Then there is the possibility of using something like

/sbin/ifup-local, /sbin/ifup-pre-local,....

Of course the actual names will depend on distribution. Above was
Mandriva, *buntu will use something like /etc/network/if-up.d,
if-down.d, if-pre-up.d, if-post-down.d,.....


 
Reply With Quote
 
Rick Jones
Guest
Posts: n/a

 
      12-10-2008, 09:16 PM
Bit Twister <(E-Mail Removed)> wrote:
> On Wed, 10 Dec 2008 02:25:30 -0800 (PST), zix wrote:
> > Hi Everybody,
> > I have a module which is suposed to do some
> > work when the network(eth0) is up and running, so i guess some
> > where in the driver should be knowing when this is
> > happenning....so i want to declare a global variable and notify my
> > module about it in the driver.

>
> I have no idea about the kernel module, but when I want to hook into
> the network going up/down, I place my script in the interface
> up/down directory. You may want to look around in the */ifup and
> */ifdown directories. Then there is the possibility of using
> something like


> /sbin/ifup-local, /sbin/ifup-pre-local,....


That will cover administratively initiated up/down events. It won't
cover instances where the link goes up and down after the ifup but
before the ifdown. Also, will those hooks get run if someone does a
bare ifconfig command on an interface?

The linux bonding driver (in kernel) does some stuff with mii (? - the
bonding.txt file will have a high-level description) to get link
up/down notification from the drivers below it. There may be some
netlink magic one could use as well, but that is pure speculation on
my part.

rick jones
--
portable adj, code that compiles under more than one compiler
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...
 
Reply With Quote
 
Hactar
Guest
Posts: n/a

 
      12-11-2008, 01:37 AM
In article <124189b3-ac12-44a8-9f0b-(E-Mail Removed)>,
zix <(E-Mail Removed)> wrote:
> I have a module which is suposed to do some work
> when the network(eth0) is up and running, so i guess some where in the
> driver should be knowing when this is happenning....so i want to
> declare a global variable and notify my module about it in the driver.
> My module will wait for the event and do thework following. I wish to
> know if this approach is right...if I am right, I need to know where
> exactly in the driver, I can find out if the link is up/down....can
> anybody help me with the file in 2.6 kernel? I think its already
> there, as so many user space applications depend on that.....please
> help me in figuring where the stuff is...


You could ping your router, or your ISP's mail server, or some relatively
close host that responds to pings and is always up.

--
-eben (E-Mail Removed)P http://royalty.mine.nu:81
SCORPIO: Get ready for an unexpected trip when you fall screaming
from an open window. Work a little harder on improving your low self
esteem, you stupid freak. -- Weird Al, _Your Horoscope for Today_
 
Reply With Quote
 
zix
Guest
Posts: n/a

 
      12-12-2008, 05:03 AM
On Dec 11, 3:16*am, Rick Jones <rick.jon...@hp.com> wrote:
> Bit Twister <BitTwis...@mouse-potato.com> wrote:
> > On Wed, 10 Dec 2008 02:25:30 -0800 (PST), zix wrote:
> > > Hi Everybody,
> > > * * * * * * * * * *I have a module which is suposed to do some
> > > work when the network(eth0) is up and running, so i guess some
> > > where in the driver should be knowing when this is
> > > happenning....so i want to declare a global variable and notify my
> > > module about it in the driver.

>
> > I have no idea about the kernel module, but when I want to hook into
> > the network going up/down, I place my script in the interface
> > up/down directory. You may want to look around in the */ifup and
> > */ifdown directories. Then there is the possibility of using
> > something like
> > /sbin/ifup-local, /sbin/ifup-pre-local,....

>
> That will cover administratively initiated up/down events. *It won't
> cover instances where the link goes up and down after the ifup but
> before the ifdown. *Also, will those hooks get run if someone does a
> bare ifconfig command on an interface?
>
> The linux bonding driver (in kernel) does some stuff with mii (? - the
> bonding.txt file will have a high-level description) to get link
> up/down notification from the drivers below it. *There may be some
> netlink magic one could use as well, but that is pure speculation on
> my part.
>
> rick jones
> --
> portable adj, code that compiles under more than one compiler
> these opinions are mine, all mine; HP might not want them anyway...
> feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...


thanks Rick and Everybody, for your suggestions. Well Rick, I am not
sure of mii, I will have a look at that, but about netlink I ned to
have a point in the driver whre I can use netlink. why netlink, then i
can just set a global variable and wake up my module in kernel mode to
act to that. I am not able to figure out the place in the driver where
I should be placing such a thing. :-(
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to notify gnome (network manager?) about network connection setup by my own script/tool? wzab Linux Networking 0 09-24-2011 10:31 AM
IPSEC Dead Peer Detection - how to notify an app? John Shepard Linux Networking 0 12-19-2008 03:16 AM
during boot Ndis2 driver & Network Transport Driver not found elgordo Windows Networking 0 08-24-2004 08:26 AM
Driver for D-Link DWL 120+ USB device? ppcinfo Linux Networking 6 10-22-2003 06:54 PM
New D-Link DWL-650+ Driver Problems... Earth Based Wireless Internet 1 07-30-2003 03:48 PM



1 2 3 4 5 6 7 8 9 10 11