libnl3 ... missing feature for retrieving cached address objects?

David Sommerseth davids at redhat.com
Mon Sep 9 11:57:47 EDT 2013


Hi,

I'm doing some massive updates to python-ethtool, which uses libnl to
retrieve information about network and hardware configurations.  The use
of libnl-1 was added quite a long time ago to especially implement IPv6
support.  I'm now doing a lot of changes to improve the overall code and
simplify the implementation.

In this process, I found rtnl_addr_get() too specific, as I want to
retrieve the IP address for a specific link.  From what I could see,
rtnl_addr_get() will always filter based on the struct nl_address object
passed to it and match against the given address.  This is too strict
for my use case.  Further I couldn't find any other obvious solutions to
extract this information, except traversing all objects using
nl_cache_foreach_filter() and a callback function.

So I propose a new function - rtnl_addr_get_index() (patch attached)
which is a simplified rtnl_addr_get() function.  On my slight testing,
this seems to work quite well.

However, I'm not sure if I'm overlooking something here?  Or is there a
better or simpler approach?


--
kind regards,

David Sommerseth
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Added-rtnl_addr_get_index-to-get-cached-objects-base.patch
Type: text/x-patch
Size: 2265 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20130909/e396a756/attachment.bin>


More information about the libnl mailing list