route: set missing TCA_ATTR_XSTATS changes flags in rtnl_tc_msg_parse()

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
route: make rtnl_tc_clone() more robust against NLE_NOMEM

When oo_clone() fails, the new object is freed. Make sure 'dst'
does not own parts of 'src'.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
route: merge branch 'route-tc-fixes'

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
idiag: fix out of bound error parsing idiag messages

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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: 81d2b1d509d91fe894e4aec0a6a76b0bf75514cd
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
idiag: deprecate netlink message type defines in idiagnl.h

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
idiag: deprecate IDIAG_TIMER_* value for IDIAGNL_TIMER_*

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
idiag: fix memory leak in idiagnl_msg_set_cong()

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
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>
idiag: add change attributes for idiag_msg_obj

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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: 9c066b9271493ce3efff0b9d7b6e424990bba3f2
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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>
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>
idiag: add missing enum types for idiagnl_exts2str()

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
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: 22eb2569a595be98ae09fc4192860c1d2c3aa54c
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>