Commit Graph

1409 Commits

Author SHA1 Message Date
Thomas Haller
dad421eaac build: merge branch 'cli-no-dlfcn-h'
https://github.com/thom311/libnl/pull/141
2017-05-15 11:53:49 +02:00
Thomas Haller
c881a27fbd build: allow building cli without dynamic librarires support
Commit 3cb28534d3 enables building
of cli always as part of `make check`. As cli previously always
included <dlfcn.h>, this broke tests for building with toolchains
that don't support dynamic library loading.

Add a configure check and disable dlopen() based on whether
<dlfcn.h> is available.

Signed-off-by: Thomas Haller <thaller@redhat.com>

https://github.com/thom311/libnl/pull/141
2017-05-12 12:57:34 +02:00
Thomas Haller
144c6c5e6a build: don't build cli libraries by default
When configuring with --enable-cli=no, we should not build
the libraries related the cli.

This fixes commit 3cb2853 (build: enable building cli during tests)
which enables building of cli during `make check`. However, during
regular build, these libraries should not get build.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 12:46:34 +02:00
Tobias Klauser
286a86c75e addr: add AF_VSOCK to translation table
Add AF_VSOCK to the address family translation table.

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

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 11:49:54 +02:00
Thomas Haller
70556f55ce rule: merge support for l3mdev in FIB rules
http://lists.infradead.org/pipermail/libnl/2017-May/002321.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 11:39:21 +02:00
Thomas Haller
a25db57470 rule: change API for setting/getting l3mdev rule property
- for rtnl_rule_set_l3mdev(), also allow unsetting the l3mdev field.
  In practice, kernel only allows for two options: either omit
  tb[FRA_L3MDEV] or set it to 1. As such, rtnl_rule_set_l3mdev()
  allows for both of these. In principle the setter could get
  extended to set other values. Such values are reserved.

- for rtnl_rule_get_l3mdev() also return an error code. I think it
  is appropriate to mix value and negative error code, as long as
  the range of values cannot overlap with error codes.
  Arguably, the outcome is a bit awkward, as the function now is
  expected to return -NLE_MISSING_ATTR or 1. So, the best check
  is probably

      if (rtnl_rule_get_l3mdev(r) > 0) { ... }

The reason for this change is that libnl should expose the netlink
API without coercing uint8 to boolean. That way, future changes
in kernel don't require update to libnl3.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 11:27:57 +02:00
David Ahern
ef4a2bdfe2 rule: Add support for l3mdev in FIB rules
Add support for the l3mdev option in FIB rules. If l3mdev is set
then the lookup is directed to the table associated with the l3mdev
(e.g., VRF) device.

If the l3mev attribute is set the table id is not, so update the table
id attribute to make sure r_table is non-0.

iproute2 shows the rule as:
    1000:	from all lookup [l3mdev-table]

where [l3mdev-table] infers the dynamic nature of the table id. Keep
that notation for libnl.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 10:35:57 +02:00
David Ahern
17b95e25e3 Update fib_rules.h to latest kernel
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 10:35:57 +02:00
Thomas Haller
c8adb573d0 route: merge branch 'netconf'
(v1): http://lists.infradead.org/pipermail/libnl/2017-April/002308.html

http://lists.infradead.org/pipermail/libnl/2017-May/002316.html

Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 10:22:19 +02:00
David Ahern
37fda66735 route: Add support for MPLS to netconf
Add support to netconf for MPLS address family.

v2
- change get method to return 0/error and take 'int *val'
  which is set to the value requested
- added rtnl_netconf_get_input to libnl-route-3.sym

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 10:09:15 +02:00
David Ahern
a66511d7ed nl-monitor: Add support for netconf caches
Allow user to monitor netconf changes.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 10:09:15 +02:00
David Ahern
92b96a48ec nl-monitor: All user to specify line format
nl-monitor defaults to stats. Allow user to select brief and details.

The known_groups is moved up to a global to allow a proper print_usage
function.

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 10:09:15 +02:00
David Ahern
d55f004c5a route: Add support for netconf
Add route/netconf cache type to monitor RTM_*NETCONF messages.

v2
- change get methods to return 0/error and take 'int *val'
  which is set to the value requested

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Balakrishnan Raman <ramanb@cumulusnetworks.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-12 10:09:15 +02:00
Thomas Haller
b5513d46aa route: merge branch 'shanmugh-master'
Related: https://github.com/thom311/libnl/pull/137
Related: http://lists.infradead.org/pipermail/libnl/2017-March/002303.html
Related: http://lists.infradead.org/pipermail/libnl/2017-March/002304.html

https://github.com/thom311/libnl/pull/138
2017-05-03 13:30:48 +02:00
Thomas Haller
eb481fb22c route: fix symbol versioning
Once released, an existing symbol version must not be modified.
Move the new symbols to the right section.
2017-05-03 13:01:08 +02:00
Santhosh Kumar
a20a49fa54 Do not increment refcount in rtnl_*_get_action APIs. 2017-05-03 13:00:42 +02:00
Santhosh Kumar
7a26c7934b Provide accessors for actions (rtnl_act).
Add accessor functions to retrieve actions on a tc object
and provide additional function to navigate the collection
of actions.
2017-05-03 13:00:42 +02:00
Markus Trapp
b9a5a83233 route/link: add accessor API for IPv6 flags
Add functions to access the IPv6 specific flags of a link object.
Also the functions for IPv6 link flags translation are now exported, similar
to the non IPv6 specific translation functions.

https://github.com/thom311/libnl/pull/136
2017-05-03 12:50:37 +02:00
Thomas Haller
8aca21de41 tools: fix building doc in build_release.sh
Fixes: 3b2071e970
2017-05-03 12:00:12 +02:00
Thomas Haller
2e0c4ade67 libnl-3.3.0 release
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-05-03 10:38:11 +02:00
Thomas Haller
54344bc063 all: don't use math.h or link with libm.so 2017-03-23 14:48:46 +01:00
Alexey Brodkin
e15966ac7f lib: escape usage of strerror_l() if it doesn't exist in libc
uClibc doesn't implement strerror_l() and thus libnl starting from
3.2.29 couldn't be compiled with it any longer.

To work-around that problem we'll just do a check on strerror_l()
availability during configuration and if it's not there just fall back
to locale-less strerror().

See-also: 6c2d111177

http://lists.infradead.org/pipermail/libnl/2017-March/002301.html

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-03-12 14:42:42 +01:00
Thomas Haller
bcdf874adb libnl-3.3.0-rc1 release
First release candidate for upcoming libnl 3.3.0 release.

Note that from now on, future libnl3 release will bump the
second version number, instead of the third. So the next
version will be 3.3.0 instead of 3.2.30.
This does not imply a break of API/ABI, it is only a change
of the versioning scheme.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2017-03-06 21:41:18 +01:00
Thomas Haller
6bcb90da87 include: merge branch 'include-cleanup' 2017-03-02 01:33:48 +01:00
Thomas Haller
eddd04e603 include: restore linux header includes in public headers
The previous commits reorganized the public headers to drop includes
of linux kernel headers.

