]> granicus.if.org Git - libnl/log
libnl
10 years agoidiag: fix idiagnl_msg_clone()
Thomas Haller [Mon, 24 Nov 2014 16:14:54 +0000 (17:14 +0100)]
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>
10 years agoidiag: fix memory leak in idiagnl_msg_set_cong()
Thomas Haller [Mon, 24 Nov 2014 16:14:53 +0000 (17:14 +0100)]
idiag: fix memory leak in idiagnl_msg_set_cong()

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoidiag: reorder idiagnl.h to have deprecated functions at the top
Thomas Haller [Mon, 24 Nov 2014 16:14:52 +0000 (17:14 +0100)]
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>
10 years agoidiag: deprecate IDIAG_TIMER_* value for IDIAGNL_TIMER_*
Thomas Haller [Mon, 24 Nov 2014 16:14:51 +0000 (17:14 +0100)]
idiag: deprecate IDIAG_TIMER_* value for IDIAGNL_TIMER_*

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoidiag: deprecate IDIAG_SS_* socket states
Thomas Haller [Mon, 24 Nov 2014 16:14:50 +0000 (17:14 +0100)]
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>
10 years agoidiag: deprecate netlink message type defines in idiagnl.h
Thomas Haller [Mon, 24 Nov 2014 16:14:49 +0000 (17:14 +0100)]
idiag: deprecate netlink message type defines in idiagnl.h

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoidiag: deprecate IDIAG_ATTR_* enumeration
Thomas Haller [Mon, 24 Nov 2014 16:14:48 +0000 (17:14 +0100)]
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>
10 years agoidiag: deprecate idiagnl_msg_obj_ops variable in public API
Thomas Haller [Mon, 24 Nov 2014 16:14:47 +0000 (17:14 +0100)]
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>
10 years agoidiag: fix out of bound error parsing idiag messages
Thomas Haller [Mon, 24 Nov 2014 16:14:46 +0000 (17:14 +0100)]
idiag: fix out of bound error parsing idiag messages

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoidiag: add copy of kernel header include/linux/inet_diag.h
Thomas Haller [Mon, 24 Nov 2014 16:14:45 +0000 (17:14 +0100)]
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>
10 years agoroute: merge branch 'route-tc-fixes'
Thomas Haller [Mon, 24 Nov 2014 17:23:02 +0000 (18:23 +0100)]
route: merge branch 'route-tc-fixes'

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: make rtnl_tc_clone() more robust against NLE_NOMEM
Thomas Haller [Mon, 24 Nov 2014 16:19:54 +0000 (17:19 +0100)]
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>
10 years agoroute: set missing TCA_ATTR_XSTATS changes flags in rtnl_tc_msg_parse()
Thomas Haller [Mon, 24 Nov 2014 16:19:53 +0000 (17:19 +0100)]
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>
10 years agoidiag: add a copy of linux/sock_diag.h
Cong Wang [Mon, 27 Oct 2014 16:50:17 +0000 (09:50 -0700)]
idiag: add a copy of linux/sock_diag.h

When we test idiag on 3.4 kernel, we always get ERANGE.
This is because libnl has its own copy for SK_MEMINFO_*,
which is actually newer than 3.4, where SK_MEMINFO_VARS
is larger than kernel's.

We add a copy from latest kernel, so on older kernel
libnl should still compile. Note, for kernel < 3.6
we don't have SK_MEMINFO_BACKLOG, we have to relax
the minlen.

'sock_diag.h' comes from v3.17 kernel sources
(bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9), file
'include/uapi/linux/sock_diag.h'.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoidiag: provide a hash function for idiag objects
Cong Wang [Thu, 20 Nov 2014 20:26:01 +0000 (12:26 -0800)]
idiag: provide a hash function for idiag objects

Without ->oo_keygen, libnl will use linear search
for cache objects. This is extremely slow for idiag
when we have a lot of TCP connections. Provide a
hash function for idiag so that libnl will be able
to lookup a hashtable.

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

Cc: Thomas Graf <tgraf@suug.ch>
Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocache: avoid duplicate check on initial dump
Holger Eitzenberger [Sun, 23 Nov 2014 14:40:36 +0000 (15:40 +0100)]
cache: avoid duplicate check on initial dump

The cache pickup does a check for duplicates for some time now.

However, the pickup in nl_cache_refill() explicitely clears the
cache, so the pickup doesn't need to actually do the dupe check,
as uniqueness is already guaranteed be Netlink subsystem.

