rtnl_route_get_iif always returns 0.

Thomas Graf tgraf at suug.ch
Mon Jun 17 16:21:34 EDT 2013


On 05/24/13 at 10:16am, Ed Slas wrote:
> I am running V 3.2.22 on an embedded linux (coldfire CPU) Kernel Version 2.6.38.
> 
> I am able to get a list of the routing table entries, but all of the 'iff''s are 0.
> I call:
> ret = rtnl_route_alloc_cache (
>             sock,           //struct nl_sock *    sk,
>             AF_INET,        //int     family,
>             0,              //int     flags,
>             &route_cache    //struct nl_cache **  result
>         );
> 
>     nl_cache_foreach(
> 
>             route_cache,
> 
>             process_route,
> 
>             NULL);
> ...And....
> 
> void process_route(struct nl_object *rt, void *unused)
> {
>     struct rtnl_route *pst_route = (struct rtnl_route *)rt;
> 
>     unsigned char protocol = rtnl_route_get_protocol(pst_route);
> 
>     unsigned char scope = rtnl_route_get_scope(pst_route);
> 
>     unsigned int priority = rtnl_route_get_priority(pst_route);
> 
>     int iff = rtnl_route_get_iif(pst_route);
> ...
> 
>  
> 
> rtnl_route_get_iif returns 0 for every route. 
> 
>  
> 
> I can use the iproute2 tool "ip route show" on the same system, and it properly shows the device names. 
> Any ideas on why the destination interface id's are not in the route_cache?

Are you sure? Can you show me the actual iproute2 output
you are referring to?

IIF is only provided for input routes.

> The IFF is an attribute in the netlink response. Is there a way to check to see if the IFF attribute was in the response?

Can you run your application with the environment variable
NLCB set to 'debug'? It will print all Netlink messages exchanged.





More information about the libnl mailing list