bug in nl_cache_mngr_data_ready / nl_cache_refill / nl_cache_resync [+patch proposition]
Brett Ciphery
brett.ciphery at windriver.com
Thu Apr 12 17:16:18 EDT 2012
[bug in nl_cache_mngr_data_ready / nl_cache_refill / nl_cache_resync] On 11/04/2012 (Wed 10:55) Brett Ciphery wrote:
> I've been using the libnl cache facilities recently for route and have
> been seeing some interesting results when explicitly repopulating the
> cache. It seems the update functions won't process all the new events
> in a single invocation.
>
<snip>
>
> Using nl_cache_refill is a little different in that count remains
> constant at 4 until I add the 10 routes, and then it drops to 1 but
> route_process only sees/parses every odd route 2.2.2.0/24, 4.4.4.0/24
> ... 10.10.0.0/24. Then count goes to 0 for a few iterations, and then
> back to 14 (as expected).
>
Parsing every odd route turned out to be me accidentally using
nl_cache_mngr_data_ready() serially with nl_cache_refill(). After I
realized this it showed the same behaviour e.g. incrementing by 1.
--
The below patch makes nl_cache_mngr_data_ready() behave as expected, but
it's hard to say if it will have effects across the library. I tried
nl_cache_refill() and it was less broken :-) ... but one remaining
issue. The first looping call to nl_cache_refill() after 10 route
inserts caused it to add 20 routes (duplicates of the 10) to its cache.
The second loop iteration corrected it so count went from 24 -> 14.
Brett
--
Patch:
commit 6556567d7db11712bed32c9c4cfa1b6560d16da1
Author: Brett Ciphery <brett.ciphery at windriver.com>
Date: Thu Apr 12 16:57:52 2012 -0400
make recvmsgs() repeatedly call nl_recv() until error
recvmsgs() was not processing all messages available in
the socket and instead was handling one per call. this
had other transient effects such as not fully updating a
cache when explicitly requested to do so using
nl_cache_mngr_data_ready().
Signed-off-by: Brett Ciphery <brett.ciphery at windriver.com>
diff --git a/lib/nl.c b/lib/nl.c
index bcf89da..c0c47ff 100644
--- a/lib/nl.c
+++ b/lib/nl.c
@@ -740,10 +740,7 @@ skip:
msg = NULL;
creds = NULL;
- if (multipart) {
- /* Multipart message not yet complete, continue reading
*/
- goto continue_reading;
- }
+ goto continue_reading;
stop:
err = 0;
out:
More information about the libnl
mailing list