rtnl_route_alloc_cache lost some route messages
Hanks Wang
Hanks.Wang at watchguard.com
Tue Apr 17 05:52:25 EDT 2012
Hi all,
In libnl3, I found a little problem.
When use NL_AUTO_PROVIDE as the third parameter for rtnl_route_alloc_cache, some routing info has been lost! Then use rtnl_route_get_flags to get flags, the result of flags is right.
Use 0 as the third parameter "int flags" for rtnl_route_alloc_cache, the routing info is correct, but then use rtnl_route_get_flags to get flags, it will always return zero.
I found that GNOME group also found this problem, but I have not found the similar bug in our bug queue. How to understand this problem?
uint32_t rtnl_route_get_flags(struct rtnl_route *route)
{
return route->rt_flags;
}
int rtnl_route_alloc_cache(struct nl_sock *sk, int family, int flags,
struct nl_cache **result)
{
struct nl_cache *cache;
int err;
if (!(cache = nl_cache_alloc(&rtnl_route_ops)))
return -NLE_NOMEM;
cache->c_iarg1 = family;
cache->c_iarg2 = flags;
if (sk && (err = nl_cache_refill(sk, cache)) < 0) {
free(cache);
return err;
}
*result = cache;
return 0;
}
Reference for GNOME on this libnl issue:
http://mail.gnome.org/archives/networkmanager-list/2011-September/msg00233.html
Yours sincerely,
-Hanks.Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20120417/ae562f20/attachment.html>
More information about the libnl
mailing list