rtnl_route_alloc_cache lost some route messages

Hanks Wang Hanks.Wang at watchguard.com
Thu Apr 19 21:24:58 EDT 2012


Hi Thomas,

Any patch to fix it? I see one patch on our git tree, because there is little comment, I don't confirm it. The patch information is attached following.



avoid dangling co_major_cache reference to NL_AUTO_PROVIDE caches

authorAlexander Sack <asac at jwsdot.com>
Fri, 21 Oct 2011 06:31:39 +0800 (00:31 +0200)
committerThomas Graf <tgraf at redhat.com>
Wed, 11 Jan 2012 19:31:40 +0800 (12:31 +0100)
commit9819717444e8f58bcf707aac724488c4d5f4e1d7
tree164d098fc82cb4fbe2967b36623caf475b5b7f3btree | snapshot
parent4a7791eca1268e24225c33ed1c00c140a14cd955commit | diff


avoid dangling co_major_cache reference to NL_AUTO_PROVIDE caches

lib/cache_mngr.c



Really thanks for your help.
-Hanks.Wang


________________________________________
发件人: Thomas Graf [tgr at infradead.org] 代表 Thomas Graf [tgraf at infradead.org]
发送时间: 2012年4月20日 1:10
到: Hanks Wang
Cc: libnl at lists.infradead.org; tgraf at redhat.com
主题: Re: rtnl_route_alloc_cache lost some route messages

On Tue, Apr 17, 2012 at 09:52:25AM +0000, Hanks Wang wrote:
> 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

This is definitely a bug! Is there any chance someone is abusing
your route cache while you access it?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20120420/476925c9/attachment-0001.html>


More information about the libnl mailing list