Commit Graph

62 Commits

Author SHA1 Message Date
Byeonggon Lee
4ff7c66996 tests: use nl_send_auto() instead of deprecated nl_send_auto_complete() in test-genl.c
https://github.com/thom311/libnl/pull/213
2019-08-07 14:44:58 +02:00
d0u9
ddfc36f46e Add support for cloning cgroup filter object.
In this commit, we implement ematch_tree_clone(), which is basis of
cgroup_clone() interface. The whole ematch tree is deep-copied except
the e_ops filed.

Also, a new unit test is added for testing the interface, which named as
check-ematch-tree-clone.c located in tests directory.

https://github.com/thom311/libnl/pull/176
2018-06-25 14:39:41 +02:00
Thomas Haller
cb8e34859b lib/rtnl: rename public define RTNL_GENEVE_ID_MAX
Public defines must have a libnl3 related prefix. Rename
GENEVE_ID_MAX to RTNL_GENEVE_ID_MAX.
2018-02-12 15:23:02 +01:00
Wang Jian
6b4fc607ba link: add Geneve support.
Signed-off-by: Wang Jian <jianjian.wang1@gmail.com>
2018-02-12 14:36:15 +01:00
Marcos Paulo de Souza
d747083a3c tests: Add test to {de}activate loopback interface
This tests is much more like an example of how to do it, and also works
as a test to check if rtnl_link_change is working as expected when it
comes to loopback interface.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>

https://github.com/thom311/libnl/pull/161
2018-01-16 09:00:28 +01:00
Thomas Haller
38baa675cf all: declare all variables at the beginning of scope (-Wdeclaration-after-statement)
Avoid gcc warning:

  error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
2018-01-16 06:45:23 +01:00
Chris Grahn
1656110346 tests: fix bug in test-create-bridge.c
The call to rtnl_link_get_master() at the end of the example can
misleadingly fail because the nl_cache isn't refilled after adding the
test interface to the test bridge.

This commit changes the example to refill the cache before calling
rtnl_link_get_master().

https://github.com/thom311/libnl/pull/158
2017-12-08 15:00:30 +01:00
Thomas Haller
45cbfb9d11 include: don't include kernel headers in public libnl3 headers
It would be desirable not to include kernel headers in our public
libnl3 headers. As a test, remove all those includes, and fix
compilation by explicitly including the kernel headers where needed.
In some cases, that requires forward declaration for kernel
structures, as we use them as part of our own headers.

Realistically, we cannot drop those includes as it probalby breaks
compilation for users that expect to get a certain kernel header
when including a libnl3 header. So, this will not be done and the
includes will be restored in the next commit.

Do this step to show how it would be and to verify that we could
build with such a change. The reason not to do this is backward
compatibility (at compile-time).
2017-03-02 01:33:25 +01:00
Thomas Haller
5d4a545dec all: enable -Wmissing-prototype warning for all components 2017-02-27 14:01:22 +01:00
Thomas Haller
7b375953fa build: merge tests/Makefile.am into top-level makefile 2017-02-27 13:20:34 +01:00
Sabrina Dubroca
885ff4ae1e lib/route: add macsec support
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
2016-06-25 18:27:14 +02:00
Haishuang Yan
eec318f026 ipgre: add support for gretap tunnel
Since kernel support both gre/gretap tunnel, so add support
for gretap appropriately.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>

[thaller@redhat.com: modified original patch to move symbols
 in libnl-route-3.sym to proper section]

http://lists.infradead.org/pipermail/libnl/2016-April/002102.html
2016-04-15 16:18:41 +02:00
Beniamino Galvani
3f231213c7 route/link: add macvtap support
This adds support for MAC-VLAN based tap interfaces (macvtap).

http://lists.infradead.org/pipermail/libnl/2015-October/001976.html

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-11-19 17:20:28 +01:00
Thomas Haller
e6b39c9e23 gitignore: ignore test binaries in "tests/"
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-11-19 17:14:39 +01:00
David Ahern
493bbd13e6 route/vrf: add VRF support
http://lists.infradead.org/pipermail/libnl/2015-October/001991.html

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
[thaller@redhat.com: slightly modified original patch]
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-11-01 17:54:03 +01:00
Cong Wang
f99d48cc40 ipvlan: add a testcase for ipvlan
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2015-06-19 18:03:59 +02: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
Thomas Haller
d6f761bc4e 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>
2014-09-24 16:00:31 +02:00
Thomas Haller
1e3f316081 build/trivial: prettify makefiles by wrapping long lines
Signed-off-by: Thomas Haller <thaller@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
2014-09-24 16:00:26 +02:00
Thomas Haller
16e3d61689 tests: build test-create-macvlan as part of make check
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-08-18 15:17:43 +02:00
Cong Wang
944b982cc5 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>
2014-07-24 19:58:35 +02:00
Susant Sahani
11f9cc0914 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>
2014-06-16 16:59:16 +02:00
Thomas Haller
657e257ec5 gitignore: ignore test binaries and artifacts in "tests/"
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-06 12:48:47 +02:00
Susant Sahani
8f6301426a ipvti: introduce vti tunnel support
Signed-off-by: Susant Sahani <susant@redhat.com>
[thaller@redhat.com: some whitespace fixes]
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-06 12:04:02 +02:00
Susant Sahani
d715b8a5f6 introduce sit tunnel support
This patch introduces sit tunnel support

