From mboxrd@z Thu Jan 1 00:00:00 1970 From: michi1@michaelblizek.twilightparadox.com (michi1 at michaelblizek.twilightparadox.com) Date: Thu, 29 Dec 2011 18:53:51 +0100 Subject: Check Interface Status In-Reply-To: References: Message-ID: <20111229175351.GA2173@grml> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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