dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

810 Commits

Author SHA1 Message Date
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
Thomas Graf 26e22d887e 3.2.20 release 2013-01-23 11:02:54 +01:00
roopa 1481f97d36 route cache: This patch adds route priority to route object oo_id_attrs
The kernel allows multiple entries in the main table which differ in the
priority value. In libnl currently, since priority is not part of the base
netlink route message, it is not used as part of the key. This patch
includes priority in the key/oo_id_attrs and defaults the value to zero
for messages where priority is not included.

One point to note is that the actual selection of route from multiple
options is done implicitly in the kernel by storing the routes in sort
priority order, but there is no explicit communication to a client of libnl
of that.

Signed-off-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-23 11:02:51 +01:00
Thomas Graf 2b96c3381d Remove obsolete release notes at end of configure
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-23 11:02:49 +01:00
Thomas Graf f20bbe1f07 No longer install module API headers
Various header files providing an API to implement own cache and
object types or implement link types have been available in the
past. Their API is marked unstable in the documentation and nobody
is using them so far.

Technically they have been causing ABI breakages in at least two
3.2.x releases. In order to avoid future accidental breakage, no
longer install these and require module developers to clone the
git tree and build modules off the git tree directly to make sure
that the API is unstable at this point.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-23 11:02:44 +01:00
Thomas Graf 7559157f2d Undo soname bump
The soname was bumped before 3.2.18 was released to reflect
an ABI change in the cache and object API.

This caused a discussion with various distribution maintainers
involved as it prevented them from including the release in
their stable branches. This is especially unfortunate as the
corresponding API is unused outside of libnl as of now.

For this reason, I have decided to undo the soname bump and
instead remove the corresponding header files from the list of
installable headers and thus remove them from the public API.

This is a API break technically but since nobody is using
them it should not matter. If you are in fact using any of the
*-api.h headers please let me know and we are most likely to
start a new development branch.

If your application linked against 3.2.18 or 3.2.19 you will need
to relink if you want it to use >= 3.2.20.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-23 11:02:37 +01:00
Thomas Graf 5291af6fb5 link: fix reference leak in rtnl_link_af_data_compare()
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-18 14:49:33 +01:00
roopa 5c3f2f015a link: Add af data compare to link objects
Today the link compare function does not
compare af data of a link. We have found a
need for this to get approriate change callbacks
when af_data of a link changes.

This patch adds support to compare af_data
to link_compare function. This patch today
only adds support to compare af_data set by
PROTINFO attributes. It can be extended to
support compares of af_data set by AF_SPEC
attributes

It has been tested for AF_BRIDGE objects.
In case of AF_BRIDGE objects, this helps with
bridge port change notification callbacks.

Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-18 14:42:18 +01:00
roopa 99399ca9c0 Add new rtnl_link_af_data_compare function to compare af_data
This patch adds a new api rtnl_linl_af_data_compare to
compare link af_data

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-18 14:41:58 +01:00
Thomas Graf 6b4a2cb634 3.2.19 release 2013-01-17 14:02:35 +01:00
roopa 310ec86b39 Add ao_compare support to bridge family af_data
This patch adds support for ao_compare operation
to bridge link af data operations.

Adds field ce_mask to struct bridge_data to work
with the ATTR attributes. I can submit separate
patches to introduce mask field to ATTR macros.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-12 11:38:35 +01:00
roopa 09213ee5ee link af ops: Add new ao_compare op to compare link af_data
This patch adds new operation to compare link af_data.
ao_compare is similar to object oo_compare operation.
This op can be used when two links are compared
 for their af data. It takes two link objects in
question, an object specific bitmask defining which
attributes should be compared and flags to control
the behaviour. The function must return a bitmask
with the relevant bit set for each attribute that mismatches.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-12 11:37:32 +01:00
roopa b1ebda9241 cache: Add new nl_cache_find api
This patch adds new cache find api

nl_cache_find api was suggested by Thomas.

Unlike nl_cache_search, this patch uses
nl_object_match_filter() to look for an
object match.

Am not sure this matches what was decided
on the list few weeks back. I will be happy
to make any changes.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-11 13:52:50 +01:00
Flavio Leitner 3540e44b15 link: add carrier support
Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-11 13:44:47 +01:00
Thomas Graf f123795434 3.2.18 release 2013-01-08 14:47:03 +01:00
Thomas Graf 383ff943b4 fix include/Makefile.am
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-08 14:44:47 +01:00
Otavio Salvador de5744fb65 build: Fix distribution to include 'nfnetlink_conntrack.h'
The header has not been included in the headers list so it has been
been distributed in the tarball making it fail to build in old kernels.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-08 14:38:49 +01:00
mihai.dontu@gmail.com ba38f39198 cache: make sure the user has specified a callback
In cache_include(), the user callback is used even though one might not
have been specified, leading to a crash. This happens, for example, when
NetworkManager calls nl_cache_include() with the change_cb argument set
to NULL. Fix it by making sure the callback points to a valid address.

Signed-off-by: Mihai Dontu <mihai.dontu@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2013-01-06 14:22:15 +01:00