And avoiding the dup check is beneficitial for performance
reasons, as the current algorithm is O(n^2).

http://lists.infradead.org/pipermail/libnl/2014-October/001680.html

Fixes: 96bb7c9a4cdd10a2665c0f56120943e79e33c560
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute/cls: merge branch 'route-cls-u32-match-mark'
Thomas Haller [Sun, 23 Nov 2014 14:32:41 +0000 (15:32 +0100)]
route/cls: merge branch 'route-cls-u32-match-mark'

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute/cls: minor fixes in for match mark filters
Thomas Haller [Sun, 23 Nov 2014 14:25:01 +0000 (15:25 +0100)]
route/cls: minor fixes in for match mark filters

- whitespace
- fix newline and whitespace in output of u32_dump_details()
- let rtnl_u32_del_mark() clear U32_ATTR_MARK

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute/cls: support 'match mark' u32 filters
Sagi Lowenhardt [Mon, 10 Nov 2014 15:51:41 +0000 (07:51 -0800)]
route/cls: support 'match mark' u32 filters

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink: fix memory leaks due to repeated calls to .io_alloc()
Thomas Haller [Mon, 18 Aug 2014 13:24:30 +0000 (15:24 +0200)]
link: fix memory leaks due to repeated calls to .io_alloc()

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

and later ops->io_parse():

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

https://github.com/thom311/libnl/issues/59

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/inet6: add support for tokenized interface identifiers
Lubomir Rintel [Fri, 26 Sep 2014 21:19:43 +0000 (23:19 +0200)]
link/inet6: add support for tokenized interface identifiers

http://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02

[thaller@redhat.com: Add OOM handling, fix whitespace issues]

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

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agonetlink/netlink.h: fix build including <poll.h> with the musl C library
Jörg Krause [Mon, 1 Sep 2014 10:38:10 +0000 (12:38 +0200)]
netlink/netlink.h: fix build including <poll.h> with the musl C library

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobuild: move copy of linux headers to private directory
Thomas Haller [Wed, 24 Sep 2014 05:49:34 +0000 (07:49 +0200)]
build: move copy of linux headers to private directory

libnl3 contains a private copy of some kernel header files.

Normally, users are expected to install libnl and specify
-I$PREFIX/include/libnl3 as include path. As the private kernel
header files are not installed, this works fine.

However, it can be convenient to build against the libnl source
directory, without installing libnl. In this case, the private kernel
header files shaddow the system provided ones. This is undesired.

Move these files to a different directory to avoid this clash.

http://lists.infradead.org/pipermail/libnl/2014-September/001645.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
10 years agobuild/trivial: prettify makefiles by wrapping long lines
Thomas Haller [Wed, 24 Sep 2014 05:49:33 +0000 (07:49 +0200)]
build/trivial: prettify makefiles by wrapping long lines

Signed-off-by: Thomas Haller <thaller@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
10 years agoidiag: fix a typo in idiagnl_req_set_ifindex()
Cong Wang [Tue, 23 Sep 2014 17:00:06 +0000 (10:00 -0700)]
idiag: fix a typo in idiagnl_req_set_ifindex()

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobuild: generate libnl-idiag-3.0.pc
Sébastien Barré [Thu, 18 Sep 2014 10:17:39 +0000 (12:17 +0200)]
build: generate libnl-idiag-3.0.pc

That file was not generated due to a missing line in Makefile.am
and configure.ac

http://lists.infradead.org/pipermail/libnl/2014-September/001649.html

Signed-off-by: Sébastien Barré <sebastien.barre@uclouvain.be>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'enovance-sa_fixup'
Thomas Haller [Wed, 27 Aug 2014 11:24:35 +0000 (13:24 +0200)]
Merge branch 'enovance-sa_fixup'

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

[thaller@redhat.com: I changed the original patches
 to indent with tabs (vs. spaces) and reworded the
 commit messages.]

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocls: check data before memcpy() it
Nicolas PLANEL [Tue, 26 Aug 2014 15:43:49 +0000 (11:43 -0400)]
cls: check data before memcpy() it

