We export some symbols that are in private headers. We shouldn't do
that. Highlight them in the version script by grouping them and add
a comment.
We might want to hide these symbols later.
Some of these symbols symbols are used by libnl internal libraries.
So removing those is more complicated and only possible if we don't
required compatibility of different libnl libraries between each other
(i.e. that we require that within one installation the library versions
match).
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.
https://github.com/thom311/libnl/pull/65
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>
[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>
[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>
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
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>
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>
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>
This is not important for nl_object_identical() which only considers
the required attributes. But for using nl_object_diff() or nl_object_filter(),
all attributes must be compared.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Indicate this change of behavior with the capability
NL_CAPABILITY_ROUTE_ADDR_COMPARE_CACHEINFO.
This is a behavioral change as we now consider an additional
field when comparing addresses.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Older kernels without patch a3d1289126e7b14307074b76bf1677015ea5036f do
not support rtnl_getlink() by ifname. Detect this situation and fail
with -NLE_OPNOTSUPP instead of -NLE_INVAL.
This changes behavior in returning a different error code for this
case.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
nl_pickup() converts error codes from netlink into
nl error codes using nl_syserr2nlerr(). The latter function
mangles different error codes to the same nl error code.
Add a new function, that returns both the nl error code
and the original error code.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
idiagnl_exts2str() is used to print req->idiag_ext,
which is the extention types combined as flags, such as
( (1 << (INET_DIAG_TOS - 1)) | (1 << (INET_DIAG_MEMINFO - 1)) ).
This function was wrong from the beginning because the string lookup
array had indexes such as 'INET_DIAG_TOS', instead of '(1 << (INET_DIAG_TOS - 1)'.
Fix also idiagnl_attrs2str() which now converts an extension
type (e.g. INET_DIAG_TOS) to a string. Still this function is
deprecated, as the function name is not clear and it is not
used or very useful.
Fixes: 22eb2569a5
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Deprecate all of the IDIAG_* defines in 'idiagnl.h'.
Names exposed by libnl should have the prefix IDIAGNL_*
instead.
But actually, most of these values were copies from other
system headers. The user should instead use the original defines
anyway.
Also, several fixes of the idiag_msg_obj, which had a broken
oo_clone() function and missing oo_compare().
http://lists.infradead.org/pipermail/libnl/2014-November/001726.html
Signed-off-by: Thomas Haller <thaller@redhat.com>
Having a oo_keygen() function only makes sense together with a
oo_compare() function because after hashing, you still have to compare
the objects for equality (in case of hash collission).
Fixes: 9c066b9271
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
A oo_clone() function is only needed for complex sturctures
to deep copy an object.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
For one, we did not clone all pointer values. Hence, every cloned
object was very broken and resulted in dangling pointers and
double free/unref.
Apparently nobody was really using this function up to now.
Also, fix the return cases for NLE_NOMEM, so that we did not assume
ownership of pointers in 'src'.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
These values mirror TCP_* socket states from 'netinit/tcp.h'.
There is no good reason to expose a copy of those values.
User space should use the original values (if they care).
The only value that is actually useful is IDIAGNL_SS_ALL.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
IDIAG_ATTR_* were a copy of the INET_DIAG_* extension kernel
flags. Redefining them is wrong, user space should continue
to use the values provided via the kernel headers.
Also they were misused as change flags (ce_mask), which they are not.
Deprecate the IDIAG_ATTR_* flags and redefine them to what the
originally are: INET_DIAG_*.
Also deprecated idiagnl_attrs2str() because there is already
idiagnl_exts2str(). idiagnl_attrs2str() in the sense of libnl change
flags (ce_mask) makes no sense.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
This internal structure should never have been exposed publically.
It as introduced as public API in v3.2.23.
For now, don't remove it as it would be an API/ABI break.
Fixes: 81d2b1d509
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Taken from upstream kernel commit bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9
(v3.17), file 'include/uapi/linux/inet_diag.h'.
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>