Commit graph

1123 commits

Author SHA1 Message Date
Cong Wang
d8f080d94f cls: add rtnl_u32_get_classid() API
[thaller@redhat.com: modified patch to use rtnl_tc_data_peek()]

http://lists.infradead.org/pipermail/libnl/2015-March/001841.html

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-03-04 20:31:37 +01:00
Thomas Haller
337af71720 build/trivial: reorder symbols in linker version scripts and add comment
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>
2015-03-04 17:41:45 +01:00
Thomas Haller
e89aec9bc1 route/tc: add internal rtnl_tc_data_peek() function
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-03-04 14:55:38 +01:00
Cong Wang
4ff512b054 correct --protocol option for nl-cls-* utilities
Just in the help message.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-25 10:08:07 +01:00
Cong Wang
df25df5857 act: correct file path for mirred.c
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-25 10:07:55 +01:00
Lubomir Rintel
6ea5230690 build: fix parallel make
Add missing inter-library dependencies.

Fixes: e7d57da0dd

https://github.com/thom311/libnl/pull/69

Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-18 14:25:59 +01:00
Thomas Haller
2bb90c2c9f pktloc: fix typo for tcp.flag.syn
http://lists.infradead.org/pipermail/libnl/2015-February/001829.html
http://lists.infradead.org/pipermail/libnl/2015-February/001830.html

