dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

484 Commits

Author SHA1 Message Date
Thomas Graf 43eab4696d genl: Update genl-ctrl-list(8) 2012-06-01 13:10:03 +02:00
Thomas Graf 8fad2e3194 genl: Export genl_ops_resolve() and genl_mngt_resolve() in header
These have been public but have not been declared in a header yet.
2012-06-01 11:51:43 +02:00
Thomas Graf faef2fa45f 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.
2012-06-01 11:48:08 +02:00
Thomas Graf 3656b6f908 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.
2012-05-31 13:37:57 +02:00
Thomas Graf 71b442b955 genl: Add genlmsg_hdr()
Explicit function to calculate the genl hdr based on nlh
2012-05-31 13:13:50 +02:00
Thomas Graf 0b70de5155 genl: updates to API reference documentation 2012-05-31 13:11:48 +02:00
Jiri Pirko d733f8a0a6 use MSG_TRUNC flag to get recv message size at once
prevent multiple calls of recvmsg.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
2012-05-29 11:46:01 +02:00
Andrew Collins 970f5d0221 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.
2012-05-29 11:42:48 +02:00
A C 9bb30a5e80 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.
2012-05-29 11:40:13 +02:00
Bushman, Jeff ca883b61bc 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.
2012-05-18 15:03:46 +02:00
Adrian Ban 24d577c93d 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
2012-05-16 13:43:52 +02:00
Thomas Graf 6627ec3836 tc: fix included headers
Reported-by: Adrian Ban <adrian.ban@mantech.ro>
2012-05-16 13:42:05 +02:00
Isaac 996b502961 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.
2012-05-13 11:18:28 +02:00
Thomas Graf fec10a2823 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
2012-05-10 12:03:59 +02:00
Justin Mayfield 32057bc154 __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.
2012-05-10 09:12:18 +02:00
Thomas Graf 100403a99a route: Add FIXME to rtnl_route_nh_set_gateway() to fix return value
Reported-by: Justin Mayfield <jmayfield@cradlepoint.com>
2012-05-09 15:03:46 +02:00
Thomas Graf 2fbab02ba8 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.
2012-05-09 15:02:40 +02:00
Thomas Graf 183e86913a 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.
2012-05-09 10:06:24 +02:00
Adrian Ban 7b503a12a0 u32: example/test code for u32 hashing with HTB 2012-05-08 23:17:53 +02:00
Adrian Ban beb40e2b4e u32: add support for hashing 2012-05-08 23:14:13 +02:00
Thomas Graf f8b4f9271b 3.2.9 release 2012-05-08 22:53:26 +02:00
Thomas Graf 6f156a7b58 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>
2012-05-08 22:48:00 +02:00
Jeroen Roovers d726ecd2d7 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
2012-05-07 14:54:42 +02:00
Thomas Graf ad5d2b7738 3.2.8 release 2012-04-26 11:22:49 +02:00
Thomas Graf ff3e9e314c object: Add functions to access the object type, cache and object ops 2012-04-24 14:55:23 +02:00
Thomas Graf bd1e4d0384 cache: Add co_include_event allowing caches to provide their own nl_cache_include() implementation 2012-04-22 15:23:52 +02:00
Thomas Graf 2e23491c50 cache: improve documentation of co_event_filter 2012-04-22 14:36:01 +02:00
Thomas Graf 8bbcd2208e genl: Make genl_unregister() a NOP if NULL pointer is passed 2012-04-22 11:12:01 +02:00
Thomas Graf 2e93940a86 cache_mngr: Make providing the result pointer to nl_cache_mngr_add() optional 2012-04-21 15:51:43 +02:00
Thomas Graf 2ed371eb59 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.
2012-04-21 15:49:09 +02:00
Thomas Graf 516536625f cache_mngr: Provide nl_cache_mngr_info() to pring cache manager details
Useful for debugging and testing
2012-04-21 15:48:37 +02:00
Thomas Graf 743756f3b4 cache_mngr: API doc updates 2012-04-21 15:22:04 +02:00
Thomas Graf a518a318d4 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.
2012-04-21 12:47:29 +02:00
Thomas Graf e0482794a8 nl: Make nl_recvmsgs() return the number of netlink messages processed 2012-04-21 12:46:01 +02:00
Thomas Graf adbc568735 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.
2012-04-21 12:23:38 +02:00
Thomas Graf a143037fa3 test-cache-mngr: Let the cache manager allocate the socket 2012-04-21 12:14:11 +02:00
Thomas Graf e34ed950bd 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)
2012-04-21 12:11:45 +02:00
Thomas Graf c55acc438b cache_manager: Move documentation to doc/core.txt 2012-04-21 11:38:33 +02:00
Thomas Graf b32011254d 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.
2012-04-21 10:51:34 +02:00
Thomas Graf e78975aea8 tests: fix test programs to compile again 2012-04-21 10:35:20 +02:00
Thomas Graf 9af5469004 tests: Convert tests/Makefile to use automake 2012-04-21 10:34:43 +02:00
Thomas Graf 653ea3457a cache_mngr: document uncommon error codes 2012-04-21 09:59:26 +02:00
Thomas Graf 5f4d4d3bec genl-ctrl-list: Mark for installation 2012-04-20 15:28:48 +02:00
Thomas Graf 4a2962d897 genl-ctrl-list: fix copyright and summary 2012-04-20 15:27:52 +02:00
Thomas Graf 5399b3d192 genl-ctrl-list: Provide manual page 2012-04-20 15:19:41 +02:00
Thomas Graf 073ef6a66e genl-ctrl-list: Introduce -d|--details as a shortcut for --format=details 2012-04-20 15:18:21 +02:00
Nicolas CARRIER f54ac3d55f 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.
2012-04-19 18:51:17 +02:00
Thomas Graf 7d47666eb3 doc: Fix incorrect nl_socket_add_memberships() example
Reported by: Andrew Collins <bsderandrew@gmail.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-03-26 14:02:25 +02:00
Romary Sonrier 965fd78042 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>
2012-03-06 10:15:30 +01:00
Thomas Graf f7d06614fc doc: Fix typos in autoconf example
Reported by nick black <dankamongmen@gmail.com>
2012-02-23 00:20:45 +01:00