Does libnl support multihtreaded apps ?

Romary Sonrier romary at sonrier.com
Thu May 12 06:44:58 EDT 2011


Hello guys,

I'am having some trouble to use libnl 3.0 (from git) with a
multi-threaded app.

I my case, I have 2 thread that allocate their own nl_socket .
Is this the rigth way ? Should I share a socket with all the thread ?

My issue is that i get a error with the bind() call in the function
nl_connect().
>  err = bind(sk->s_fd, (struct sockaddr*) &sk->s_local,
> sizeof(sk->s_local));
>         if (err < 0) {
>                 err = -nl_syserr2nlerr(errno);
>                 goto errout;
>         }

The response is errno=10 "No child processes"

So i checked into the var sk->s_local ( my process pid is 6808)
Thread that doesn't get any error : s_local = {nl_family = 16, nl_pad =
0, nl_pid = 6808, nl_groups = 0},
Thread that does get an error : s_local = {nl_family = 16, nl_pad = 0,
nl_pid = 4201112, nl_groups = 0},

I didn't took time to understand the function  generate_local_port(),
but it seems realy obscure to me.
As far a I understood generate_local_port(), the bit mapping seeme to be
correct:
 6808 :                   00000000001101010011000
 4201112:              10000000001101010011000

So the question is for me : Does libnl support multihtreaded apps ?

Does someone hase any idea ?

Any help would be welcome....

Regards,

Romary Sonrier



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20110512/a433707b/attachment.html>


More information about the libnl mailing list