Reported-by: Georgi Chulkov <georgi@guinpen.eu>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-17 15:26:15 +01:00
Lubomir Rintel
f545295104 lib: log errors from platform
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>
2015-02-17 13:34:01 +01:00
Rohan Joyce
6f891f6c0c lib: add const-ness to appropriate parameters in addr, attr, data
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>
2015-02-16 11:20:18 +01:00
Cong Wang
e75a1c373a route/tc: add rtnl_tc_stat2str() and rtnl_tc_str2stat()
[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>
2015-02-02 18:22:47 +01:00
Thomas Haller
c2151e8b7d route/act: merge branch 'act-skbedit'
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-02 18:17:37 +01:00
Cong Wang
a23d16a723 route/act: add a test case for skbedit action
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-02 18:16:18 +01:00
Cong Wang
6d5b9ab8ae route/act: add skbedit action
[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>
2015-02-02 18:16:11 +01:00
Thomas Haller
b5a56254b9 build: merge branch 'symbol-versioning'
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
2015-02-02 17:46:25 +01:00
Thomas Haller
4280dfb85d build: don't export internal symbols
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>
2015-02-02 17:28:06 +01:00
Thomas Haller
d2a30fbb36 build: move linker script symbols since last stable release to own section
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>
2015-02-02 17:28:06 +01:00
Thomas Haller
113bb85acf build: explicitly list exported symbols in linker scripts
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>
2015-02-02 17:28:06 +01:00
Thomas Haller
541b249358 build: add linker scripts for libnl-cli-3.so library
libnl-cli-3.so was unversioned previously. This is an
ABI change (but backward compatible).

Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-02-02 17:28:06 +01:00
Thomas Haller
e7d57da0dd build: add individual linker version scripts for shared libraries
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>
2015-02-02 17:28:06 +01:00
Thomas Haller
c7ae0c7d67 python: fix package meta data in setup.py
http://lists.infradead.org/pipermail/libnl/2015-January/001802.html

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-01-12 14:17:38 +01:00
Thomas Haller
b56f88c9b3 build: mark header linux-private/linux/veth.h as noinst_HEADERS
Fixes: 9dc6e6da90
2014-12-09 17:57:17 +01:00
Thomas Haller
3a8d6cfd56 idiag: fix set of identifying properties for idiag_msg_obj
The key for a struct idiag_msg_obj should be
'family x src x dst x sport x dport'.

http://lists.infradead.org/pipermail/libnl/2014-November/001768.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-27 16:57:28 +01:00
Thomas Haller
bf4b042ed1 idiag: merge branch 'idiag-compare-all'
oo_compare() is also relevant for nl_object_diff() and nl_object_filter().
Compare all fields so that comparing idiag_meminfo_obj works properly.

http://lists.infradead.org/pipermail/libnl/2014-November/001783.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-27 16:57:08 +01:00
Thomas Haller
1c61ac3f4e idiag: fix idiagnl_compare() to compare all attributes
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>
2014-11-27 16:55:27 +01:00
Thomas Haller
f4020ebde5 idiag: make objects 'idiag_vegasinfo' and 'idiag_meminfo' comparable
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-27 16:55:15 +01:00
Thomas Haller
9d4bc0345a idiag: don't dump unset properties of idiag_msg
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-27 16:50:46 +01:00
Thomas Haller
a60b3e46e7 route/addr: consider CACHEINFO in addr_compare()/nl_object_diff()
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>
2014-11-27 12:53:38 +01:00
Thomas Haller
b5a6d365e4 object: fix returning UINT_MAX for uint32_t in nl_object_diff()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-27 12:00:41 +01:00
Thomas Haller
cb75576df0 route: merge branch 'route-link-get-kernel-opnotsupp'
http://lists.infradead.org/pipermail/libnl/2014-November/001769.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-27 10:36:13 +01:00
Thomas Haller
b54775d316 route/link: return -NLE_OPNOTSUPP in rtnl_link_get_kernel() for old kernels
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>
2014-11-27 10:34:57 +01:00
Thomas Haller
8b023fd441 nl: add function nl_pickup_keep_syserr()
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>
2014-11-27 10:24:03 +01:00
Thomas Haller
16d16b9a76 trival: white space fix in lib/nl.c
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-27 10:24:03 +01:00
Thomas Haller
cc474698b8 idiag: merge branch 'idiag-exts2str-fix'
http://lists.infradead.org/pipermail/libnl/2014-November/001762.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-25 12:31:40 +01:00
Thomas Haller
f0e3017d0e idiag: fix idiagnl_exts2str()
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>
2014-11-25 12:28:29 +01:00
Thomas Haller
91e61c8f05 idiag: add missing enum types for idiagnl_exts2str()
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-25 12:28:29 +01:00
Thomas Haller
77771ba26f cache: assert in nl_cache_mngt_register() for valid oo_keygen() function
oo_keygen() requires oo_compare(). Assert in nl_cache_mngt_register().

http://lists.infradead.org/pipermail/libnl/2014-November/001759.html

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-25 10:44:26 +01:00
Thomas Haller
60ad8251f8 idiag: merge branch 'idiag-fixes'
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>
2014-11-24 18:46:47 +01:00
Thomas Haller
fac840d1f3 idiag: add a oo_compare() function for idiag_msg objects
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>
2014-11-24 18:44:47 +01:00
Thomas Haller
8eea9e927f idiag: add change attributes for idiag_msg_obj
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 18:39:27 +01:00
Thomas Haller
2ee5cf55f3 idiag: remove clone functions from trivial structures
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>
2014-11-24 18:39:27 +01:00
Thomas Haller
39ca54ab4d idiag: fix idiagnl_msg_clone()
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>
2014-11-24 18:36:52 +01:00
Thomas Haller
f40fd71701 idiag: fix memory leak in idiagnl_msg_set_cong()
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 18:30:21 +01:00
Thomas Haller
0e13bb44b8 idiag: reorder idiagnl.h to have deprecated functions at the top
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 18:30:21 +01:00
Thomas Haller
6bf68e60e4 idiag: deprecate IDIAG_TIMER_* value for IDIAGNL_TIMER_*
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 18:30:21 +01:00
Thomas Haller
94039ca48a idiag: deprecate IDIAG_SS_* socket states
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>
2014-11-24 18:30:21 +01:00
Thomas Haller
3b5226e3a2 idiag: deprecate netlink message type defines in idiagnl.h
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 18:30:21 +01:00
Thomas Haller
22eb2569a5 idiag: deprecate IDIAG_ATTR_* enumeration
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>
2014-11-24 18:30:21 +01:00
Thomas Haller
cd8cd2dae2 idiag: deprecate idiagnl_msg_obj_ops variable in public API
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>
2014-11-24 18:30:21 +01:00
Thomas Haller
fffc7ecedd idiag: fix out of bound error parsing idiag messages
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-11-24 18:30:21 +01:00
Thomas Haller
a3c0c04eff idiag: add copy of kernel header include/linux/inet_diag.h
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>
2014-11-24 18:30:21 +01:00