[thaller@redhat.com: I modified the condition "if (data && len)"
 in the original patch to just check "len > 0".
 Note that all call sites of meta_alloc() make sure to pass a
 valid data pointer with a non-zero length (anything else would
 be a bug). But indeed, calling memcpy with invalid src pointer
 is undefined behavior, even if len is zero.]

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: fix xfrm_sa_msg_parser() to return the value from the callback
Nicolas PLANEL [Tue, 26 Aug 2014 15:34:40 +0000 (11:34 -0400)]
xfrm: fix xfrm_sa_msg_parser() to return the value from the callback

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: fix an unintialized return value on memory allocation error in xfrmnl_ae_parse()
Nicolas PLANEL [Tue, 26 Aug 2014 15:31:15 +0000 (11:31 -0400)]
xfrm: fix an unintialized return value on memory allocation error in xfrmnl_ae_parse()

fix : err = -ENOMEM if calloc() failed

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoqdisc: avoid calling strstr() with a NULL haystack
Nicolas PLANEL [Tue, 26 Aug 2014 15:21:12 +0000 (11:21 -0400)]
qdisc: avoid calling strstr() with a NULL haystack

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: fix calling free() with a bad pointer
Nicolas PLANEL [Tue, 26 Aug 2014 14:23:37 +0000 (10:23 -0400)]
xfrm: fix calling free() with a bad pointer

sp->sec_ctx->ctx is a zero-length member, so it's already allocated

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agotravis-ci: run `make check` in travis build
Thomas Haller [Tue, 26 Aug 2014 11:48:17 +0000 (13:48 +0200)]
travis-ci: run `make check` in travis build

Test programs are only compiled when running `make check`.
Also, fix passing $CFLAGS argument to make.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoRemove pointless N < 0 checks
Thomas Graf [Tue, 26 Aug 2014 12:08:41 +0000 (14:08 +0200)]
Remove pointless N < 0 checks

route/tc.c:553:9: warning: comparison of unsigned enum expression < 0 is
always false [-Wtautological-compare]
              if (id < 0 || id > RTNL_TC_STATS_MAX)

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'tgraf/trivial-fixes'
Thomas Haller [Tue, 26 Aug 2014 11:13:28 +0000 (13:13 +0200)]
Merge branch 'tgraf/trivial-fixes'

http://lists.infradead.org/pipermail/libnl/2014-August/001614.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agosrc: Silence all warnings
Thomas Graf [Mon, 25 Aug 2014 23:09:12 +0000 (01:09 +0200)]
src: Silence all warnings

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: Remove unused variable sp_id and sa_id
Thomas Graf [Mon, 25 Aug 2014 23:09:11 +0000 (01:09 +0200)]
xfrm: Remove unused variable sp_id and sa_id

Cc: Sruthi Yellamraju <ysruthi@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agonf: Remove unused function htonll()
Thomas Graf [Mon, 25 Aug 2014 23:09:10 +0000 (01:09 +0200)]
nf: Remove unused function htonll()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: Remove unused function __assign_addr()
Thomas Graf [Mon, 25 Aug 2014 23:09:09 +0000 (01:09 +0200)]
xfrm: Remove unused function __assign_addr()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agonf: nfnl_*_str2copy_mode() should return int
Thomas Graf [Mon, 25 Aug 2014 23:09:08 +0000 (01:09 +0200)]
nf: nfnl_*_str2copy_mode() should return int

... to be able to return a negative error code for unknown modes.

[thaller@redhat.com: This is potentially an ABI break, but since
the size of the enum is implementation defined, it seems
anyway unstable to have them as function arguments/return values.]

http://lists.infradead.org/pipermail/libnl/2014-August/001616.html

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobuild: Add continuous integration support via travis-ci
Thomas Graf [Tue, 26 Aug 2014 00:08:21 +0000 (02:08 +0200)]
build: Add continuous integration support via travis-ci

This allows any libnl github repo to link to travis-ci which
will result in new commits and pull requests to be automatically
built with both gcc and clang. Any build failures including the
addition of warnings are reported to the author and committer.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agotests: build test-create-macvlan as part of `make check`
Thomas Haller [Mon, 18 Aug 2014 11:41:31 +0000 (13:41 +0200)]
tests: build test-create-macvlan as part of `make check`

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'hfsc-qdisc-support'
Thomas Haller [Wed, 30 Jul 2014 17:05:56 +0000 (19:05 +0200)]
Merge branch 'hfsc-qdisc-support'

http://lists.infradead.org/pipermail/libnl/2014-July/001566.html
http://lists.infradead.org/pipermail/libnl/2014-July/001594.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoqdisc: add hfsc qdisc support
Cong Wang [Mon, 28 Jul 2014 22:21:01 +0000 (15:21 -0700)]
qdisc: add hfsc qdisc support

Cc: Thomas Graf <tgraf@suug.ch>
Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agotc: save error code for rtnl_tc_data_check()
Cong Wang [Mon, 28 Jul 2014 22:21:00 +0000 (15:21 -0700)]
tc: save error code for rtnl_tc_data_check()

Cc: Thomas Graf <tgraf@suug.ch>
Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'dcbw/inet6_addr_gen'
Thomas Haller [Wed, 30 Jul 2014 16:52:04 +0000 (18:52 +0200)]
Merge branch 'dcbw/inet6_addr_gen'

http://lists.infradead.org/pipermail/libnl/2014-July/001561.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/inet6: add link IPv6 address generation mode support
Dan Williams [Fri, 25 Jul 2014 19:36:29 +0000 (14:36 -0500)]
link/inet6: add link IPv6 address generation mode support

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink: update copy of kernel header include/linux/if_link.h
Dan Williams [Fri, 25 Jul 2014 19:33:38 +0000 (14:33 -0500)]
link: update copy of kernel header include/linux/if_link.h

The next patch will use some of these defines, so update.

Taken from upstream kernel commit bc91b0f07ada5535427373a4e2050877bcc12218,
file 'include/uapi/linux/if_link.h'.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'declaration-fixes'
Thomas Haller [Sun, 27 Jul 2014 09:10:06 +0000 (11:10 +0200)]
Merge branch 'declaration-fixes'

Assorted declaration fixes

http://lists.infradead.org/pipermail/libnl/2014-July/001570.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocache_mngt: Make __nl_cache_ops_lookup() static, it was never declared
Thomas Graf [Sat, 26 Jul 2014 19:33:20 +0000 (21:33 +0200)]
cache_mngt: Make __nl_cache_ops_lookup() static, it was never declared

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocache: Declare nl_cache_ops_set_flags()
Thomas Graf [Sat, 26 Jul 2014 19:33:21 +0000 (21:33 +0200)]
cache: Declare nl_cache_ops_set_flags()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agosocket: Be correct, time(2) takes a pointer, not an integer
Thomas Graf [Sat, 26 Jul 2014 19:33:22 +0000 (21:33 +0200)]
socket: Be correct, time(2) takes a pointer, not an integer

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoact: Include <netlink/route/action.h>
Thomas Graf [Sat, 26 Jul 2014 19:33:23 +0000 (21:33 +0200)]
act: Include <netlink/route/action.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoact: Declare rtnl_act_change()
Thomas Graf [Sat, 26 Jul 2014 19:33:24 +0000 (21:33 +0200)]
act: Declare rtnl_act_change()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoneightbl: Declare rtnl_neightbl_set_gc_interval()
Thomas Graf [Sat, 26 Jul 2014 19:33:25 +0000 (21:33 +0200)]
neightbl: Declare rtnl_neightbl_set_gc_interval()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoematch/cmp: Include <netlink/route/cls/ematch/cmp.h>
Thomas Graf [Sat, 26 Jul 2014 19:33:26 +0000 (21:33 +0200)]
ematch/cmp: Include <netlink/route/cls/ematch/cmp.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/inet: Include <netlink/route/link/inet.h>
Thomas Graf [Sat, 26 Jul 2014 19:33:27 +0000 (21:33 +0200)]
link/inet: Include <netlink/route/link/inet.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/bonding: Include <netlink/route/link/bonding.h>
Thomas Graf [Sat, 26 Jul 2014 19:33:28 +0000 (21:33 +0200)]
link/bonding: Include <netlink/route/link/bonding.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/ipgre: Include <netlink/route/link/ipgre.h>
Thomas Graf [Sat, 26 Jul 2014 19:33:29 +0000 (21:33 +0200)]
link/ipgre: Include <netlink/route/link/ipgre.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/sit: Include <netlink/route/link/sit.h>
Thomas Graf [Sat, 26 Jul 2014 19:33:30 +0000 (21:33 +0200)]
link/sit: Include <netlink/route/link/sit.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/ip6tnl: Include <netlink/route/link/ip6tnl.h>
Thomas Graf [Sat, 26 Jul 2014 19:33:31 +0000 (21:33 +0200)]
link/ip6tnl: Include <netlink/route/link/ip6tnl.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/ip6tnl: Declare rtnl_link_is_ip6_tnl()
Thomas Graf [Sat, 26 Jul 2014 19:33:32 +0000 (21:33 +0200)]
link/ip6tnl: Declare rtnl_link_is_ip6_tnl()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agohtb: Declare rtnl_htb_set_level()
Thomas Graf [Sat, 26 Jul 2014 19:33:33 +0000 (21:33 +0200)]
htb: Declare rtnl_htb_set_level()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink/inet: fix rtnl_link_inet_get_conf() not to allocate inet_data
Thomas Haller [Fri, 25 Jul 2014 22:26:49 +0000 (00:26 +0200)]
link/inet: fix rtnl_link_inet_get_conf() not to allocate inet_data