Signed-off-by: Susant Sahani <susant@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
[thaller@redhat.com: change WS to TAB, fix code doc]
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-05 19:08:29 +02:00
Susant Sahani
57bdc4ff48 introduce gre tunnel support
This patch introduces gre tunnel support

Signed-off-by: Susant Sahani <susant@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
[thaller@redhat.com: change WS to TAB, fix code doc]
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-05 19:08:23 +02:00
Susant Sahani
3a95fad5c9 introduce ipip tunnel support
This patch introduces ipip tunnel support. This
works with kernel module ipip.

Signed-off-by: Susant Sahani <susant@redhat.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
[thaller@redhat.com: change WS to TAB, fix code doc]
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-05 18:08:47 +02:00
Thomas Haller
0482cdcddb gitignore: ignore test binaries and artifacts in "tests/"
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-05 14:38:08 +02:00
Cong Wang
0ba7e663ce veth: grab a reference for rtnl_link_veth_get_peer()
So that users could keep a refcount for the peer.
The capability trick is from Thomas Haller.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-04-30 11:08:15 +02:00
Cong Wang
017c971142 rename rtnl_mirred_set_index() to rtnl_mirred_set_ifindex()
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09 15:33:27 +01:00
Cong Wang
aa1c5628fd add a parameter to rtnl_link_veth_add()
Usually the peer of a veth device is moved to a new netns
after creation, so add a pid parameter to rtnl_link_veth_add().

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-12-09 15:28:33 +01:00
Cong Wang
2e90ed5162 add u32 action test
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-09 01:16:31 +01:00
Cong Wang
4263106728 add veth link support
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-11-06 09:55:02 +01:00
Cong Wang
ac344b9b6a tests: fix make test-create-vxlan
Cc: Thomas Graf <tgraf@suug.ch>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-31 00:02:03 +01:00
Nicolas PLANEL
cb034e12a4 test: add bridge creation sample
New test sample file, test-create-bridge.c
Create an bridge (testbrige) and attach an already setup interface (testtap1) to it.

Signed-off-by: Nicolas PLANEL <nicolas.planel@enovance.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-10-22 14:20:41 +02:00
Yasunobu Chiba
162c906bf2 Add VXLAN support. 2013-08-04 15:43:54 +09:00
Thomas Graf
cd1c1e1041 tests: use AM_CFLAGS instead of CFLAGS directly
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-06-28 18:49:51 +02:00
Michael Braun
c76393e203 Add macvlan support
This patch add support for kernel macvlan interfaces.

Signed-off-by: Michael Braun <michael-dev@fami-braun.de>
2013-05-16 17:04:08 +02:00
Thomas Graf
ed1f4cba2c tests: Include util.h in dist
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28 12:51:58 +02:00
Thomas Graf
4e9aa6a9a6 tests: Add basic attribute unit tests
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-28 12:31:52 +02:00
Thomas Graf
ead4cdeb99 tests: Make unit test building optional
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-04-27 14:27:10 +02:00
Thomas Graf
e09e7f1035 tests: Add check based unit test system
Introduces new unit tests based on `check`. Each subsystem/module can
have its own unit tests in tests/check-<name>.c that will be linked
together in tests/check-all.c.

Running 'make check' will compile and run the unit tests automatically.

A reference unit test implementation has been done for the abstract
address module.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 16:25:17 +01:00
Thomas Graf
1ecf98a23e bond: Provide rtnl_link_bond_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-14 12:48:00 +01:00
Thomas Graf
ee4122a12e vlan: Provide rtnl_link_vlan_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-14 12:42:22 +01:00
Thomas Graf
c6abb44e38 Fix test-cache-mngr test
Needs to include <netlink-private/cache-api.h>

Reported-by: Jeroen Roovers <jer@gentoo.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 14:05:48 +01:00
Gilles Espinasse
de14136304 Fix make check when using --disable-cli
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2012-12-05 07:55:45 +01:00
Neil Horman
0c408aad1f genl: modify genl_ctrl_resolve and friends to allow for module auto-loading
Generic netlink has the ability to autoload modules in response to a request for
a family.  Currently libnl uses a GETFAMILY call with the NLM_F_DUMP flag to
list all the available families, but doing so neglects the possibility of an
autoloaded module.  This patch modifies the genl code to probe the kernel for a
specific family rather than dumping a list of all the currenlty available ones,
making autoload work properly.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Thomas Graf <tgraf@redhat.com>
2012-06-03 13:52:16 +02:00
Thomas Graf
faef2fa45f genl: Support registration of families without depending on caches
Introduces the functions genl_register_family() and
genl_unregister_family() to register a Generic Netlink family
which does not implement a cachable type.

API users can direct received messages into genl_handle_msg() which
will validate the messages and call the callback functions defined
in the commands definition.

See test/test-genl.c for an example on how to use it.
2012-06-01 11:48:08 +02:00
Adrian Ban
24d577c93d u32: fix various u32 hashing related warnings
I've add an missing u32 hash filter missing from u32.h
I've fix all warnings in file test-complex-HTB-with-hash-filters.c
2012-05-16 13:43:52 +02:00
Adrian Ban
7b503a12a0 u32: example/test code for u32 hashing with HTB 2012-05-08 23:17:53 +02:00