LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Network Interface Status (https://www.linuxquestions.org/questions/programming-9/network-interface-status-8248/)

ejtbrown 11-02-2001 01:48 PM

Network Interface Status
 
The ifconfig command somehow knows which interfaces are up and which are down. I'm writing a daemon that needs to know if a particular interface is up or down. What functions are used to determine if an interface is up or down?

crabboy 11-02-2001 11:54 PM

There is a special file in /proc/net called dev. Its contents show the active interfaces and some statistics for each iface. Reading and parsing that file sounds like the easiest route to me.

Gary

ejtbrown 11-09-2001 03:24 PM

I've looked at this file, but it appears to contain any interface that's ever been up on the system.

pinoy 11-10-2001 04:02 AM

There are several ioctls for getting the interfaces and its status. I would search for SIOCGIFCONF and ioctl. There's a structure that has a flag which you can query for IFF_UP. I can't remember it on top of my head, but that should be enough to point you to the right direction.

suresh_rupineni 08-04-2006 01:07 AM

interface status
 
i have one doubt regarding using /proc/net/dev file.interface are up then cont of transmitted packets,transmitted bytes,received packets and recived bytes is incremented.if one interface is down that suddenly file shows some count value.how will i decide from count wheter interface is up or down.the structure that writes the data to the /proc/net/dev available in which file.is there any information regarding structure please respond.

suresh_rupineni 08-04-2006 01:12 AM

Quote:

Originally Posted by ejtbrown
I've looked at this file, but it appears to contain any interface that's ever been up on the system.

i have some doubts regarding using /proc/net/dev file.interface are up then cont of transmitted packets,transmitted bytes,received packets and recived bytes is incremented.if one interface is down suddenly the file shows some count value.how will i decide from count wheter interface is up or down.


All times are GMT -5. The time now is 02:37 AM.