Restore the previous situation because otherwise the change might
break compilation for users who rely on certain headers getting dragged
in by libnl3.
2017-03-02 01:33:32 +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
3b2071e970 build: add tools/build_release.sh script
Add script to do a release.
2017-02-28 12:15:41 +01:00
Thomas Haller
f0af5d5a0c build: reorder checks in configure.ac 2017-02-28 00:46:06 +01:00
Thomas Haller
23c00e97a9 build: style cleanup in doc/Makefile.am 2017-02-28 00:09:06 +01:00
Thomas Haller
011b6cc726 build: fix creating directories for generated sources
Fixes: a572196366
2017-02-27 18:26:14 +01:00
Thomas Haller
fe507dbdd3 build: pass --disable-dependency-tracking to make distcheck 2017-02-27 18:02:10 +01:00
Thomas Haller
839aec3536 build: ensure build directory for generated sources exist
For out-of-tree builds, we must ensure that the build directory
for the generated sources exists. We do that by adding a dependency
to the .dirstamp file.
2017-02-27 18:02:06 +01:00
Thomas Haller
fc21d073d9 xfrm: merge branch 'sb/xfrm-sp-fixes' (#133)
https://github.com/thom311/libnl/pull/133
2017-02-27 17:43:03 +01:00
Thomas Haller
f9cee4dc47 xfrm: NUL terminate the ctx_str buffer in xfrmnl_sa_set_sec_ctx()
and xfrmnl_sp_set_sec_ctx(). The user already must pass a NUL
terminated string, where the NUL is included in ctx_len.

Just allocate one more by and ensure the buffer is '\0' terminated.
2017-02-27 17:39:54 +01:00
Thomas Haller
3261dc4009 xfrm: allow quering optional arguments from xfrmnl_sp_get_sec_ctx()
The previous API of xfrmnl_sp_get_sec_ctx() is totally broken,
as it requires all out-arguments to be set. The user can thus
not know how large the ctx_str buffer must be.

Fix the API by allowing all arguments to be optional. Thus,
a user can first query the size only, and then in a second
step query the ctx_str. Previous version are broken.
2017-02-27 17:32:15 +01:00
Simon Buttgereit
83e10beabc fix of boolean operators
Mixed up boolean operators in commit f38fb7a.
This commit is the appropriate fix.
2017-02-27 16:43:48 +01:00
Simon Buttgereit
7b1fb399a3 update documentation of xfrmnl_sp_get_sec_ctx 2017-02-27 16:43:48 +01:00
Simon Buttgereit
860709862a add possibity to delete policy without index
security policy can be identified with direction, selector and security context
too. Therefore the code to append approptiate data to delete message is added.
2017-02-27 16:43:48 +01:00
Simon Buttgereit
2c5b92dfaf update sp_attr condition in build_xfrm_sp_message
Identification of policy are possible with:
    1. direction and index
    2. direction and selector
Theoretically second one needs a security context, but non existing context is
valid too.
2017-02-27 16:43:48 +01:00
Simon Buttgereit
7efe45f96d little style fixes. 2017-02-27 16:43:48 +01:00
Simon Buttgereit
55490ceea5 fix xfrmnl_sp_set_sec_ctx length attributes
Fixed xfrmnl_sp->sec_ctx length parameters in xfrmnl_sp_set_sec_ctx,
because former use of only one value wasn't right.
Therefore parameter len is unsued and could be removed.
2017-02-27 16:43:48 +01:00
Simon Buttgereit
0704cd93f5 fix build_xfrm_sp_message index condition
Index is not needed and not known if adding a policy. Seems to be copied from
build_xfrm_sp_delete_message.
2017-02-27 16:43:48 +01:00
Roopa Prabhu
9b22e310ce route: neigh: use NDA_MASTER for neigh->n_master if available
fdb cache is per bridge and hence hashed by:
<bridge_ifindex, family, mac>

newer kernels send bridge ifindex in NDA_MASTER.
Use NDA_MASTER for neigh->n_master when available.

Also imports a few more NDA_* attributes from upstream
to keep linux/neighbour.h NDA_* attributes in sync with
upstream.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
2017-02-27 14:15:15 +01:00
Thomas Haller
eabd9f2334 build: enable more warnings 2017-02-27 14:10:02 +01:00
Thomas Haller
5d4a545dec all: enable -Wmissing-prototype warning for all components 2017-02-27 14:01:22 +01:00
Thomas Haller
2435d7be0d build: merge branch 'th/non-recursive-make'
Refactor makefiles to use one top-level Makefile.am
and don't do recursive make.

Exception is doc/Makefile.am, which is still separate
like before.
2017-02-27 13:50:00 +01:00
Thomas Haller
812e16a77f build: move compiler warning flags to separate autoconf variable 2017-02-27 13:36:03 +01:00
Thomas Haller
3cb28534d3 build: enable building cli during tests
The cli programs don't have any additional external dependencies.
So, during a `make check`, we should always build them, even if
they were disabled during configure and won't be installed.
2017-02-27 13:36:03 +01:00
Thomas Haller
cf2ccbd5cc build: merge src/Makefile.am into top-level makefile 2017-02-27 13:36:03 +01:00
Thomas Haller
061d4fd8b8 build: merge src/lib/Makefile.am into top-level makefile 2017-02-27 13:36:03 +01:00