Skip to content

Conversation

@sagilow
Copy link

@sagilow sagilow commented Feb 17, 2015

add socket nl_connect_fd() & nl_create_fd()

  • Added option to create socket (fd) without bind.
    It is now possible to forward the socket fd to another child process...
    ...later use nl_connect_fd() to connect to socket from the child process.
  • Added option to disable CLOEXEC even if defined (in socket.h)
    'nl_socket_enable_cloexec' & 'nl_socket_disable_cloexec'
    No change to current default behavior.

Signed-off-by: Sagi Lowenhardt sagil@infinidat.com

thom311 and others added 13 commits February 2, 2015 17:28
Instead of using a shared version script 'libnl.sym', add individual
linker scripts for all libnl libraries.

For now, the content of the version script is unchanged and this
patch does not have any externally visible changes.

Signed-off-by: Thomas Haller <thaller@redhat.com>
libnl-cli-3.so was unversioned previously. This is an
ABI change (but backward compatible).

Signed-off-by: Thomas Haller <thaller@redhat.com>
Before all symbols (global: *;) were exported, which included some
symbols that should not be exported. Update the symbol files to
exclude everything by default and name the exported symbols
explicitly.

Still the same symbols as before are exported.

    for SO in ./lib/.libs/*.so ./src/lib/.libs/*.so; do
        SYM="$(basename "$SO")"
        SYM="${SYM%.so}.sym"
        cat <<EOF | sed 's/^ *>> //' > "$SYM"
            >> libnl_3 {
            >> global:
            >> $(nm "$SO" | sed -n 's/^[a-fA-F0-9]\+ [BDRT] \(.*\)/\t\1;/p' | LANG=C sort)
            >> local:
            >> $(echo -e '\t')*;
            >> };
    EOF
    done

Signed-off-by: Thomas Haller <thaller@redhat.com>
…ction

Move the symbols that were added since the last stable release to a new
section of the linker file.

Signed-off-by: Thomas Haller <thaller@redhat.com>
Hide internal symbols from the libraries.
Before, all symbols were exported, including some that were
not meant to be public. Hide them now.

This is an ABI break, but nobody was supposed to use these symbols.
Hence it seems acceptable to hide them now.

Still don't hide any symbols that are internal, but wrongly exported
in public header files (such as @ct_obj_ops).

Signed-off-by: Thomas Haller <thaller@redhat.com>
No longer export all symbols of the shared libraries
but pick them explicitly. Hide symbols that were
private and not part of a public header file.

This is an ABI change, but hopefully not too painful.

There are still symbols in the header files that should
be private. They continue to be exposed.

http://lists.infradead.org/pipermail/libnl/2015-January/001794.html
[thaller@redhat.com: changed whitespace and libnl-route.sym]

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
[thaller@redhat.com: add symbols to libnl-route-3.sym]

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This patch changes the signatures of some functions to allow const pointers in
places where a const qualified pointer is enough access for what the function
does (e.g. nla_get_u8). It also changes some functions that take a pointer
parameter and return a pointer derived from it to use the strchr idiom.

This is not exhaustive in terms of places where const can be added, but it's
a decent chunk that should not make the external api any more restrictive.

http://lists.infradead.org/pipermail/libnl/2015-February/001826.html

Signed-off-by: Rohan Joyce <rojoyce.github@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
nl_syserr2nlerr() reduces a lot of platform errors to NLE_FAILURE --
"Unspecific failure" which makes it somehow hard to track down the real reason
behind a failure.

Logging them with level of 4 makes it a little less painful.

thom311#65

Signed-off-by: Thomas Haller <thaller@redhat.com>
-    Added option to create socket (fd) without bind.
     It is now possible to forward the socket fd to another child process...
     ...later use nl_connect_fd() to connect to socket from the child process.

-    Added option to disable CLOEXEC even if defined (in socket.h)
     'nl_socket_enable_cloexec' & 'nl_socket_disable_cloexec'
     No change to current default behavior.

 Signed-off-by: Sagi Lowenhardt <sagil@infinidat.com>
@sagilow sagilow closed this Feb 17, 2015
LadyK-21 pushed a commit to LadyK-21/libnl that referenced this pull request Jun 5, 2022
All the io_alloc() implementation unconditionally allocated
new memory, thus leaking memory if called more then once.
Fix io_alloc() implementations not to allocate new memory
if not needed.

This happens for example in link_msg_parser() which first
calls rtnl_link_set_type():

    #0  macvlan_alloc (link=0x609d50) at route/link/macvlan.c:56
    tgraf#1  0x00007ffff7b99a78 in rtnl_link_set_type (link=link@entry=0x609d50, type=type@entry=0x609a94 "macvlan") at route/link.c:2233
    tgraf#2  0x00007ffff7b99c28 in link_msg_parser (ops=<optimized out>, who=<optimized out>, n=<optimized out>, pp=0x7fffffffd870) at route/link.c:547
    tgraf#3  0x00007ffff7dea109 in nl_cache_parse (ops=0x7ffff7dd8600 <rtnl_link_ops>, who=0x603338, nlh=0x6098a0, params=0x7fffffffd870) at cache.c:914
    tgraf#4  0x00007ffff7dea15b in update_msg_parser (msg=<optimized out>, arg=<optimized out>) at cache.c:668
    tgraf#5  0x00007ffff7def7bf in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ../include/netlink-private/netlink.h:142
    tgraf#6  recvmsgs (cb=0x6057a0, sk=0x6034c0) at nl.c:952
    tgraf#7  nl_recvmsgs_report (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1003
    tgraf#8  0x00007ffff7defb79 in nl_recvmsgs (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1027
    tgraf#9  0x00007ffff7de9668 in __cache_pickup (sk=0x6034c0, cache=0x603510, param=param@entry=0x7fffffffd870) at cache.c:701
    tgraf#10 0x00007ffff7dea08d in nl_cache_pickup (sk=<optimized out>, cache=<optimized out>) at cache.c:753
    tgraf#11 0x0000000000400d56 in main ()

and later ops->io_parse():

    #0  macvlan_alloc (link=0x609d50) at route/link/macvlan.c:56
    tgraf#1  0x00007ffff7baae9d in macvlan_parse (link=0x609d50, data=<optimized out>, xstats=<optimized out>) at route/link/macvlan.c:79
    tgraf#2  0x00007ffff7b99c80 in link_msg_parser (ops=<optimized out>, who=<optimized out>, n=<optimized out>, pp=0x7fffffffd870) at route/link.c:567
    tgraf#3  0x00007ffff7dea109 in nl_cache_parse (ops=0x7ffff7dd8600 <rtnl_link_ops>, who=0x603338, nlh=0x6098a0, params=0x7fffffffd870) at cache.c:914
    tgraf#4  0x00007ffff7dea15b in update_msg_parser (msg=<optimized out>, arg=<optimized out>) at cache.c:668
    tgraf#5  0x00007ffff7def7bf in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ../include/netlink-private/netlink.h:142
    tgraf#6  recvmsgs (cb=0x6057a0, sk=0x6034c0) at nl.c:952
    tgraf#7  nl_recvmsgs_report (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1003
    tgraf#8  0x00007ffff7defb79 in nl_recvmsgs (sk=sk@entry=0x6034c0, cb=cb@entry=0x6057a0) at nl.c:1027
    tgraf#9  0x00007ffff7de9668 in __cache_pickup (sk=0x6034c0, cache=0x603510, param=param@entry=0x7fffffffd870) at cache.c:701
    tgraf#10 0x00007ffff7dea08d in nl_cache_pickup (sk=<optimized out>, cache=<optimized out>) at cache.c:753
    tgraf#11 0x0000000000400d56 in main ()

thom311#59

Signed-off-by: Thomas Haller <thaller@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants