dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

777 Commits

Author SHA1 Message Date
Patrick McHardy d2b5cbd88a Merge git://git.infradead.org/users/tgr/libnl
Signed-off-by: Patrick McHardy <kaber@trash.net>

Conflicts:
	include/linux/netlink.h
	lib/Makefile.am
	lib/error.c
	libnl-3.0.pc.in
	src/Makefile.am
2013-04-01 11:44:59 +02:00
roopa 6c9be5a316 nl-route-add: Add NLM_F_EXCL flag to route add
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-24 10:58:18 +01:00
Tony Cheneau 23e26e9e05 Remove rtnl_link_free() declaration from the header file.
Reason: there is no rtnl_link_free() definition anywhere in the code.

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-17 17:31:53 +01:00
Tony Cheneau 4db11517fd Remove superfluous declaration of rtnl_route_put()
rtnl_route_put() is declared twice in the same header file

Signed-off-by: Tony Cheneau <tony.cheneau@amnesiak.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-17 17:31:45 +01:00
Thomas Graf b39c9f7a53 rtnl-addr: Fix invalid call to nl_addr_set_prefixlen() if neither local or peer address are present
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 18:57:15 +01:00
Thomas Graf 549d26dc87 rtnl-addr: Inherit prefix length to nl_addr objs in rtnl_addr_set_prefixlen()
Previously if using rtnl_addr_set_prefixlen() the new prefix length
was not forwarded to the corresponding 'struct nl_addr' objects
associated with address already and thus the comparison function
would fail.

This patch also clears the internal ADDR_ATTR_PREFIXLEN flag if
the prefix length has been reset.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 18:52:17 +01: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 780a0423dc addr: Update to latest address familiy definition for translation
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 16:09:19 +01:00
Thomas Graf 88527534ba addr: improve API reference documentation for nl_addr_*()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 15:37:46 +01:00
Thomas Graf f0f33c394b addr: Reset unused portion of binary address in nl_addr_set_binary_addr()
memset() the binary address before overwriting it with new data
to avoid leaving around old portions of the address.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 14:41:12 +01:00
Thomas Graf f72bfc7220 msg: Pretty print error message header even if incomplete
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 12:46:14 +01:00
Thomas Graf c608b4d151 msg: Pretty print padding attributes in nl_msg_dump()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 12:46:12 +01:00
Thomas Graf 1395c69901 attr: Warn application if nla_parse() observes same attribute multiple times
Use a debugging message to warn applications if an attribute is
found multiple times in the same message. It is perfectly valid
to rely on this behaviour but it is likely to indicate a bug.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 12:46:09 +01:00
Thomas Graf 64315f731c attr: No longer warn about attribute of type 0
The kernel will start using type 0 attributes for padding purposes.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 12:46:06 +01:00
Thomas Graf 60b370de8c attr: Do not enforce maximum length for NLA_FLAG attributes
Although wasteful, NLA_FLAG with non zero payload cause no harm
and should thus not be rejected.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 12:46:04 +01:00
Thomas Graf 9e6cdbf6fc attr: Add nla_nest_cancel() to remove partially added nested attributes
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-03-14 12:46:01 +01:00
Thomas Graf 4d7680c19c Use thread-safe strerror_r() instead of strerror()
We have only ever fed well known error codes into strerror()
so it should never have been a problem though.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-28 13:07:04 +01:00
roopa ded20487fd link: Fix rtnl_link_af_data_compare return value
This patch fixes a bug where because of the af_ops check
being first in the function, we were returning ~0 if af_ops
was null even if both objects really did not have af_data
and we should be returning 0.

Its better to have the af_data present check before anything else.

So, Rearranged some of the code in rtnl_link_af_data_compare.
Changes include:
	- Do the attribute present check before anything else
	- If ao_compare op not present, return ~0

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-24 17:11:36 +01:00
roopa 8f151fadda link: move af_data_compare to the end
In the current code if rtnl_link_af_data_compare returns value > 0
we mark PROTINFO attribute in the diff mask and return without
comparing flags.

This patch makes af_data to be the last thing we compare.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-24 17:06:54 +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 bb9911b5a3 netlink: Forward declare frequent libnl types to ease inclusion deps
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-14 12:37:10 +01:00
Thomas Graf 5a5aa73158 bridge: Provide rtnl_link_bridge_alloc()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-14 12:34:57 +01:00
Thomas Graf fd19dae352 bridge: Support the new bridging attributes
This provides support for the new bridging attributes provided
in IFLA_PROTINFO while maintaining backwards compatibility
with older kernels.