Instead of allocating a 'struct inet_data', rtnl_link_inet_get_conf()
should only look for an existing entry.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agostyle: add .indent.pro file for GNU indent
Thomas Haller [Sat, 26 Jul 2014 13:07:00 +0000 (15:07 +0200)]
style: add .indent.pro file for GNU indent

This is somewhat an approximation of the coding style
in libnl3. In the end, it does not work overly well,
but I think it will be useful to cherry-pick some automatic
style fixes.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agostyle: require comma after __ADD() macro
Thomas Haller [Sat, 26 Jul 2014 13:06:59 +0000 (15:06 +0200)]
style: require comma after __ADD() macro

  $ sed -i 's/^\([\t ]\+\<__ADD\> \?([^)]\+)\) *$/\1,/' `git grep -w -l __ADD`

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoveth: add kernel header linux/veth.h for VETH defines
Dan Williams [Fri, 25 Jul 2014 19:27:09 +0000 (14:27 -0500)]
veth: add kernel header linux/veth.h for VETH defines

Similar to what's done with <linux/if_link.h>, make sure used defines
actually exist.  Otherwise building on even slightly older kernels
fails.

Taken from upstream kernel commit 1860e379875dfe7271c649058aeddffe5afd9d0d
(tag: v3.15), file 'include/uapi/linux/veth.h'.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolink: add ifb device support
Cong Wang [Mon, 21 Jul 2014 19:27:32 +0000 (12:27 -0700)]
link: add ifb device support

Cc: Thomas Graf <tgraf@suug.ch>
Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: use the right specifier for uint64_t
Cong Wang [Mon, 21 Jul 2014 17:44:45 +0000 (10:44 -0700)]
xfrm: use the right specifier for uint64_t

This fixes compile warnings like this:

xfrm/sp.c: In function 'xfrm_sp_dump_line':
xfrm/sp.c:346:3: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t' [-Wformat=]
   sprintf (dir, "%llu", sp->lft->soft_byte_limit);

Cc: Thomas Haller <thaller@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'xfrm'
Thomas Haller [Sun, 20 Jul 2014 16:23:34 +0000 (18:23 +0200)]
Merge branch 'xfrm'

http://lists.infradead.org/pipermail/libnl/2014-June/001503.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: style-fixes
Thomas Haller [Sun, 20 Jul 2014 14:11:43 +0000 (16:11 +0200)]
xfrm: style-fixes

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoxfrm: add xfrm support
Sruthi Yellamraju [Sun, 20 Jul 2014 13:57:33 +0000 (15:57 +0200)]
xfrm: add xfrm support

Signed-off-by: Sruthi Yellamraju <ysruthi@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolibnl-3.2.25 release libnl3_2_25
Thomas Haller [Wed, 16 Jul 2014 09:19:12 +0000 (11:19 +0200)]
libnl-3.2.25 release

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agotc: add co_groups for tc qdisc and filter
Cong Wang [Sat, 12 Jul 2014 00:19:03 +0000 (17:19 -0700)]
tc: add co_groups for tc qdisc and filter

Otherwise these tc caches would not be able to be updated
asynchronously.

Cc: Thomas Haller <thaller@redhat.com>
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobuild: embed the git commit id of HEAD in the configure script
Thomas Haller [Fri, 4 Jul 2014 17:58:04 +0000 (19:58 +0200)]
build: embed the git commit id of HEAD in the configure script

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobuild: let autogen.sh script change into top source directory
Thomas Haller [Fri, 4 Jul 2014 17:58:03 +0000 (19:58 +0200)]
build: let autogen.sh script change into top source directory

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoip6tnl: Use <netinet/in.h> for in6_addr and stuff
Thomas Graf [Sat, 28 Jun 2014 07:50:32 +0000 (08:50 +0100)]
ip6tnl: Use <netinet/in.h> for in6_addr and stuff

