Dangling results with rtnl_route_alloc_cache(...,NL_AUTO_PROVIDE,...)

Thomas Graf tgraf at suug.ch
Wed Aug 29 06:33:16 EDT 2012


On Tue, Aug 21, 2012 at 01:17:15PM +0000, Loïc Touraine wrote:
> Hi everyone,
> Can anyone tell me why I obtain dangle results using the following piece of code (i.e. the returned list of routes changes from one execution to another) ?
> What does NL_AUTO_PROVIDE mean in this context ? :

See http://www.infradead.org/~tgr/libnl/doc/api/group__cache__mngt.html#gad06c0755c030845c3c90ed490108ea5d


> 
> if (rtnl_route_alloc_cache          (sock,AF_INET,NL_AUTO_PROVIDE,&route_cache) < 0) {
>         cout<<"error allocating route cache"<<endl;    /* error */
>     }


This does not make any sense. rtnl_route_alloc_cache() expects flags
from <netlink/route/route.h>.

The only defined flag is:
#define ROUTE_CACHE_CONTENT	1

Unfortuantely NL_AUTO_PROVIDE is also defined as 1 so what you did there
is request a cache that tracking the routing cache.

I'll document this more clearly.



More information about the libnl mailing list