Check Interface Status

michi1 at michaelblizek.twilightparadox.com michi1 at michaelblizek.twilightparadox.com
Thu Dec 29 12:53:51 EST 2011


Hi!

On 09:53 Thu 29 Dec     , Rahul Kumar wrote:
> Hi,
> 
> I would like to check the interface status (up/down) within linux kernel.
> Is there any routine (sort of ioctl) to do this. Any code that is
> already in use in kernel would also be helpful for me.
> Please let me know.

If you want to check the status of a given "struct net_device *dev", you can
do "dev->flags & IFF_UP". No idea how this is supposed to be locked. If you
want to be notigied of changes, you can call register_netdevice_notifier().

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com



More information about the Kernelnewbies mailing list