<linux/in6.h> is not compatible with some versions of <netinet/in.h>.

Cc: Susant Sahani <susant@redhat.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agodoc: state in documentation that libnl3 is supposed to work with 3.x kernels
Thomas Haller [Fri, 27 Jun 2014 17:41:18 +0000 (19:41 +0200)]
doc: state in documentation that libnl3 is supposed to work with 3.x kernels

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agolibnl-3.2.25-rc1 release libnl3_2_25rc1
Thomas Haller [Wed, 25 Jun 2014 10:57:13 +0000 (12:57 +0200)]
libnl-3.2.25-rc1 release

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoattr: nla_get_u64() should return 0 if the attribute does not fully contain 64 bit
Thomas Haller [Wed, 25 Jun 2014 08:11:56 +0000 (10:11 +0200)]
attr: nla_get_u64() should return 0 if the attribute does not fully contain 64 bit

Manually "inline" nla_memcpy() to nla_get_u64() and change the behavior
to return always zero (0) if the attribute does not contain at least
sizeof(uint64_t) bytes. Considering endianness, reading a truncated integer
does not seem to be useful and should result in a defined behavior
instead.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agodoc: fix doxygen-link.py by skipping invalid entries in libnl.dict
Thomas Haller [Wed, 25 Jun 2014 09:45:16 +0000 (11:45 +0200)]
doc: fix doxygen-link.py by skipping invalid entries in libnl.dict

Newer versions of doxygen (on Fedora20) treat the documentation
slightly different so that the following entires end up in
libnl.dict:

    \=api/group__attr.html#ga769cc7bd882aab17c3740dd83329d7e6
    »·······»·······NLA_PUT=api/group__attr.html#ga769cc7bd882aab17c3740dd83329d7e6
    NLA_PUT=api/group__attr.html#ga769cc7bd882aab17c3740dd83329d7e6

Especially, replacing r'\' breaks the generated html documentation.
Extend doxygen-link.py to strip whitespaces from the name and
skip over r'\'.

Also, when replacing the words in the output file, match them
using word boundaries r'\b'.

Also, don't print an additional newline after each processed line.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocache: add missing declaration of nl_cache_move() in include/netlink/cache.h
Sruthi Yellamraju [Tue, 24 Jun 2014 19:03:15 +0000 (15:03 -0400)]
cache: add missing declaration of nl_cache_move() in include/netlink/cache.h

Signed-off-by: Sruthi Yellamraju <ysruthi@gmail.com>
[thaller@redhat.com: modified tab vs. whitespace]
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'coverity-fixes-2'
Thomas Haller [Wed, 25 Jun 2014 07:26:49 +0000 (09:26 +0200)]
Merge branch 'coverity-fixes-2'

http://lists.infradead.org/pipermail/libnl/2014-June/001507.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoattr: fix compile warning in headers
Peter Wu [Tue, 24 Jun 2014 21:13:38 +0000 (23:13 +0200)]
attr: fix compile warning in headers

strlen() returns a size_t type, but nla_put accepts an int only. This
breaks a -Werror build of applications using libnl, so avoid this
warning by explicitly casting the length to an int.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoattr: prevent garbage return value for NULL param
Peter Wu [Tue, 24 Jun 2014 21:13:37 +0000 (23:13 +0200)]
attr: prevent garbage return value for NULL param

If nla is not given, then tmp is not set. Explicitly initalize with 0
to prevent garbage values. Found by Clang static analyzer.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agou32: prevent memcpy from NULL
Peter Wu [Tue, 24 Jun 2014 21:13:36 +0000 (23:13 +0200)]
u32: prevent memcpy from NULL

Found by Clang static analyzer.

Fixes: 6cdc32df831a273007af7d24a3f75cd06e0ae738
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agodoc: fix error in core documentation for nl_cache_mngr_alloc()
Thomas Haller [Tue, 17 Jun 2014 16:42:48 +0000 (18:42 +0200)]
doc: fix error in core documentation for nl_cache_mngr_alloc()

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocache_mngr: Fix assignment of error code in nl_cache_mngr_alloc()
Tobias Klauser [Tue, 17 Jun 2014 12:58:10 +0000 (14:58 +0200)]
cache_mngr: Fix assignment of error code in nl_cache_mngr_alloc()

