Question regarding rtnl_link objects and address family.

Thomas Graf tgraf at infradead.org
Tue Mar 27 04:06:26 EDT 2012


On Fri, Feb 24, 2012 at 01:43:57PM -0500, Bushman, Jeff wrote:
> I just started using libnl and am quite impressed. I've found a few small bugs that I'll post patches for in the near future.
> 
> My dilemma is how to handle the different types of RTM_NEWLINK messages for the different address families.
> 
> I create an nl_cache_mgr, and then call nl_cache_mngr_add() for "route/link". This works great, until I do something that causes a change to the IPv6 configuration. Then I get an RTM_NEWLINK message for family PF_INET with completely different attributes. This messages replaces the one in the cache, discarding useful information in the PF_UNSPEC family message that was in the cache.
> 
> I'd like to maintain the messages from both families. Do I need to set up a separate cache structure and code for the AF_INET6 family messages? I see that the cache functionality has some support for this with the nl_cache.c_iarg1 attribute. But it doesn't appear that there's any way to de-multiplex incoming messages based on family. I also couldn't find a way to just 'get' and 'set' protocol-family specific link message from the kernel.
> 
> Am I missing something, or doing things the wrong way? I'd be happy to make changes to the library that continued the existing design philosophy.

This is an area of libnl that we still need to improve. You are doing nothing wrong
but the kernel sends out various secondary link notifications such as the notification
to report the end of the duplicate address detection period which we do not filter out
yet properly.

Recently a new operation was added to the cache ops, event_filter, which allows to filter
out events which need to be ignored such as bridging notifications.



More information about the libnl mailing list