LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-08-2014, 08:43 AM   #1
anon_16
LQ Newbie
 
Registered: Jan 2014
Posts: 14

Rep: Reputation: Disabled
Bonded interface link Up/Down status without polling


What I have:
I have a system with two interfaces (eth0 and eth1) which are bonded (bond0).

What I want:
I want to know when a link goes up or down and in or out of promiscuous mode without polling each interface all the time. I need this information for logging purposes - to write to a log file automatically.

What I have already done:
I know how to get the link up /down status by polling each interface continuously but, I don't want to do that. I tried some of the example NETLINK socket programs which listen and receive interface names. Using the flags
Code:
ifinfo -> ifi_flags
I was able to distinguish between link up and link down since there are only two flag values I saw when plugging / unplugging the link. However, I don't know what they mean. If they are listed in /usr/include/net/if.h , then I am not able to interpret them properly.
When the interfaces are not bonded I noted the flags integer:
eth0 :4098 For link down
eth0 :4099 For link up
When the interfaces are bonded I noted the flags integer:
eth0 :6146 For link down
eth0 :6147 For link up
And bond0 has a different flags integer which shows up when I change the active slave without touching eth0 or eth1.
However I do not receive the status of the bonded interface when in enters or leaves promiscuous mode.


My questions:
1) How do I understand the flags correctly?
2) I am okay with sending a single request per interface once I have received the bond0 status. Using sendmsg I have not been able to do this. How do I accomplish this ?
3) Is there any easier way around this ?
 
Old 09-08-2014, 03:33 PM   #2
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,893

Rep: Reputation: 163Reputation: 163
ifi_flags is bit map, bit 0 indicate link status.
 
Old 09-09-2014, 12:38 AM   #3
anon_16
LQ Newbie
 
Registered: Jan 2014
Posts: 14

Original Poster
Rep: Reputation: Disabled
That makes sense. The if.h file says that 0x001 is for LINK UP.
This must be why the link up and link down flag values differ by one.
I'd still like to know about the other flags.
And I would really appreciate it if someone told me an easier way around this mess.
 
Old 09-09-2014, 08:16 AM   #4
anon_16
LQ Newbie
 
Registered: Jan 2014
Posts: 14

Original Poster
Rep: Reputation: Disabled
Since I've run out of time, I've decided to use the netlink program as it is. This is what I have :
I will be printing the individual interface up / down status identified by the flags. When the active slave changes within the bond, I receive a message with a different flag (70723) - this seems to be the standard message when any slave changes within the bond. When I receive this I check /sys/class/net/bond0/bonding/active_slave for the current active slave. Then I print this to the log file.
 
Old 09-09-2014, 03:24 PM   #5
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,893

Rep: Reputation: 163Reputation: 163
All flags of interface status is in if.h. The flags of bond slave and individual interface are different because thier attrubutes are different, such as master, slave and so on.
 
  


Reply

Tags
bonding, interfaces, netlink, status


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
Fedora 18 bonded interface LACP mode not aggregating link throughput stevedd Linux - Networking 3 07-28-2013 01:49 PM
Identifying MaxSpeed of a Bonded Interface zama Linux - Networking 5 05-29-2013 06:58 PM
bonded interface as default gw jabirmk Linux - Networking 1 07-02-2012 03:31 AM
Netdump over bonded interface ? shriyer Linux - Software 0 07-22-2009 09:45 AM
kickstart with bonded interface bajones Linux - Newbie 6 07-29-2008 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:39 AM.

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