Callback only called every second time

Thomas Haller thaller at redhat.com
Wed Oct 21 14:03:34 PDT 2015


On Mon, 2015-10-19 at 18:45 +0200, Tilman Bender wrote:
> Dear libnl-List,
> 
> I have a weird issue where my callback to receive and parse the
> response
> from my kernel module will only be triggered every second
> request message I send.
> 
> I am pretty sure I have things set up wrong, but as there is not much
> information in step-by-step tutorial format I could not find how to
> do
> it right.
> 
> The attached log-file contains the logging output for code like this
> 
>         testNetlink();
>         getWatchListSize();
>         getWatchListSize();
>         getWatchListSize();
>         getWatchListSize();
> 

Hey,


I don't see why that would happen... it depends on what the other side
says in response to your DIZ_MYFAMILY requests.

Maybe you can subscribe a callback of type NL_CB_MSG_IN to see what
happens.

Look at
https://github.com/thom311/libnl/blob/f25138d3214cefba0dc992ce7a408de580fd3dcd/lib/nl.c#L829

to see under which circumstances the callbacks are invoked.



cheers,
Thomas



(Unrelated sidenote: in production code, don't call
 nl_socket_get_local_port() before nl_connect() because it forces
nl_connect() to really use that port -- but the port could be already
in use, in which case nl_connect() would fail. For debugging, it
doesn't matter though).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20151021/77eebfda/attachment.sig>


More information about the libnl mailing list