LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 10-22-2002, 03:52 PM   #1
manaskb
Member
 
Registered: Jan 2002
Location: India
Distribution: Suse , Mandrake
Posts: 121

Rep: Reputation: 15
how can a program get network interface up/down event notifications in Linux


Hi,
I am writing a program on Linux ( kernel 2.4.19). This is a routing protocol written in C. This program needs to know the following things:
1. at program startup it should be able to find out all the up network interfaces, including loopbacks.
2. If a new interface comes up at runtime, somehow this program need to get a notification.
3. If a network intercae goes down, again this program need to get a notification.

I need your help here. Any suggestion how can I go about getting these information. Is there some library or some other entry points to the kernel from where this program can get the information.

I am working alone in the project and plan to release it as OSS. Any help will be greatly appreciated.

Thanks,
Manas
 
Old 10-22-2002, 04:37 PM   #2
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,755

Rep: Reputation: 88
The active interfaces can be found by parsing /proc/net/dev. You can look at the source code for ifconfig to see how it does it. As for getting a notification if an iterface comes up or down while you program is running, you would have to modify the kernel. I'd suggest just polling every few seconds.

You can find ifconfig source here:
http://www.tazenda.demon.co.uk/phil/...s-1.60.tar.bz2
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
is it possible to get interface up/down event notifications thru netlink in linux pccyang Programming 1 11-19-2004 07:21 PM
KDE Sounds/Event Notifications gfxguy Linux - Software 3 09-27-2004 05:55 PM
Need help configuring an old linux box with wireless interface connect to network itrap2003 Linux - Wireless Networking 3 06-25-2004 12:50 PM
how to run script on event ppp0 interface going down ? qwijibow Linux - Networking 4 02-24-2004 06:08 AM
Linux Network Neighborhood Like Program? LinuxJuanaBe Linux - Newbie 3 04-28-2002 11:22 PM


All times are GMT -5. The time now is 05:04 AM.

Main Menu
 
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
Open Source Consulting | Domain Registration