]> granicus.if.org Git - libnl/log
libnl
12 years agoRun-time version information is now available
Коренберг Марк (дома) [Wed, 29 Aug 2012 16:55:14 +0000 (22:55 +0600)]
Run-time version information is now available

Run-time version information is available as exported four integers:
- const int      nl_ver_num = LIBNL_VER_NUM;
- const int      nl_ver_maj = LIBNL_VER_MAJ;
- const int      nl_ver_min = LIBNL_VER_MIN;
- const int      nl_ver_mic = LIBNL_VER_MIC;

The purpose of this is to get version of compiled library as run time.
Use cases:
- To know exact version of the library in Python's ctypes module,
  Say, to find out if nl_cache_mngr_alloc() allow sk=NULL

- To make sure that the version of the loaded library corresponds to the
  version of headers (for the paranoid). Say, to check:

  if (LIBNL_VER_NUM != nl_ver_num)
      exit(1);

12 years agoAdded lex.yy.c to .gitignore
Коренберг Марк (дома) [Wed, 29 Aug 2012 16:38:46 +0000 (22:38 +0600)]
Added lex.yy.c to .gitignore

12 years agosingle nexthop flags bug
Justin Mayfield [Fri, 17 Aug 2012 01:03:48 +0000 (19:03 -0600)]
single nexthop flags bug

I ran into a bug today related to how Linux handles a route's nexthop
flags when there is just one nexthop.  Namely Linux expects the flags
to be OR'd into the rtm_flags field when there is only one nexthop and
so rtnl_route_build_msg needs to check the number of nexthops and
store the nexthops flags into this field prior to calling
nlmsg_append(...&rtmsg).

Conversely the rtnl_route_parse function needs to pull these lower
0xff bits when a single nexthop is detected.

Attached is my patch.  I don't like the slight duplication of doing
the rtnl_route_get_nnexthops check twice but it seemed to be the least
turmoil of any solution I thought of.

12 years agonl_addr_parse handling of 'default', 'any', and 'all'
Justin Mayfield [Sat, 18 Aug 2012 00:16:44 +0000 (18:16 -0600)]
nl_addr_parse handling of 'default', 'any', and 'all'

I found a small bug in the nl_addr_parse function when being passed the
strings "default", "any", or "all".  Currently nl_addr_parse will create
a zeroed nl_addr with a length corresponding to the family/hint or
AF_INET if omitted.  This behavior when used in conjunction with the
libnl-route library to add default routes to the system has the side
effect of creating a route to the host address 0.0.0.0/32.

Attached is a patch that matches the iproute2 behavior more closely
where we do set the family but the length of the nl_addr is set to 0.

12 years agoroute_clone : fix segmentation fault using nl_cache_subset to filter routes
Loïc Touraine [Wed, 29 Aug 2012 10:14:01 +0000 (12:14 +0200)]
route_clone : fix segmentation fault using nl_cache_subset to filter routes

reset the nb nhops to 0 (dst->rt_nr_nh = 0) before setting the dst->nhops
from the src->nhops

12 years agoFix build warning after const char ** convert
Thomas Graf [Wed, 29 Aug 2012 10:05:51 +0000 (12:05 +0200)]
Fix build warning after const char ** convert

Commit 25d640da4a caused the following build warning:
../include/netlink/utils.h:47:15: note: expected 'const char **' but argument is of type 'char **'
route/link/inet6.c:300:11: warning: passing argument 2 of 'nl_cancel_down_bytes' from incompatible pointer type [enabled by default]

Revert the const char ** change.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoFix the always false if (a->rt_nr_nh != a->rt_nr_nh) test
Michele Baldessari [Tue, 28 Aug 2012 18:28:28 +0000 (20:28 +0200)]
Fix the always false if (a->rt_nr_nh != a->rt_nr_nh) test

Fix the always false if (a->rt_nr_nh != a->rt_nr_nh) test and compare
properly the a and b structs

12 years agolib/utils.c: One kilobit now is a 1000bits (instead of 1024)
Коренберг Марк [Tue, 28 Aug 2012 12:39:14 +0000 (18:39 +0600)]
lib/utils.c: One kilobit now is a 1000bits (instead of 1024)

http://en.wikipedia.org/wiki/Kilobit

Also, convert "char*" to "const char*" in output value,
as returned values can not be modified.

12 years agoct_dump_stats: detect when stats are not available
Коренберг Марк (дома) [Mon, 27 Aug 2012 17:39:29 +0000 (23:39 +0600)]
ct_dump_stats: detect when stats are not available

Since about 2.6.27 kernel, stats are not enabled by default.
Stats can be enabled using sysctl named

net.netfilter.nf_conntrack_acct

So, do not print zeroes in stats if it's not available.
When not checked, trash may appear in output

12 years agonl_cli_route_parse_table fixed typo in code
Коренберг Марк (дома) [Mon, 27 Aug 2012 17:14:07 +0000 (23:14 +0600)]
nl_cli_route_parse_table fixed typo in code

Bug introduced in 2bdcde7e8e8bb78b165f093f1a708134f417e557

12 years agotbf: fix false missing attr
Stephane Fillod [Wed, 1 Aug 2012 20:29:47 +0000 (22:29 +0200)]
tbf: fix false missing attr

Fix false missing attribute in tbf_msg_fill() when applying a tbf qdisc.

12 years agolibnl 3.2.11 libnl3_2_11
Thomas Graf [Wed, 13 Jun 2012 11:49:52 +0000 (13:49 +0200)]
libnl 3.2.11

12 years agoFix types-related warnings based on clang diagnostics
Коренберг Марк [Fri, 8 Jun 2012 14:15:06 +0000 (20:15 +0600)]
Fix types-related warnings based on clang diagnostics

1. Fix some places where unsigned value compared < 0
2. Fix obsolete %Z specifier to more portable %z
3. Some erroneous types substitution
4. nl_msec2str() - 64-bit msec is now properly used,

Only safe changes. I mean int <--> uint32_t and signed/unsigned fixes.
Some functinos require size_t argument instead of int, but changes of
signatures of that functions is terrible thing.

Also, I do not pretend for a full list of fixes.
Just to shut up clang -Wall -Wextra

One more thing. ifindex. I don't change that because changes will
be too big for simple fix.

12 years agolink: rtnl_link_get_kernel() should only wait for ACK if AUTO-ACK is on
Thomas Graf [Wed, 13 Jun 2012 11:24:19 +0000 (13:24 +0200)]
link: rtnl_link_get_kernel() should only wait for ACK if AUTO-ACK is on

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agogenl: cleanup genl_ctrl_resolve()
Thomas Graf [Wed, 13 Jun 2012 11:23:04 +0000 (13:23 +0200)]
genl: cleanup genl_ctrl_resolve()

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agogenl: Wait for ACK after successful ctrl reply
Thomas Graf [Wed, 13 Jun 2012 11:04:03 +0000 (13:04 +0200)]
genl: Wait for ACK after successful ctrl reply

Signed-off-by: Thomas Graf <tgraf@suug.ch>
12 years agoCorrect missing fwmark mask proto.
Andrew Collins [Mon, 11 Jun 2012 16:44:43 +0000 (10:44 -0600)]
Correct missing fwmark mask proto.

In my previous patch for adding fwmark mask support, I neglected
to add a prototype for it.  This change corrects my oversight.

12 years agoAdd 'ingress' to the list of recognized TC handles.
Andrew Collins [Mon, 11 Jun 2012 16:44:42 +0000 (10:44 -0600)]
Add 'ingress' to the list of recognized TC handles.

Currently, rtnl_tc_handle2str understands the ingress handle but
rtnl_tc_str2handle does not.  This change lets rtnl_tc_str2handle
recognize 'ingress' as a valid handle as well.

12 years agoFixed memory leak in Cache destructor
Коренберг Марк [Fri, 8 Jun 2012 07:19:27 +0000 (13:19 +0600)]
Fixed memory leak in Cache destructor

destructor of Cache was missing due to typo

12 years agortnl_link_(get|set)_weight is deprecated in libnl.
Коренберг Марк (ноутбук дома) [Thu, 7 Jun 2012 20:59:03 +0000 (02:59 +0600)]
rtnl_link_(get|set)_weight is deprecated in libnl.

So, remove from python binding. Should not break compatibility.

12 years agonetlink.nlattr re-implemented in more pythonic way
Коренберг Марк [Thu, 7 Jun 2012 07:48:06 +0000 (13:48 +0600)]
netlink.nlattr re-implemented in more pythonic way

12 years agonl_pickup removed from python binding
Коренберг Марк [Thu, 7 Jun 2012 09:15:50 +0000 (15:15 +0600)]
nl_pickup removed from python binding

12 years agoRemove unnecessary comments
Коренберг Марк (ноутбук дома) [Tue, 5 Jun 2012 19:56:58 +0000 (01:56 +0600)]
Remove unnecessary comments

12 years agoRefine some places
Коренберг Марк (ноутбук дома) [Tue, 5 Jun 2012 17:02:10 +0000 (23:02 +0600)]
Refine some places

No real logick change

12 years agopylint's first review and trivial fixes
Коренберг Марк (ноутбук дома) [Tue, 5 Jun 2012 19:36:05 +0000 (01:36 +0600)]
pylint's first review and trivial fixes

12 years agoUsing only single quotes now and multi-line lists
Коренберг Марк (ноутбук дома) [Tue, 5 Jun 2012 17:01:39 +0000 (23:01 +0600)]
Using only single quotes now and multi-line lists

Nothing algorithmic changed really, just cosmetics

12 years agoFix indentation (spaces vs tabs)
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 19:08:27 +0000 (01:08 +0600)]
Fix indentation (spaces vs tabs)

Now, python files use pseudo-tab equal 4 spaces

12 years agoCode cleanups
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 17:20:24 +0000 (23:20 +0600)]
Code cleanups

1. unused "import struct" removed
2. AddressFamily.__len__ is defined, but why in so way? removed.
3. comparison against instancemethod type fixed

12 years agoFlags properties description and implementation fixed
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 17:39:30 +0000 (23:39 +0600)]
Flags properties description and implementation fixed

1. Address, Link and Vlan classes affected with same bug
2. Flags property are not designed as set class. Setting to property will
   not replace flags, just add flags to set. So, jist document that, and
   fixed obvious logick.

12 years agoFixed various str-related logick
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 17:12:26 +0000 (23:12 +0600)]
Fixed various str-related logick

12 years agoFix whitespaces at EOL
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 16:55:49 +0000 (22:55 +0600)]
Fix whitespaces at EOL

Make git happy with that

12 years agoIntroduce Python's absolute_imports
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 16:54:16 +0000 (22:54 +0600)]
Introduce Python's absolute_imports

Helps greatly when porting to Python 3

12 years agoFix typo in still unused function that generate colored message
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 16:52:02 +0000 (22:52 +0600)]
Fix typo in still unused function that generate colored message

12 years agoMake syntax highlighters happy
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 16:50:36 +0000 (22:50 +0600)]
Make syntax highlighters happy

Fix typo in docstring

12 years agoRemoved generated .pyc files from repository
Коренберг Марк [Fri, 8 Jun 2012 05:52:50 +0000 (11:52 +0600)]
Removed generated .pyc files from repository

12 years agoFixed address deletion
Коренберг Марк (ноутбук дома) [Mon, 4 Jun 2012 16:49:04 +0000 (22:49 +0600)]
Fixed address deletion

1. rtnl_addr_delete require three arguments
2. comment fixed (fixed copy-past from link.py)

12 years agonetem: Use ARRAY_SIZE()
Thomas Graf [Fri, 8 Jun 2012 13:21:51 +0000 (15:21 +0200)]
netem: Use ARRAY_SIZE()

12 years agortnl_netem_set_delay_distribution: fix possible segfault
Коренберг Марк (ноутбук дома) [Thu, 7 Jun 2012 18:58:14 +0000 (00:58 +0600)]
rtnl_netem_set_delay_distribution: fix possible segfault

fix counting of elements in array. Just typo, as I think.

12 years agoFix compilation with clang
Коренберг Марк (ноутбук дома) [Thu, 7 Jun 2012 17:48:28 +0000 (23:48 +0600)]
Fix compilation with clang

classid_exit unnecessarily used gcc-only closure.
conversion to simple static function works OK.

12 years agolibnl 3.2.10 libnl3_2_10
Thomas Graf [Wed, 6 Jun 2012 09:43:53 +0000 (11:43 +0200)]
libnl 3.2.10

12 years agogenl: modify genl_ctrl_resolve and friends to allow for module auto-loading
Neil Horman [Fri, 1 Jun 2012 16:59:24 +0000 (12:59 -0400)]
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>
12 years agogenl: Update genl-ctrl-list(8)
Thomas Graf [Fri, 1 Jun 2012 11:10:03 +0000 (13:10 +0200)]
genl: Update genl-ctrl-list(8)

12 years agogenl: Export genl_ops_resolve() and genl_mngt_resolve() in header
Thomas Graf [Fri, 1 Jun 2012 09:51:43 +0000 (11:51 +0200)]
genl: Export genl_ops_resolve() and genl_mngt_resolve() in header

These have been public but have not been declared in a header yet.

12 years agogenl: Support registration of families without depending on caches
Thomas Graf [Fri, 1 Jun 2012 09:48:08 +0000 (11:48 +0200)]
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.

12 years agogenl: Add genlmsg_user_hdr(), genlmsg_user_data(), and genlmsg_user_datalen()
Thomas Graf [Thu, 31 May 2012 11:37:57 +0000 (13:37 +0200)]
genl: Add genlmsg_user_hdr(), genlmsg_user_data(), and genlmsg_user_datalen()

These functions deprecate the function genlmsg_data() which did not
allow to specify the length of the user header. Use of the new API
will make code much clearer. The old function is still kept around
for backwards compatibility but marked deprecated in the API reference.

12 years agogenl: Add genlmsg_hdr()
Thomas Graf [Thu, 31 May 2012 11:13:50 +0000 (13:13 +0200)]
genl: Add genlmsg_hdr()

Explicit function to calculate the genl hdr based on nlh

12 years agogenl: updates to API reference documentation
Thomas Graf [Thu, 31 May 2012 11:11:48 +0000 (13:11 +0200)]
genl: updates to API reference documentation

12 years agouse MSG_TRUNC flag to get recv message size at once
Jiri Pirko [Mon, 28 May 2012 12:05:27 +0000 (14:05 +0200)]
use MSG_TRUNC flag to get recv message size at once

prevent multiple calls of recvmsg.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
12 years agocorrect HTB rtable/HZ calculations
Andrew Collins [Sat, 26 May 2012 00:08:06 +0000 (18:08 -0600)]
correct HTB rtable/HZ calculations

The HTB implementation in libnl uses units of microseconds in a number
of places where it seems TC is expecting time in units of ticks, which
causes actual rates much higher than requested.  Additionally, libnl
uses USER_HZ for calculating buffer and cbuffer sizes, which can
result in much larger buffers than necessary on systems with high
resolution timers.

Note that the TBF qdisc uses microseconds incorrectly in two spots as
well, I fixed this but did not test.

12 years agoadd fwmark mask support
A C [Fri, 25 May 2012 19:45:45 +0000 (13:45 -0600)]
add fwmark mask support

The fw classifier allows a mask to be set, which is necessary for some
complex shaping/firewall scenarios.  The attached patch adds support
for it to libnl.

12 years agoFix for dumping objects to a buffer instead of file descriptor
Bushman, Jeff [Wed, 16 May 2012 15:50:25 +0000 (11:50 -0400)]
Fix for dumping objects to a buffer instead of file descriptor

Attached is a patch to fix two problems with dumping objects to a buffer in=
stead of a file descriptor.
One was a problem in detecting the end of the buffer in the newline code.
The other was a problem with clearing the whole buffer before printing each=
 object.

12 years agou32: fix various u32 hashing related warnings
Adrian Ban [Wed, 16 May 2012 11:43:52 +0000 (13:43 +0200)]
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

12 years agotc: fix included headers
Thomas Graf [Wed, 16 May 2012 11:42:05 +0000 (13:42 +0200)]
tc: fix included headers

Reported-by: Adrian Ban <adrian.ban@mantech.ro>
12 years agoFTBFS with musl libc: Missing includes
Isaac [Sun, 13 May 2012 05:37:48 +0000 (22:37 -0700)]
FTBFS with musl libc: Missing includes

Hello,
libnl 3.2.9 does not build with musl libc, without patching.
I' using a current musl libc (http://www.etalabs.net/musl/)
with linux 2.6.32 headers.
At first there were a couple problems on the musl side, but those are
resolved.
However, I found some other issues:
First, two files were missing
#include <byteswap.h>:
lib/netfilter/log_msg.c
lib/netfilter/queue_msg.c
These files used __bswap_64 (which should be bswap_64), a macro
declared in byteswap.h

Second, I got this error after fixing that:

In file included from nf-queue.c:16:
./include/linux/netfilter.h:53: error: field in has incomplete type
./include/linux/netfilter.h:54: error: field in6 has incomplete type

I found that src/nf-queue.c is missing an
#include <netinet/in.h>

Attached is a patch which resolves these issues.  I've tested with both
musl and glibc, and it builds cleanly on both.

12 years agodoc: documentation restructuring
Thomas Graf [Thu, 10 May 2012 10:03:59 +0000 (12:03 +0200)]
doc: documentation restructuring

- changes the modules hierarchy to better represent the set of libaries
- list the header file that needs to be included
- remove examples/doc from api ref that is included in the guide
- add references to the guide
- fix doxygen api linking for version 1.8.0
- readd doxygen mainpage to config file
- fix a couple of doxygen doc bugs

12 years ago__str2flags fix
Justin Mayfield [Thu, 10 May 2012 03:08:30 +0000 (21:08 -0600)]
__str2flags fix

I found a minor bug in __str2flags where empty strings or short strings
will match all or many flags respectively.  Basically the test needs to
ensure the test string is the same length as the table entry before
doing a strncasecmp to avoid doing just a prefix test.

12 years agoroute: Add FIXME to rtnl_route_nh_set_gateway() to fix return value
Thomas Graf [Wed, 9 May 2012 13:03:46 +0000 (15:03 +0200)]
route: Add FIXME to rtnl_route_nh_set_gateway() to fix return value

Reported-by: Justin Mayfield <jmayfield@cradlepoint.com>
12 years agodoc: add section about addressing
Thomas Graf [Wed, 9 May 2012 13:02:40 +0000 (15:02 +0200)]
doc: add section about addressing

Adds a new section to netlink fundamentals explaining the common
addressing use cases and illustrates kernel->user, user->user,
and user->kernel communication.

12 years agodoc: Check documentation generation requirements with autoconf
Thomas Graf [Wed, 9 May 2012 08:06:24 +0000 (10:06 +0200)]
doc: Check documentation generation requirements with autoconf

Adds --enable-doc/--disable-doc, if omitted doc will only be build
if requirements are met. If explicitely enabled, configure script
will fail if requirements are not met.

12 years agou32: example/test code for u32 hashing with HTB
Adrian Ban [Tue, 8 May 2012 21:17:53 +0000 (23:17 +0200)]
u32: example/test code for u32 hashing with HTB

12 years agou32: add support for hashing
Adrian Ban [Tue, 8 May 2012 21:14:13 +0000 (23:14 +0200)]
u32: add support for hashing

12 years ago3.2.9 release libnl3_2_9
Thomas Graf [Tue, 8 May 2012 20:53:26 +0000 (22:53 +0200)]
3.2.9 release

12 years agonl: Fix return value of nl_recvmsgs()
Thomas Graf [Tue, 8 May 2012 20:48:00 +0000 (22:48 +0200)]
nl: Fix return value of nl_recvmsgs()

Apparently the change to have nl_recvmsgs() return the number of
parsed messages broke nl_wait_for_ack() among other applications.

This patch reverts to the old behaviour and provides a new function
nl_recvmsgs_report() which provides the additional information for
use by the cache manager and possibly other applications.

Reported-by: Scott Bonar <sbonar@cradlepoint.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years agoFix two bugs in 3.2.8/doc/
Jeroen Roovers [Tue, 1 May 2012 18:32:57 +0000 (20:32 +0200)]
Fix two bugs in 3.2.8/doc/

doc/Doxyfile.in:
  Refer to @top_srcdir@ instead of @src_dir@
doc/Makefile.in:
  Set .PHONY to api_ref instead of api_refs

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/libnl/files/

Cheers,
     jer

12 years ago3.2.8 release libnl3_2_8
Thomas Graf [Thu, 26 Apr 2012 09:22:49 +0000 (11:22 +0200)]
3.2.8 release

12 years agoobject: Add functions to access the object type, cache and object ops
Thomas Graf [Tue, 24 Apr 2012 12:55:23 +0000 (14:55 +0200)]
object: Add functions to access the object type, cache and object ops

12 years agocache: Add co_include_event allowing caches to provide their own nl_cache_include...
Thomas Graf [Sun, 22 Apr 2012 13:23:52 +0000 (15:23 +0200)]
cache: Add co_include_event allowing caches to provide their own nl_cache_include() implementation

12 years agocache: improve documentation of co_event_filter
Thomas Graf [Sun, 22 Apr 2012 12:36:01 +0000 (14:36 +0200)]
cache: improve documentation of co_event_filter

12 years agogenl: Make genl_unregister() a NOP if NULL pointer is passed
Thomas Graf [Sun, 22 Apr 2012 09:12:01 +0000 (11:12 +0200)]
genl: Make genl_unregister() a NOP if NULL pointer is passed

12 years agocache_mngr: Make providing the result pointer to nl_cache_mngr_add() optional
Thomas Graf [Sat, 21 Apr 2012 13:51:43 +0000 (15:51 +0200)]
cache_mngr: Make providing the result pointer to nl_cache_mngr_add() optional

12 years agotest-cache-mngr: Allow for management of arbitary caches via argument string
Thomas Graf [Sat, 21 Apr 2012 13:49:09 +0000 (15:49 +0200)]
test-cache-mngr: Allow for management of arbitary caches via argument string

Let the user specify a list of cache types to add to the manager
as arguments instead of adding a static list.

Uses the newly added nl_cache_mngr_info() to constantly print
information about the manager.

12 years agocache_mngr: Provide nl_cache_mngr_info() to pring cache manager details
Thomas Graf [Sat, 21 Apr 2012 13:48:37 +0000 (15:48 +0200)]
cache_mngr: Provide nl_cache_mngr_info() to pring cache manager details

Useful for debugging and testing

12 years agocache_mngr: API doc updates
Thomas Graf [Sat, 21 Apr 2012 13:22:04 +0000 (15:22 +0200)]
cache_mngr: API doc updates

12 years agocache_mngr: Let nl_cache_mngr_data_ready() read multiple messages
Thomas Graf [Sat, 21 Apr 2012 10:47:29 +0000 (12:47 +0200)]
cache_mngr: Let nl_cache_mngr_data_ready() read multiple messages

Having nl_recvmsgs() return the number of read messages allows
to continue reading until the underlying recvmsg() will return
EAGAIN for the non blocking socket.

12 years agonl: Make nl_recvmsgs() return the number of netlink messages processed
Thomas Graf [Sat, 21 Apr 2012 10:46:01 +0000 (12:46 +0200)]
nl: Make nl_recvmsgs() return the number of netlink messages processed

12 years agocache_mngr: Fix memory corruption after resizing
Thomas Graf [Sat, 21 Apr 2012 10:23:38 +0000 (12:23 +0200)]
cache_mngr: Fix memory corruption after resizing

The reallocated part of the enlarged association array was left
uninitialized which would have resulted in trying to free random
pointers.

This was a theoretical bug because it wasn't possible to register
more than 32 cache types since no netlink family supports that
many individual cache types.

Nevertheless this patch fixes the bug and also reduces the default
size of the allocation table and expandations a bit to reduce the
memory footprint slightly.

12 years agotest-cache-mngr: Let the cache manager allocate the socket
Thomas Graf [Sat, 21 Apr 2012 10:14:11 +0000 (12:14 +0200)]
test-cache-mngr: Let the cache manager allocate the socket

12 years agocache_mngr: Automatically allocate socket if needed
Thomas Graf [Sat, 21 Apr 2012 10:11:45 +0000 (12:11 +0200)]
cache_mngr: Automatically allocate socket if needed

The requirement to have the caller provide the socket does not
make much sense. Automatically allocate the socket if none was
provided.

This may also avoid some future abuse of reusing request sockets
for handling notifications.

Also rename cm_handle to cm_sock for clarity (no API change)

12 years agocache_manager: Move documentation to doc/core.txt
Thomas Graf [Sat, 21 Apr 2012 09:38:33 +0000 (11:38 +0200)]
cache_manager: Move documentation to doc/core.txt

12 years agocache_mngr: Don't modify callback setup of socket
Thomas Graf [Sat, 21 Apr 2012 08:51:34 +0000 (10:51 +0200)]
cache_mngr: Don't modify callback setup of socket

Instead, clone it and modify a temporary copy. Although it is not
recommended to use the same socket for requests and to serve a
cache manager, this change might prevent some unwanted side effects
if done so.

12 years agotests: fix test programs to compile again
Thomas Graf [Sat, 21 Apr 2012 08:35:20 +0000 (10:35 +0200)]
tests: fix test programs to compile again

12 years agotests: Convert tests/Makefile to use automake
Thomas Graf [Sat, 21 Apr 2012 08:34:43 +0000 (10:34 +0200)]
tests: Convert tests/Makefile to use automake

12 years agocache_mngr: document uncommon error codes
Thomas Graf [Sat, 21 Apr 2012 07:59:26 +0000 (09:59 +0200)]
cache_mngr: document uncommon error codes

12 years agogenl-ctrl-list: Mark for installation
Thomas Graf [Fri, 20 Apr 2012 13:28:48 +0000 (15:28 +0200)]
genl-ctrl-list: Mark for installation

12 years agogenl-ctrl-list: fix copyright and summary
Thomas Graf [Fri, 20 Apr 2012 13:27:52 +0000 (15:27 +0200)]
genl-ctrl-list: fix copyright and summary

12 years agogenl-ctrl-list: Provide manual page
Thomas Graf [Fri, 20 Apr 2012 13:19:41 +0000 (15:19 +0200)]
genl-ctrl-list: Provide manual page

12 years agogenl-ctrl-list: Introduce -d|--details as a shortcut for --format=details
Thomas Graf [Fri, 20 Apr 2012 13:18:21 +0000 (15:18 +0200)]
genl-ctrl-list: Introduce -d|--details as a shortcut for --format=details

12 years agoMemory leak in classid.c
Nicolas CARRIER [Fri, 13 Apr 2012 11:51:44 +0000 (13:51 +0200)]
Memory leak in classid.c

I'm using libnl in a program which I give to valgrind
in order to track memory errors / leaks. When my program
exits, it complains about non-freed memory, allocated in
3 places in classid.c, at lines 280, 284 and 289.

It seems related to the module's constructor classid_init
which allocates resources, with no destructor to free it.

The attached patch tries to fix this issue by registering
a destructor which performs the tree liberation at exit.

12 years agodoc: Fix incorrect nl_socket_add_memberships() example
Thomas Graf [Mon, 26 Mar 2012 12:02:25 +0000 (14:02 +0200)]
doc: Fix incorrect nl_socket_add_memberships() example

Reported by: Andrew Collins <bsderandrew@gmail.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years agomissing extended Table attribute for lib/route/
Romary Sonrier [Sat, 3 Mar 2012 00:46:46 +0000 (01:46 +0100)]
missing extended Table attribute for lib/route/

I found a small bug in libnl, about extended table id ( above 256 ).

Signed-off-by: Romary Sonrier <romary@sonrier.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years agodoc: Fix typos in autoconf example
Thomas Graf [Wed, 22 Feb 2012 23:20:45 +0000 (00:20 +0100)]
doc: Fix typos in autoconf example

Reported by nick black <dankamongmen@gmail.com>

12 years agoAdd new nl_cache_clone() function.
Thierry Reding [Thu, 16 Feb 2012 11:57:42 +0000 (12:57 +0100)]
Add new nl_cache_clone() function.

The function can be used to make a copy of an existing cache. It is very
similar to nl_cache_subset() except that it allows no filtering but
copies every object.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years agoSupport plug qdisc - queue traffic until explicit release
Shriram Rajagopalan [Sun, 12 Feb 2012 22:53:10 +0000 (14:53 -0800)]
Support plug qdisc - queue traffic until explicit release

The plug qdisc supports two operations - plug and unplug. When the
qdisc receives a plug ("buffer") command via netlink request,
packets arriving henceforth are buffered until a corresponding unplug
command is received. Depending on the type of unplug ("release_one"
or "release_indefinite"), the queue can be unplugged indefinitely or
selectively.

The plug qdisc allows a user to implement network output buffering
(aka output commit), used commonly in checkpoint based fault tolerance
systems. It also supports a general purpose queue plug/unplug
functionality.

The associated kernel module is available in David Miller's net-next
tree, commit: c3059be16c9ef29c05f0876a9df5fea21f29724f

This patch introduces userspace tools and API, to control the qdisc
via netlink messages.

Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years agoadd new function to provide neighbour event parsing
Brett Ciphery [Sun, 29 Jan 2012 17:19:00 +0000 (12:19 -0500)]
add new function to provide neighbour event parsing

the neighbour parsing function was previously not accessible, so
custom callback functions had to handle the decoding itself.
rtnl_neigh_parse is introduced and implemented in much the same way
as rtnl_route_parse.

Signed-off-by: Brett Ciphery <brett.ciphery@windriver.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years ago3.2.7 release libnl3_2_7
Thomas Graf [Wed, 25 Jan 2012 16:03:37 +0000 (17:03 +0100)]
3.2.7 release

fixes a bug in SO versioning. libtool age was increased incorrectly
which resulted in an incorrect SO version string in the releases
3.2.5 and 3.2.6.

12 years ago3.2.6 release libnl3_2_6
Thomas Graf [Tue, 17 Jan 2012 11:51:15 +0000 (12:51 +0100)]
3.2.6 release

12 years agoman: Remove bogus .LO macro in manpages
Thomas Graf [Tue, 17 Jan 2012 11:45:06 +0000 (12:45 +0100)]
man: Remove bogus .LO macro in manpages

Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years agoUpdate COPYING to fix FSF address
Thomas Graf [Tue, 17 Jan 2012 11:38:37 +0000 (12:38 +0100)]
Update COPYING to fix FSF address

Apparently we have been shiping an outdated version of the LGPL
containing an obsolete address of the FSF.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years agocli: Use -avoid-version to link cli modules
Thomas Graf [Tue, 17 Jan 2012 11:34:26 +0000 (12:34 +0100)]
cli: Use -avoid-version to link cli modules

Signed-off-by: Thomas Graf <tgraf@redhat.com>
12 years ago3.2.5 release libnl3_2_5
Thomas Graf [Thu, 12 Jan 2012 12:17:32 +0000 (13:17 +0100)]
3.2.5 release