rtnl_link_get_kernel()

Thomas Graf tgraf at suug.ch
Mon Jul 9 03:17:19 EDT 2012


On Sun, Jul 08, 2012 at 08:14:42PM -0600, Wouter Verhelst wrote:
> On Fri, Jul 06, 2012 at 04:51:01PM -0600, Wouter Verhelst wrote:
> > What I've not been able to do yet, however, is read the assigned IP
> > address(es) to a particular interface. There's rtnl_addr_get(), but
> > that wants a cache (which I'm not using). There's rtnl_link_inet_get_conf(),
> > but that doesn't seem to be dealing with IP addresses unless I'm
> > terribly mistaken.
> > 
> > What am I missing?
> 
> Anyone?

Please respect that people don't work weekends.

You need to allocate an address cache using rtnl_addr_alloc_cache()
and then search it using rtnl_addr_get() or iterate over it using
nl_cache_foreach()

~Thomas



More information about the libnl mailing list