A set of new API functions are exported to access the bridging
information. rtnl_link_bridge_has_ext_info() can be used to
check whether a bridge object has been constructed based on
the newly available attributes or the old message format.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-07 11:39:27 +01:00
Thomas Graf 9f8548b551 attr: Provide nla_is_nested() function
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-05 22:31:31 +01:00
Thomas Graf 8026fe2e3a link: Free and realloc af specific data upon rtnl_link_set_family()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-05 13:52:22 +01:00
Thomas Graf 4a793a4235 link: Hold af_ops reference for each AF_SPEC block during lifetime of link object
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-05 13:46:42 +01:00
Thomas Graf e5767684a6 link: Modify link policy on the stack
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-05 13:21:10 +01:00
Thomas Graf 2d36371aa1 link: Keep reference to af_ops during lifetime of link object
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-05 13:18:25 +01:00
Thomas Graf 8b8e26b333 link: Fix af_ops leak on ENOMEM
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-05 13:03:02 +01:00
Holger Dengler 506020ae99 can: Fix nested message creation in can_put_attrs()
Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Holger Dengler <dengler@linutronix.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-01 12:24:37 +01:00
Thomas Graf 1c24480180 can: Include "linux/can/netlink.h" in the distribution
Needed to compile if local kernel headers are outdated.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-01 10:51:33 +01:00
Thomas Graf 8571f58f23 neigh: Remove check for AF_UNSPEC in rtnl_neigh_get()
This check was introduces to not accidently return AF_BRIDGE objects
to unaware API users as they do differ in structure. However, such
objects are only available if explicitely requests using the
NL_CACHE_AF_ITER flag or by using arg1 == AF_BRIDGE for the cache.

Therefore remove this check and allow rtnl_neigh_get() to be used to
fetch any neighbor object of a cache.

Reported-by: Maxime Bizon <mbizon@freebox.fr>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-01 10:45:01 +01:00
Thomas Graf 2005c2ecac cache: Make NL_ACT_* and nl_cache_ops_(get|put)() available
Move NL_ACT_* definition and the functions nl_cache_ops_get()
and nl_cache_ops_put() into the public facing API. They can
be considered stable.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-02-01 10:21:58 +01:00
Thomas Graf 87458abbd0 Fix mask calculation in nl_addr_cmp_prefix()
Signed-off-by: Malte Langermann <mlangermann@radiodata.biz>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-31 10:59:10 +01:00
Thomas Graf 73cb5f57ba Merge branch 'nattuple' of https://github.com/rmfought/libnl 2013-01-31 10:47:58 +01:00
roopa b06c23a9dd link cache: remove AF_UNSPEC check in rtnl_get_link and rtnl_get_link_by_name
This patch reverts back the AF_UNSPEC check introduced by AF_BRIDGE
changes at http://lists.infradead.org/pipermail/libnl/2012-November/000796.html

After the addition of AF_BRIDGE support, link cache can now contain objects of
type AF_BRIDGE. To make sure existing api's did not return AF_BRIDGE objects
and surprise existing callers, I introduced the check for AF_UNSPEC.

But from what Andy Wang reported, rtnl_link_get_by_name returns the first
link object with matching ifindex and that could have not only been AF_UNSPEC
but also of family AF_INET6. And his app always got an AF_INET6 object prior
to the patch that introduced the AF_UNSPEC check.

I could just add AF_INET6 family check along with AF_UNSPEC in the apis and that
should work well.

But thinking about it some more, removing the AF_UNSPEC change seems to be safer at
this point. That way this api will retain its semantics and return the first object
with matching ifindex. It could be of any supported family. The user will know if the
cache contains bridge objects, because they are available only with the cache flag
NL_CACHE_AF_ITER. Besides, if new users want to search for a specific object,
nl_cache_find is a better option.

Reported-by: Andy Wang <Andy.Wang@watchguard.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-31 10:09:12 +01:00
Rich Fought 4f088d38ae netfilter: correct error in construction of NAT tuple 2013-01-29 15:10:01 -08:00
Benedikt Spranger 6cc5fdc0e9 can: add helper function to get CAN bus state
Add a helper function to get the CAN bus state.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
2013-01-25 19:51:33 +01:00
Thomas Graf 4cb375a812 Merge pull request #29 from rmfought/natdir32
netfilter: expectation NAT direction is 32 bit attribute
2013-01-24 08:32:35 -08:00
Rich Fought 87244f739c netfilter: keep 8-bit API for 32-bit NAT dir attribute 2013-01-24 08:18:35 -08:00
Thomas Graf 83c762d7cf 3.2.21 release 2013-01-24 15:00:26 +01:00
Thomas Graf b6afd0bf1a Provide better help text when bumping CURRENT,AGE,REVISION
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 14:34:22 +01:00
Thomas Graf 776cde0a10 Remove obsolete warning from <netlink/object-api.h> as it breaks NM build
NM uses -Werror=cpp thus the build breaks if we emit #warning upon
inclusion of <netlink/object-api.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 14:29:18 +01:00
Thomas Graf c4f803366e Fix build warnings of nl-(qdisc|class|cls)-add
Reported-by: Jeroen Roovers <jer@gentoo.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 14:10:33 +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
Thomas Graf 1b9de9a49d Provide compat headers for removed private API
Some projects seem to have mistakenly included the private
API headers without actually needing them.

Provide dummy headers referring to the real headers to
provide backwards compatibility.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 14:03:52 +01:00
Thomas Graf 9680f910f4 Move private header files to <netlink-private/*>
This clarifies the seperation between public and private
header files.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-24 13:51:24 +01:00
Rich Fought 56352ab9f6 netfilter: expectation NAT direction is 32 bit attribute 2013-01-23 13:59:27 -08:00
Jiri Pirko 1419851eb4 fix includes after removing some headers
commit f20bbe1f07
Author: Thomas Graf <tgraf@suug.ch>
Date:   Tue Jan 22 19:10:38 2013 +0100

    No longer install module API headers

This commit causes a regression so no app using libnl can be compiled
against it. This patch fixes it by removing includes of no-longe
existing headers.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-23 13:37:29 +01:00