LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 11-02-2001, 02:48 PM   #1
ejtbrown
Member
 
Registered: Mar 2001
Location: Santa Maria CA USA
Distribution: RedHat 6.0 & RedHat 7.0
Posts: 36

Rep: Reputation: 15
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?
 
Old 11-03-2001, 12:54 AM   #2
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
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
 
Old 11-09-2001, 04:24 PM   #3
ejtbrown
Member
 
Registered: Mar 2001
Location: Santa Maria CA USA
Distribution: RedHat 6.0 & RedHat 7.0
Posts: 36

Original Poster
Rep: Reputation: 15
I've looked at this file, but it appears to contain any interface that's ever been up on the system.
 
Old 11-10-2001, 05:02 AM   #4
pinoy
LQ Newbie
 
Registered: Sep 2001
Posts: 21

Rep: Reputation: 15
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.
 
Old 08-04-2006, 02:07 AM   #5
suresh_rupineni
LQ Newbie
 
Registered: Jul 2006
Posts: 11

Rep: Reputation: 0
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.

Last edited by suresh_rupineni; 08-04-2006 at 02:09 AM.
 
Old 08-04-2006, 02:12 AM   #6
suresh_rupineni
LQ Newbie
 
Registered: Jul 2006
Posts: 11

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ethernet interface - checking the status marri Programming 1 03-01-2005 01:15 PM
Network status from within C/C++ tbruer1138 Linux - Software 1 02-27-2005 01:11 AM
Network status from C/C++ program tbruer1138 Programming 1 02-26-2005 06:00 PM
network connection status ................ dileepkk Linux - Networking 1 07-09-2004 01:38 PM
Cannot get network card status up Synth3tic Linux - Newbie 14 05-22-2003 11:13 PM


All times are GMT -5. The time now is 12:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration