]> granicus.if.org Git - libnl/log
libnl
11 years agocan: Fix nested message creation in can_put_attrs()
Holger Dengler [Fri, 1 Feb 2013 10:56:47 +0000 (11:56 +0100)]
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>
11 years agocan: Include "linux/can/netlink.h" in the distribution
Thomas Graf [Fri, 1 Feb 2013 09:51:33 +0000 (10:51 +0100)]
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>
11 years agoneigh: Remove check for AF_UNSPEC in rtnl_neigh_get()
Thomas Graf [Fri, 1 Feb 2013 09:41:45 +0000 (10:41 +0100)]
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>
11 years agocache: Make NL_ACT_* and nl_cache_ops_(get|put)() available
Thomas Graf [Fri, 1 Feb 2013 09:21:58 +0000 (10:21 +0100)]
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>
11 years agoFix mask calculation in nl_addr_cmp_prefix()
Thomas Graf [Thu, 31 Jan 2013 09:59:10 +0000 (10:59 +0100)]
Fix mask calculation in nl_addr_cmp_prefix()

Signed-off-by: Malte Langermann <mlangermann@radiodata.biz>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoMerge branch 'nattuple' of https://github.com/rmfought/libnl
Thomas Graf [Thu, 31 Jan 2013 09:47:58 +0000 (10:47 +0100)]
Merge branch 'nattuple' of https://github.com/rmfought/libnl

11 years agolink cache: remove AF_UNSPEC check in rtnl_get_link and rtnl_get_link_by_name
roopa [Mon, 28 Jan 2013 15:46:16 +0000 (07:46 -0800)]
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>
11 years agonetfilter: correct error in construction of NAT tuple
Rich Fought [Tue, 29 Jan 2013 23:10:01 +0000 (15:10 -0800)]
netfilter: correct error in construction of NAT tuple

11 years agocan: add helper function to get CAN bus state
Benedikt Spranger [Fri, 25 Jan 2013 15:50:32 +0000 (16:50 +0100)]
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>
11 years agoMerge pull request #29 from rmfought/natdir32
Thomas Graf [Thu, 24 Jan 2013 16:32:35 +0000 (08:32 -0800)]
Merge pull request #29 from rmfought/natdir32

netfilter: expectation NAT direction is 32 bit attribute

11 years agonetfilter: keep 8-bit API for 32-bit NAT dir attribute
Rich Fought [Thu, 24 Jan 2013 16:18:35 +0000 (08:18 -0800)]
netfilter: keep 8-bit API for 32-bit NAT dir attribute

11 years ago3.2.21 release libnl3_2_21
Thomas Graf [Thu, 24 Jan 2013 14:00:26 +0000 (15:00 +0100)]
3.2.21 release

11 years agoProvide better help text when bumping CURRENT,AGE,REVISION
Thomas Graf [Thu, 24 Jan 2013 13:34:22 +0000 (14:34 +0100)]
Provide better help text when bumping CURRENT,AGE,REVISION

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoRemove obsolete warning from <netlink/object-api.h> as it breaks NM build
Thomas Graf [Thu, 24 Jan 2013 13:29:18 +0000 (14:29 +0100)]
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>
11 years agoFix build warnings of nl-(qdisc|class|cls)-add
Thomas Graf [Thu, 24 Jan 2013 13:10:33 +0000 (14:10 +0100)]
Fix build warnings of nl-(qdisc|class|cls)-add

Reported-by: Jeroen Roovers <jer@gentoo.org>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoFix test-cache-mngr test
Thomas Graf [Thu, 24 Jan 2013 13:05:48 +0000 (14:05 +0100)]
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>
11 years agoProvide compat headers for removed private API
Thomas Graf [Thu, 24 Jan 2013 13:03:52 +0000 (14:03 +0100)]
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>
11 years agoMove private header files to <netlink-private/*>
Thomas Graf [Thu, 24 Jan 2013 12:51:24 +0000 (13:51 +0100)]
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>
11 years agonetfilter: expectation NAT direction is 32 bit attribute
Rich Fought [Wed, 23 Jan 2013 21:59:27 +0000 (13:59 -0800)]
netfilter: expectation NAT direction is 32 bit attribute

11 years agofix includes after removing some headers
Jiri Pirko [Wed, 23 Jan 2013 12:17:43 +0000 (13:17 +0100)]
fix includes after removing some headers

commit f20bbe1f07fcff1509425884f5ed72ca8d5fb6ab
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>
11 years ago3.2.20 release libnl3_2_20
Thomas Graf [Tue, 22 Jan 2013 18:30:16 +0000 (19:30 +0100)]
3.2.20 release

11 years agoroute cache: This patch adds route priority to route object oo_id_attrs
roopa [Thu, 17 Jan 2013 14:48:59 +0000 (06:48 -0800)]
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>
11 years agoRemove obsolete release notes at end of configure
Thomas Graf [Tue, 22 Jan 2013 18:15:34 +0000 (19:15 +0100)]
Remove obsolete release notes at end of configure

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agoNo longer install module API headers
Thomas Graf [Tue, 22 Jan 2013 18:10:38 +0000 (19:10 +0100)]
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>
11 years agoUndo soname bump
Thomas Graf [Tue, 22 Jan 2013 18:07:09 +0000 (19:07 +0100)]
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>
11 years agolink: fix reference leak in rtnl_link_af_data_compare()
Thomas Graf [Fri, 18 Jan 2013 13:49:08 +0000 (14:49 +0100)]
link: fix reference leak in rtnl_link_af_data_compare()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agolink: Add af data compare to link objects
roopa [Fri, 18 Jan 2013 00:29:04 +0000 (16:29 -0800)]
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>
11 years agoAdd new rtnl_link_af_data_compare function to compare af_data
roopa [Fri, 18 Jan 2013 00:29:03 +0000 (16:29 -0800)]
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>
11 years ago3.2.19 release libnl3_2_19
Thomas Graf [Thu, 17 Jan 2013 13:02:35 +0000 (14:02 +0100)]
3.2.19 release

11 years agoAdd ao_compare support to bridge family af_data
roopa [Tue, 8 Jan 2013 13:29:10 +0000 (05:29 -0800)]
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>
11 years agolink af ops: Add new ao_compare op to compare link af_data
roopa [Tue, 8 Jan 2013 13:29:08 +0000 (05:29 -0800)]
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>
11 years agocache: Add new nl_cache_find api
roopa [Tue, 8 Jan 2013 12:33:29 +0000 (04:33 -0800)]
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>
11 years agolink: add carrier support
Flavio Leitner [Mon, 7 Jan 2013 20:36:12 +0000 (18:36 -0200)]
link: add carrier support

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years ago3.2.18 release libnl3_2_18
Thomas Graf [Tue, 8 Jan 2013 13:47:03 +0000 (14:47 +0100)]
3.2.18 release

11 years agofix include/Makefile.am
Thomas Graf [Tue, 8 Jan 2013 13:44:47 +0000 (14:44 +0100)]
fix include/Makefile.am

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years agobuild: Fix distribution to include 'nfnetlink_conntrack.h'
Otavio Salvador [Mon, 7 Jan 2013 19:10:00 +0000 (17:10 -0200)]
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>
11 years agocache: make sure the user has specified a callback
mihai.dontu@gmail.com [Sun, 6 Jan 2013 05:07:02 +0000 (07:07 +0200)]
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>
11 years agoAdd <netlink/route/link/can.h> to dist target
Thomas Graf [Fri, 4 Jan 2013 16:44:43 +0000 (17:44 +0100)]
Add <netlink/route/link/can.h> to dist target

Signed-off-by: Thomas Graf <tgraf@suug.ch>
11 years ago3.2.17 release libnl3_2_17
Thomas Graf [Fri, 4 Jan 2013 15:44:52 +0000 (16:44 +0100)]
3.2.17 release

11 years agonlmsg_ok comparison between signed and unsigned
Eric Paris [Thu, 3 Jan 2013 19:26:00 +0000 (14:26 -0500)]
nlmsg_ok comparison between signed and unsigned

The nlmsg_ok macro has a comparison between an int and a size_t
(unsigned int).  The C spec says the int is cast to unsigned int before
the comparison.  This is a problem as the audit system will send skb's
with skb->len == nlhhdr->nlmsg_len which are NOT aligned.  Thus you can
end up with remaining being negative.  So the comparison becomes

(unsigned int)(-1) >= (unsigned int)16

Which turns out to be true!  It should clearly be false.  So if we cast
the size_t to an int we get a signed comparison and it works.  (This is
what linux/netlink.h and all of the kernel netlink headers do)

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoFix file descriptor leak on error
Thomas Jarosch [Thu, 27 Dec 2012 09:44:30 +0000 (10:44 +0100)]
Fix file descriptor leak on error

Detected by cppcheck

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Take cache_ops lock when modifying cache ops flags
Thomas Graf [Tue, 18 Dec 2012 13:56:26 +0000 (14:56 +0100)]
cache: Take cache_ops lock when modifying cache ops flags

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache pickup: Avoid duplicates during cache pickup
roopa [Fri, 21 Dec 2012 02:32:00 +0000 (18:32 -0800)]
cache pickup: Avoid duplicates during cache pickup

This patch adds search and replace/update functionality
to cache pickup_cb. This change is required to avoid
duplicates getting into the cache during pickup. Also
helps updating existing objects during cache pickup.
We have seen this in cases of ipv6 equal cost multipath
routes

changes v1 to v2:
- Updated documentation

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
12 years agomake: automake provides a cscope target these days
Thomas Graf [Sun, 2 Dec 2012 18:16:49 +0000 (19:16 +0100)]
make: automake provides a cscope target these days

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoBug Fix: cache_include: Fix object ref release after successful object update
roopa [Thu, 13 Dec 2012 05:48:30 +0000 (21:48 -0800)]
Bug Fix: cache_include: Fix object ref release after successful object update

The current code does a rtnl_link_put on new object instead of
old object. This patch fixes it. None of the caches have support
for object update, so this should not have affected anyone yet.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
12 years agoroute cache: Fix handling of ipv6 multipath routes
roopa [Thu, 13 Dec 2012 05:50:49 +0000 (21:50 -0800)]
route cache: Fix handling of ipv6 multipath routes

There are two ways kernel handles ipv6 equal cost multipath routes
depending on which kernel version you are looking at.

older kernels without ipv6 ECMP support, accept the below ECMP routes,
#ip -6 route add 2001::/16 nexthop via fe80:2::2 dev swp1
#ip -6 route add 2001::/16 nexthop via fe80:2::3 dev swp1

store them as separate routes and pick the last one during lookup.

Newer kernels, after the support for equal cost multipath routes
was added http://patchwork.ozlabs.org/patch/188562/,
now accept multipath routes added individually using the
above 'ip -6 route' format OR
sent using RTA_MULTIPATH with the below command
#ip -6 route add 2001::/16 nexthop via fe80:2::2 dev swp1 nexthop via fe80:2::3 dev swp1

And the kernel now stores and treats them as equal cost multipath routes
during lookups.

However in all cases above, netlink notifications to ipv6 ECMP route adds and deletes
come separately for each next hop.

Example libnl notification in the above case with both old and new kernels:
inet6 2001::/16 table main type unicast
                scope global priority 0x400 protocol boot
                nexthop via fe80:2::2 dev swp1

        inet6 2001::/16 table main type unicast
                scope global priority 0x400 protocol boot
                nexthop via fe80:2::3 dev swp1

Since they are separate route notifications for objects with same key,
libnl replaces the existing ones and hence only the last route update sticks.

This patch uses the oo_update feature to not replace but update an
existing route if its a ipv6 equal cost multipath route.
The object after an update looks like the below (similar to ipv4 ECMP routes):

        inet6 2001::/16 table main type unicast
                scope global priority 0x400 protocol boot
                nexthop via fe80:2::2 dev swp1
                nexthop via fe80:2::3 dev swp1

Signed-off-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoMerge branch 'aligned_be64' of https://github.com/rmfought/libnl
Thomas Graf [Mon, 17 Dec 2012 08:18:47 +0000 (09:18 +0100)]
Merge branch 'aligned_be64' of https://github.com/rmfought/libnl

12 years agoIncluded defs.h so DISABLE_PTHREADS is visible.
Rich Fought [Thu, 13 Dec 2012 23:56:04 +0000 (15:56 -0800)]
Included defs.h so DISABLE_PTHREADS is visible.

12 years agoRe-adding #defines for __aligned_be64 for older kernels
Rich Fought [Thu, 13 Dec 2012 22:23:28 +0000 (14:23 -0800)]
Re-adding #defines for __aligned_be64 for older kernels

12 years agonetfilter: update local header files
Thomas Graf [Tue, 11 Dec 2012 17:06:29 +0000 (18:06 +0100)]
netfilter: update local header files

Needed to NF_CT_EXPECT_PERMANENT etc.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocan: provide local copy of <linux/can/netlink.h>
Thomas Graf [Tue, 11 Dec 2012 16:59:30 +0000 (17:59 +0100)]
can: provide local copy of <linux/can/netlink.h>

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoFix make check when using --disable-cli
Gilles Espinasse [Tue, 4 Dec 2012 23:08:00 +0000 (00:08 +0100)]
Fix make check when using --disable-cli

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoFix python detection code
Gilles Espinasse [Tue, 4 Dec 2012 23:08:01 +0000 (00:08 +0100)]
Fix python detection code

Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Compiling libnl versions that include doc or the git tree produce this
checking for python build information...
checking for python2.6... python2.6
checking for main in -lpython2.6... yes
checking python2.6/Python.h usability... yes
checking python2.6/Python.h presence... yes
checking for python2.6/Python.h... yes
./configure: line 4272: test: !=: unary operator expected
checking for python2.5... (cached) python2.6
checking for main in -lpython2.6... (cached) yes
checking for python2.6/Python.h... (cached) yes
./configure: line 4272: test: !=: unary operator expected
checking for python2.4... (cached) python2.6
checking for main in -lpython2.6... (cached) yes
checking for python2.6/Python.h... (cached) yes
./configure: line 4272: test: !=: unary operator expected
checking for python2.3... (cached) python2.6
checking for main in -lpython2.6... (cached) yes
checking for python2.6/Python.h... (cached) yes
./configure: line 4272: test: !=: unary operator expected
checking for python2.2... (cached) python2.6
checking for main in -lpython2.6... (cached) yes
checking for python2.6/Python.h... (cached) yes
./configure: line 4272: test: !=: unary operator expected
checking for python2.1... (cached) python2.6
checking for main in -lpython2.6... (cached) yes
checking for python2.6/Python.h... (cached) yes
./configure: line 4272: test: !=: unary operator expected
checking for python... (cached) python2.6
checking for main in -lpython2.6... (cached) yes
checking for python2.6/Python.h... (cached) yes
./configure: line 4272: test: !=: unary operator expected
  results of the Python check:
    Binary:      python2.6
    Library:     python2.6
    Include Dir: no

Fix the unary operator warning allow to break when one python version is found
Add the more recent python versions
Change send upstream as http://savannah.gnu.org/patch/index.php?7897
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agolink: socket-CAN helper functions
Benedikt Spranger [Thu, 29 Nov 2012 18:48:46 +0000 (19:48 +0100)]
link: socket-CAN helper functions

Add helper functions to make socket-CAN configuration easy.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agolink: basic socket-CAN support
Benedikt Spranger [Thu, 29 Nov 2012 18:48:45 +0000 (19:48 +0100)]
link: basic socket-CAN support

Controller Area Network (CAN) is a networking technology which has
widespread use in automation, embedded devices and automotive fields.
The socket-CAN package is an implementation of CAN protocols for Linux.

All socket-CAN related configurations are carried out through Netlink.
Add basic socket-CAN support to libnl to be able to configure CAN devices
with libnl.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agobuild: resolve lex failure
Jan Engelhardt [Mon, 26 Nov 2012 23:01:53 +0000 (00:01 +0100)]
build: resolve lex failure

This is an addendum to 0a9d5fcfa4c3fe8c930103f7639723dfd1ae4889,
which forgot to change ${LEX} to ${FLEX} in lib/Makefile.am.

On openSUSE, /usr/bin/lex is a wrapper that calls `flex -l ...`.
libnl however requires flex, not lex or a compat mode thereof,
so using ${FLEX} is the proper thing to do.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agoMerge branch 'master' of git://git.inai.de/libnl
Thomas Graf [Mon, 26 Nov 2012 22:34:37 +0000 (23:34 +0100)]
Merge branch 'master' of git://git.inai.de/libnl

12 years agobuild: use foreign mode
Jan Engelhardt [Mon, 26 Nov 2012 19:54:04 +0000 (20:54 +0100)]
build: use foreign mode

This is the magic trick to get rid of files like NEWS, INSTALL,
etc. that are unused in some projects, like libnl.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agobuild: use AC_CONFIG_AUX_DIR
Jan Engelhardt [Mon, 26 Nov 2012 19:51:51 +0000 (20:51 +0100)]
build: use AC_CONFIG_AUX_DIR

Stash all those scripts into a separate directory and ignore that.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agobuild: resolve automake-1.12 warnings
Jan Engelhardt [Mon, 26 Nov 2012 19:49:02 +0000 (20:49 +0100)]
build: resolve automake-1.12 warnings

/usr/share/automake-1.12/am/ltlibrary.am: warning: 'libnl-cli-3.la':
linking libtool libraries using a non-POSIX archiver requires
'AM_PROG_AR' in 'configure.ac'
(one for each .la file)

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years agobuild: rename configure.in -> .ac
Jan Engelhardt [Mon, 26 Nov 2012 19:48:13 +0000 (20:48 +0100)]
build: rename configure.in -> .ac

"configure.in" is a very, very old, obsolete name. Newer automake
will reject it, so rename it now.

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
12 years ago3.2.16 release libnl3_2_16
Thomas Graf [Mon, 26 Nov 2012 16:43:12 +0000 (17:43 +0100)]
3.2.16 release

12 years agocache: only continue iterating over co_groups if it is available
Thomas Graf [Mon, 26 Nov 2012 10:50:56 +0000 (11:50 +0100)]
cache: only continue iterating over co_groups if it is available

A co_groups == NULL must enter the loop to trigger the initial
fill of the cache but may never bump the grp pointer as doing
so prevents the loop from being escaped correctly.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years ago3.2.15 release libnl3_2_15
Thomas Graf [Fri, 23 Nov 2012 16:05:52 +0000 (17:05 +0100)]
3.2.15 release

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoInclude the newly added header files in next release
Thomas Graf [Fri, 23 Nov 2012 16:05:05 +0000 (17:05 +0100)]
Include the newly added header files in next release

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: reserve room in cache_ops to avoid breaking module ABI too frequently
Thomas Graf [Fri, 23 Nov 2012 15:50:06 +0000 (16:50 +0100)]
cache: reserve room in cache_ops to avoid breaking module ABI too frequently

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoconfigure: Replace broken AM_PROG_LEX with AC_CHECK_PROGS
Thomas Graf [Fri, 23 Nov 2012 15:40:14 +0000 (16:40 +0100)]
configure: Replace broken AM_PROG_LEX with AC_CHECK_PROGS

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoUpdated configure.in to make sure bison and lex are installed.
Richard Marshall [Tue, 20 Nov 2012 04:20:22 +0000 (20:20 -0800)]
Updated configure.in to make sure bison and lex are installed.

Fixes issue #7

12 years agoBug Fix: Add new fill socket to cache manager
roopa [Mon, 19 Nov 2012 06:14:23 +0000 (22:14 -0800)]
Bug Fix: Add new fill socket to cache manager

This patch adds a new socket to cache manager to request fill's on.
cache manager today uses cm_sock to request dump from
the kernel. It also listens to netlink async events on the same sock.
The problem with this is that when libnl is waiting to process the
response to get dump request sent to the kernel during fill,
it may receive an async event, resulting in libnl complaining about
unexpected msg

This is usually reproducible when there is heavy netlink async event
traffic during nl_cache_mngr_add.

This patch adds a new cm_sync_sock to use for fill during cache manager
add cache.

The other option is to provide an api to set the cm_sync_sock. But since
this is a bug fix its probably better to fix the cache manager add api
like this patch does. Please suggest otherwise.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Nolan Leake <nolan@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: provide safe variant of nl_cache_mngt_require() and use it
Thomas Graf [Fri, 16 Nov 2012 00:11:55 +0000 (01:11 +0100)]
cache: provide safe variant of nl_cache_mngt_require() and use it

This makes runtime removal of cache operations possible if non-safe
API is not in use by application. The non-safe API will be removed
in the next major version.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoUse NL_DBG() instead of printing warnings and errors to stderr
Thomas Graf [Thu, 15 Nov 2012 23:42:34 +0000 (00:42 +0100)]
Use NL_DBG() instead of printing warnings and errors to stderr

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: hold a reference to the cache ops while a cache is provided over it
Thomas Graf [Thu, 15 Nov 2012 23:27:51 +0000 (00:27 +0100)]
cache: hold a reference to the cache ops while a cache is provided over it

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agouse safe cache lookup variants internally
Thomas Graf [Thu, 15 Nov 2012 23:20:18 +0000 (00:20 +0100)]
use safe cache lookup variants internally

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Provide safe versions of nl_cache_ops_associate() and nl_cache_ops_lookup()
Thomas Graf [Thu, 15 Nov 2012 23:19:38 +0000 (00:19 +0100)]
cache: Provide safe versions of nl_cache_ops_associate() and nl_cache_ops_lookup()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Add reference counter to cache operations
Thomas Graf [Thu, 15 Nov 2012 22:48:03 +0000 (23:48 +0100)]
cache: Add reference counter to cache operations

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agolink: Protect registration of af and link ops with rwlock
Thomas Graf [Thu, 15 Nov 2012 21:33:23 +0000 (22:33 +0100)]
link: Protect registration of af and link ops with rwlock

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: rwlock accesses to cache operations
Thomas Graf [Thu, 15 Nov 2012 20:42:02 +0000 (21:42 +0100)]
cache: rwlock accesses to cache operations

Puts an rwlock around 'cache_ops'.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agolock abstraction layer
Thomas Graf [Thu, 15 Nov 2012 20:30:57 +0000 (21:30 +0100)]
lock abstraction layer

Hide pthread availability and enablement behind internal API

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Hold cache reference while a cache is being provided
Thomas Graf [Thu, 15 Nov 2012 19:49:33 +0000 (20:49 +0100)]
cache: Hold cache reference while a cache is being provided

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Add reference counter to caches
Thomas Graf [Thu, 15 Nov 2012 19:45:44 +0000 (20:45 +0100)]
cache: Add reference counter to caches

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoAdd master support to rtnl_neigh for AF_BRIDGE objects
roopa [Wed, 14 Nov 2012 19:33:51 +0000 (11:33 -0800)]
Add master support to rtnl_neigh for AF_BRIDGE objects

AF_BRIDGE neigh objects can be uniquely identified by
the family, lladdr and bridge ifindex. This patch adds
bridge ifindex to AF_BRIDGE neigh objects.

Things will be ok even without this patch with just family and
lladdr if we assume that we will have unique lladdr's
accross bridges in a system.

Kernel does not send the bridge ifindex in the AF_BRIDGE
fdb/neigh message. This patch tries to get that info by a
link cache lookup and adds it to the bridge neigh object

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>
12 years agoAdd AF_BRIDGE support to neigh cache
roopa [Wed, 14 Nov 2012 19:33:50 +0000 (11:33 -0800)]
Add AF_BRIDGE support to neigh cache

This patch adds AF_BRIDGE to the list of families
supported by the cache. Implements oo_id_attrs_get to
declare separate id attributes for AF_UNSPEC and AF_BRIDGE
neigh objects

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>
12 years agoAdd AF_BRIDGE support to link cache
roopa [Wed, 14 Nov 2012 14:06:41 +0000 (06:06 -0800)]
Add AF_BRIDGE support to link cache

This patch was previously submitted as the first approach in
RFC http://lists.infradead.org/pipermail/libnl/2012-November/000730.html

It adds support for AF_BRIDGE family in link cache.
And the key for link object lookups will now be ifindex and family.

This allows for AF_UNSPEC rtnl link objects to co-exist with the AF_BRIDGE
link objects in the same cache.

I have changed some of the rtnl_link api's to explicitly check for
AF_UNSPEC to not break existing apps. I will submit a new patch to
introduce equivalent rtnl_bridge_link_* api's.

We had also discussed updating the existing link objects with
AF_BRIDGE attributes, but realized that the updates to link objects will
be both AF_UNSPEC and AF_BRIDGE. And that would change link cache to always
update existing objects, resulting in comparing and updating close to
thirty attributes at cache_include time which seems like a overkill.

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>
12 years agoaddr: Support setting local/peer/anycast/multicast/broadcast address to NULL
Thomas Graf [Mon, 12 Nov 2012 22:48:02 +0000 (23:48 +0100)]
addr: Support setting local/peer/anycast/multicast/broadcast address to NULL

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Move nl_cache_ops_set_flags() to cache_mngt.c
Thomas Graf [Mon, 12 Nov 2012 21:07:39 +0000 (22:07 +0100)]
cache: Move nl_cache_ops_set_flags() to cache_mngt.c

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Fix typo in API doc of nl_cache_set_flags()
Thomas Graf [Mon, 12 Nov 2012 21:03:22 +0000 (22:03 +0100)]
cache: Fix typo in API doc of nl_cache_set_flags()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agocache: Move NL_CACHE_AF_ITER to <netlink/cache.h>
Thomas Graf [Mon, 12 Nov 2012 20:59:54 +0000 (21:59 +0100)]
cache: Move NL_CACHE_AF_ITER to <netlink/cache.h>

<netlink/cache-api.h> alreay requires <netlink/cache.h> anyway.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoAdd NL_CACHE_AF_ITER support during refill and resync
roopa [Mon, 12 Nov 2012 20:38:33 +0000 (12:38 -0800)]
Add NL_CACHE_AF_ITER support during refill and resync

This patch adds support to iter over all supported families
during cache fill and resync.

The motivation for this was previously introduced at
http://lists.infradead.org/pipermail/libnl/2012-November/000734.html
In short, this patch allows caches to request dump on all supported
families instead of only AF_UNSPEC as done today.

With feedback from thomas this patch makes the iter over all families
conditional on per cache flag NL_CACHE_AF_ITER

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoNew cache manager add cache api
roopa [Mon, 12 Nov 2012 20:38:32 +0000 (12:38 -0800)]
New cache manager add cache api

This patch is an attempt to add a new nl_cache_mngr_add_cache api
to allow adding an existing cache to cache manager.

Since the new api is similar to nl_cache_mngr_add
except for allocating the cache, the patch moves most of the
nl_cache_mngr_add code to nl_cache_mngr_add_cache and changes
nl_cache_mngr_add to call nl_cache_mngr_add_cache.

One use case for this api as pointed out by thomas would be to set cache
flags before associating the cache with a cache manager.

nl_cache_alloc_name("route/link", &cache);
nl_cache_set_flags(cache, NL_CACHE_AF_ITER);
nl_cache_mngr_add_cache(mngr, cache, ...);

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoAdd support for per cache flags
roopa [Mon, 12 Nov 2012 20:38:31 +0000 (12:38 -0800)]
Add support for per cache flags

This patch adds support for per cache flags
and adds a flag NL_CACHE_AF_ITER to iter over all
supported families when filling the cache.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agodoc: Revert to default stylesheet
Thomas Graf [Mon, 12 Nov 2012 09:26:38 +0000 (10:26 +0100)]
doc: Revert to default stylesheet

Use of a custom stylesheet breaks with almost every release of doxygen
and is thus completely unuseable.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoaddr: rtnl_addr_set_peer() is limited to IPv4
Thomas Graf [Sun, 11 Nov 2012 20:01:19 +0000 (21:01 +0100)]
addr: rtnl_addr_set_peer() is limited to IPv4

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoaddr: Return -NLE_AF_NOSUPPORT when trying to set unsupported attributes
Thomas Graf [Sun, 11 Nov 2012 15:36:29 +0000 (16:36 +0100)]
addr: Return -NLE_AF_NOSUPPORT when trying to set unsupported attributes

- multicast and anycast address only supported with IPv6
- brodcast address only supported with IPv4

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agodoc: update Doxygen layout file to latest format
Thomas Graf [Sun, 11 Nov 2012 10:21:34 +0000 (11:21 +0100)]
doc: update Doxygen layout file to latest format

Sigend-off-by: Thomas Graf <tgraf@suug.ch>
12 years agohashtable: remove doc section crashing doxygen
Thomas Graf [Sun, 11 Nov 2012 10:21:10 +0000 (11:21 +0100)]
hashtable: remove doc section crashing doxygen

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agohashtable: Fix reference leak in nl_hashtable_free()
Thomas Graf [Sat, 10 Nov 2012 09:52:26 +0000 (10:52 +0100)]
hashtable: Fix reference leak in nl_hashtable_free()

The reference counter of the linked object must be dec'ed
before freeing the node or the reference is leaked.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agohashtable: Add API reference documentation
Thomas Graf [Sat, 10 Nov 2012 09:50:16 +0000 (10:50 +0100)]
hashtable: Add API reference documentation

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoHash: Properly prefix hash functions
Thomas Graf [Sat, 10 Nov 2012 09:20:08 +0000 (10:20 +0100)]
Hash: Properly prefix hash functions

Do not pollute public namespace with unprefixed functions.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoAdd hash support to route cache
roopa [Fri, 9 Nov 2012 22:41:36 +0000 (14:41 -0800)]
Add hash support to route cache

This patch adds keygen function to route object

Signed-off-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: Nolan Leake <nolan@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoAdd hash support to neigh cache
roopa [Fri, 9 Nov 2012 22:41:35 +0000 (14:41 -0800)]
Add hash support to neigh cache

This patch adds keygen function to the neigh object

Signed-off-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
Signed-off-by: Nolan Leake <nolan@cumulusnetworks.com>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Reviewed-by: Wilson Kok <wkok@cumulusnetworks.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>