link deleted from cache when removed from a bridge

Andrew Kraslavsky andykras at hotmail.com
Mon Jun 20 14:24:44 EDT 2011


Hello,

Firstly, thank you for all your hard work in providing libnl!

I am using:

libnl version 3.0
Linux kernel version 2.6.35.12

I am writing a program to monitor link information on a system that has multiple network interfaces.

More specifically, the program calls:

nl_cache_mngr_add( mngr, "route/link", link_cb, NULL, link_cache );

So link_cb is invoked on every link related event.

Everything works great until I remove an interface from a bridge using brctl, e.g.:

brctl delif br0 eth2

I then see an unexpected interface deletion event for eth2 as logged by the link_cb callback function and eth2 is removed from the link_cache cache (I can see this when I ask my program to dump the current contents of link cache).

As an experiment, I added a nl_cache_refill() call to my program when it sees that eth2 has been deleted and verified that eth2 then shows up in the refilled cache.

My guess is that this deletion event is really just supposed to mean that eth2 is no longer part of bridge br0 but that the event is being taken to mean that eth2 has been deleted from the system.

Is this actually the expected behavior? If so, I would appreciate advice on how to deal with the deletion of eth2 from link cache when that interface is removed from a bridge but not from the system (is calling nl_cache_refill() really the right thing to do and what should I use as a trigger for that?).

If it helps, I would be _very_ happy to use libnl to manage the bridge through my program.  Meaning, if this problem is occurring because brctl uses ioctl calls and there are libnl calls I can use instead that would avoid the problem, that would be great!

If it is a bug, has it been fixed in a newer version of libnl or the Linux kernel?

Thank you,

- Andrew






 		 	   		  


More information about the libnl mailing list