In the current form, the parentheses in these two if (...) statements
lead to err being assigned the result of nl_connect(...) < 0 and
nl_socket_set_nonblocking(...) < 0 instead of the return value of these
functions. Adjust the parentheses to assign the returned error code to
err.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocache_mngr: Return proper error code if nl_socket_alloc() fails
Tobias Klauser [Tue, 17 Jun 2014 12:58:09 +0000 (14:58 +0200)]
cache_mngr: Return proper error code if nl_socket_alloc() fails

If nl_socket_alloc() failes in nl_cache_mngr_alloc() we would currently
return 0 due to the previous assignment of the err variable, even though
the failed allocation is an error condition. Fix this by setting err to
-NLE_NOMEM if nl_socket_alloc() fails.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocli: Fix typo in error message
Tobias Klauser [Tue, 17 Jun 2014 12:48:24 +0000 (14:48 +0200)]
cli: Fix typo in error message

s/neighbout/neighbour/

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agobuild: fix error in include/Makefile.am
Thomas Haller [Mon, 16 Jun 2014 15:45:11 +0000 (17:45 +0200)]
build: fix error in include/Makefile.am

Just introduced by me, as an oversight from commit
11f9cc0914aef697c1f49bca7353117cb65fd318.

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoip6tnl: introduce ip6 tunnel support
Susant Sahani [Sat, 10 May 2014 04:48:12 +0000 (10:18 +0530)]
ip6tnl: introduce ip6 tunnel support

This patch adds support for ip6 tunnel that works with
the ip6_tunnel kernel module.

Signed-off-by: Susant Sahani <susant@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoMerge branch 'coverity-fixes'
Thomas Haller [Tue, 10 Jun 2014 19:46:49 +0000 (21:46 +0200)]
Merge branch 'coverity-fixes'

http://lists.infradead.org/pipermail/libnl/2014-June/001475.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute/pktloc: read_pktlocs() always returned success status
Thomas Haller [Tue, 10 Jun 2014 16:15:52 +0000 (18:15 +0200)]
route/pktloc: read_pktlocs() always returned success status

Error found by coverity.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agonetfilter/ct: fix calling nfnl_*_put() on uninitialized memory after nfnlmsg_*_parse()
Thomas Haller [Tue, 10 Jun 2014 16:06:37 +0000 (18:06 +0200)]
netfilter/ct: fix calling nfnl_*_put() on uninitialized memory after nfnlmsg_*_parse()

nfnlmsg_*_parse() does not assign *result on error. So this will
lead to freeing a dangling pointer.

Error found by coverity.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute/link: fix dangling pointer after rtnl_link_get_ifalias(link, NULL)
Thomas Haller [Tue, 10 Jun 2014 15:50:09 +0000 (17:50 +0200)]
route/link: fix dangling pointer after rtnl_link_get_ifalias(link, NULL)

Fixed bug that left a dangling pointer after clearing the ifalias
property. This happened when calling 'rtnl_link_get_ifalias(link, NULL)'
on a link that has already an ifalias set.

This can cause a crash and/or a double-free.

Error found by coverity.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocache: fix crash in nl_cache_dump_filter() when omitting the params argument
Thomas Haller [Tue, 10 Jun 2014 15:42:31 +0000 (17:42 +0200)]
cache: fix crash in nl_cache_dump_filter() when omitting the params argument

Error found by coverity.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocls: fix array overrun in rtnl_ematch_opnd2txt()
Thomas Haller [Tue, 10 Jun 2014 13:29:11 +0000 (15:29 +0200)]
cls: fix array overrun in rtnl_ematch_opnd2txt()

Error found by coverity.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agocli: add error checking to nl-route-get about out-of-memory
Thomas Haller [Tue, 10 Jun 2014 13:54:45 +0000 (15:54 +0200)]
cli: add error checking to nl-route-get about out-of-memory

This is mainly to appease coverity which warned about this.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
10 years agoroute: remove unnecessary non-null check in pktloc and ematch
Thomas Haller [Tue, 10 Jun 2014 14:15:02 +0000 (16:15 +0200)]
route: remove unnecessary non-null check in pktloc and ematch

This check is not necessary, and also they cause coverity to
complain.

Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>