libnl: recvmsgs doesn't necessarily free the message data
I stepped over libnl always freeing the messages and it
kind of made it awkward to reuse the message data without
reallocating.
The basic idea is: if a callback return value has a bit set,
don't free that message. The calling application owns it.
By default, things stay as before (messages are freed).
Thomas Graf [Tue, 29 Apr 2008 21:31:30 +0000 (23:31 +0200)]
Big routing code rework (API/ABI BREAK!)
Adds all missing routing attributes and brings the routing
related code to a working state. In the process the API
was broken several times with the justification that nobody
is using this code yet.
The changes include new example code which is also a prototype
for how plain CLI tools could look like to control routes.
Patrick McHardy [Fri, 18 Jan 2008 16:55:57 +0000 (17:55 +0100)]
[LIBNL]: Split up nfnetlink_log into log and msg objects
Split the nfnetlink_log code into two seperate objects, "netfilter/log"
to represent logging instances and "netfilter/log_msg" to represent
log messages. Also perform some function name unification for consistency
with other libnl object types, mainly renaming nfnl_log_build_*_msg
to nfnl_log_build_*_request.
This changes the API in an incompatible way, but since this feature is
new and the libnl netfilter headers haven't been installed so far,
there shouldn't be any users affected by this.
Thomas Graf [Tue, 5 Feb 2008 11:35:41 +0000 (12:35 +0100)]
Free associated caches when freeing cache manager
Caches allocated by the cache manager must be freed again when the cache
manager itself is freed. However, the netlink socket is allocated
indepdently so it should not be freed.
Thomas Graf [Mon, 14 Jan 2008 15:17:56 +0000 (16:17 +0100)]
Fix stale data pointers when constructing messages
Patrick McHardy reported a problem where pointers to the
payload of a netlink message as returned by f.e. the
nesting helpers become stale when the payload data
chunk is reallocated.
In order to avoid further problems, the payload chunk is
no longer extended on the fly. Instead the allocation is
made during netlink message object allocation time with
a default size of a page which should be fine for the
majority of all users. Additionally the functions
nlmsg_alloc_size() and nlmsg_set_default_size() have been
added to allocate messages of a particular length and to
modify the default message size.
Thomas Graf [Wed, 19 Dec 2007 18:41:01 +0000 (19:41 +0100)]
Represent default route with destination address length zero
So far the destination address for default routes was NULL
which complicated the handling of routes in general. By
assigning a address of length zero they can be compared
to each other.
This allows the cache manager to properly handle default
routes.
Thomas Graf [Mon, 17 Dec 2007 15:26:49 +0000 (16:26 +0100)]
Fix creation and destruction of sockets
Fixes an off-by-one when releasing local ports. Fixes nl_connect()
to properly close the socket upon failure. Return EBADFD if
operations are performed on unconnected sockets where appropriate.
Makes nl_handle_alloc() return an error if all local ports are
used up.
Patrick McHardy [Thu, 13 Dec 2007 13:33:37 +0000 (14:33 +0100)]
[LIBNL]: Fix pointer conversion warnings on 64 bit
nl-tctree-dump.c: In function 'print_class':
nl-tctree-dump.c:31: warning: cast from pointer to integer of different size
nl-tctree-dump.c:44: warning: cast from pointer to integer of different size
nl-tctree-dump.c: In function 'print_qdisc':
nl-tctree-dump.c:55: warning: cast from pointer to integer of different size
nl-tctree-dump.c:64: warning: cast from pointer to integer of different size
Patrick McHardy [Thu, 13 Dec 2007 13:33:35 +0000 (14:33 +0100)]
[LIBNL]: Fix pointer conversion warnings on 64 bit
nl-tctree-dump.c: In function 'print_class':
nl-tctree-dump.c:31: warning: cast from pointer to integer of different size
nl-tctree-dump.c:44: warning: cast from pointer to integer of different size
nl-tctree-dump.c: In function 'print_qdisc':
nl-tctree-dump.c:55: warning: cast from pointer to integer of different size
nl-tctree-dump.c:64: warning: cast from pointer to integer of different size
Philip Craig [Tue, 18 Sep 2007 01:53:04 +0000 (11:53 +1000)]
Use linux/types.h to fix amd64 build
10-amd64-linux-types.patch from Ubuntu:
- In order to make libnl compilable on amd64 include linux/types.h
rather than defining the types ourselves; necessary as other headers
include that and get different definitions.
-- Scott James Remnant <scott@ubuntu.com> Wed, 22 Mar 2006 02:12:08 +0000
Thomas Graf [Mon, 17 Sep 2007 11:36:16 +0000 (13:36 +0200)]
Export interface to define caches
This interface was internal so far which required all code defining
caches to be compiled with the sources available.
In order to simplify the interface, the co_msg_parser prototype was
changed to take the struct nl_parser_param directly instead of a
void *. It used to be void * because the co_msg_parser was directly
passed as the NL_CB_VALID callback function.