From mboxrd@z Thu Jan 1 00:00:00 1970 From: nilesh.tayade@netscout.com (nilesh) Date: Fri, 30 Dec 2011 15:05:49 +0530 Subject: Suspicious URL:Re: Check Interface Status In-Reply-To: <20111230083624.GB2213@grml> References: <4EFD6195.7020503@netscout.com> <20111230083624.GB2213@grml> Message-ID: <4EFD85F5.5010907@netscout.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Friday 30 December 2011 02:06 PM, michi1 at michaelblizek.twilightparadox.com wrote: > Hi! > > On 12:30 Fri 30 Dec , nilesh wrote: >> On Thursday 29 December 2011 08:23 PM, 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. >>> >> I think netif_carrier_ok() could help. You can refer network driver >> code(e.g. e1000_main.c). > > This looks more like "cable attached" rather than "interface up". Oh yes, it will just tell us if the carrier is available. IFF_UP flag is the right way, as you suggested in the other email. > > -Michi -- Thanks, Nilesh