dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

297 Commits

Author SHA1 Message Date
Thomas Graf 28233246cd Allow parser callbacks to return NL_OK, NL_SKIP, NL_EXIT
Obsoletes internal P_ACCEPT/P_IGNORE
2008-05-15 14:01:57 +02:00
Thomas Graf 8cd39c9f4c Uninline various functions to save 7K code 2008-05-15 13:56:13 +02:00
Thomas Graf ef50a38fbd Fix memory leaks when sending of message failed
Various callers of nl_send_auto_complete() failed to
free the allocated message when an error was reported.
2008-05-15 13:45:41 +02:00
Thomas Graf 1155370f52 Rename struct nl_handle to struct nl_sock
The idea of a common handle is long revised and only misleading,
nl_handle really represents a socket with some additional
action handlers assigned to it.

Alias for nl_handle is kept for backwards compatibility.
2008-05-15 13:26:32 +02:00
Thomas Graf 0cf780859c Check length of provided address label 2008-05-14 23:08:06 +02:00
Thomas Graf b4fbe1d34d Replace RTNL_LINK_NOT_FOUND with just 0
The interface index 0 is reserved and can be safely used to
signal that the device does not exist.
2008-05-14 18:34:39 +02:00
Thomas Graf eed2afaab7 Remove obsolete nla_get_addr() and nla_get_data()
Replaces obsolete calls to nla_get_addr() and nla_get_data()
with nl_addr_alloc_attr() respectively nl_data_alloc_attr().

Also fixes missing error handling while parsing routing multipath
configuration.
2008-05-14 18:26:47 +02:00
Thomas Graf 7179b2d859 Break API some more
Since we've broken the API anyway, remove some aliases which only
exist for backwards compatibility.
2008-05-14 17:56:22 +02:00
Thomas Graf 8a3efffa5b Thread-safe error handling
In order for the interface to become more thread safe, the error
handling was revised to no longer depend on a static errno and
error string buffer.

This patch converts all error paths to return a libnl specific
error code which can be translated to a error message using
nl_geterror(int error). The functions nl_error() and
nl_get_errno() are therefore obsolete.

This change required various sets of function prototypes to be
changed in order to return an error code, the most prominent
are:

    struct nl_cache *foo_alloc_cache(...);
changed to:
    int foo_alloc_cache(..., struct nl_cache **);

    struct nl_msg *foo_build_request(...);
changed to:
    int foo_build_request(..., struct nl_msg **);

    struct foo *foo_parse(...);
changed to:
    int foo_parse(..., struct foo **);

This pretty much only leaves trivial allocation functions to
still return a pointer object which can still return NULL to
signal out of memory.

This change is a serious API and ABI breaker, sorry!
2008-05-14 17:49:44 +02:00
Ben Gamsa 85f932552e patch: fixed compilation problem for nl-route-get
Fixed compilation problem for nl-route-get by adding extra parameter now
needed for nltool_alloc_route_cache() function.
2008-05-08 17:56:24 +02:00
Ben Gamsa 107dc162c5 patch: fixed up support for tables in rules 2008-05-08 17:56:11 +02:00
Ben Gamsa cc9c6d6384 Added two new functions to facilitate processing the nexthop entries for routes.
Added rtnl_route_foreach_nexthop() to walk the list of nexthops invoking a
caller-provided callback for each nexthop entry, and added rtnl_route_nexthop_n()
to retrieve the Nth nexthop entry in the list.
2008-05-08 17:54:37 +02:00
Thomas Graf 48e1e5c472 Speed up metrics comparison
Using rtnl_route_get_metric() for route comparison became a bottleneck
because each metric which was not available resulted in the generation
of an error message. This changeset avoids this by accessing rt_metrics
and rt_metrics_mask directly while comparing route objects.
2008-05-08 12:47:26 +02:00
Thomas Graf b7c5bf98c4 Improve performance by using malloc() over calloc() in critical places
As pointed out by Regis Hanna, a considerable performance gain can be
achieved by using malloc() over calloc() when allocating netlink message
buffers. This is likely due to the fact that we use a complete page for
each message.
2008-05-07 13:18:30 +02:00
Thomas Graf dc883cc149 ignore more temporary files 2008-05-05 17:13:02 +02:00
Thomas Graf d6cd72555d Fix dumping of iif route attribute 2008-05-05 17:09:56 +02:00
Thomas Graf 85808860b6 Route cache support
This changesets adds the possibility to fill a nl_cache with
the contents of the route cache. It also adds the possibility
to limit route caches to certain address families.
2008-05-05 17:09:25 +02:00
Tad Kollar 861901c55b Fixed netem_build_msg() delay distribution table existence test. 2008-05-01 00:06:06 +02:00
Tad Kollar 241b2b83ba New netem funtionality and TBF fix
New netem-related functionality:
Added ability to save new settings to the kernel. In netem.c, the
netem_get_opts() stub has been replaced with netem_build_msg() which
manipulates the nl_msg data directly and returns an error code instead
of a new nl_msg. Modifications to qdisc_build() in qdisc.c and struct
rtnl_qdisc_ops were necessary for this.
Added support for getting/setting corruption probability/correlation.
Added support for setting a delay distribution.

Fixed tbf_msg_parser() to call tbf_alloc() instead of tbf_qdisc() to
prevent a seg fault.
2008-04-30 19:59:06 +02:00
Thomas Graf 5c92c656cc Remove leftover definition of verbose errors 2008-04-30 18:53:01 +02:00
Thomas Graf 2033861424 version.h.in should be in tree not the generated version 2008-04-30 18:52:28 +02:00
Thomas Graf a948e082ea Adapt syntax of nl-route-add to nl-route-delete 2008-04-30 18:51:24 +02:00
Thomas Graf 182608e236 Fix segfault nexthop parsing when no option is given 2008-04-30 18:50:52 +02:00
Thomas Graf 6d9d3d5475 Adapt syntax of nl-route-list to nl-route-delete 2008-04-30 18:49:56 +02:00
Thomas Graf 2a09497fa4 Improved nl-route-delete featuring an interactive deletion mode 2008-04-30 18:48:49 +02:00
Thomas Graf 66330d37f5 Provide libnl version in <netlink/version.h> 2008-04-30 15:43:42 +02:00
Inaky Perez-Gonzalez 32000e8e9c 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).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2008-04-29 23:46:47 +02:00
Thomas Graf 535e831622 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.
2008-04-29 23:31:30 +02:00
Thomas Graf 8ac78f1552 Fix compile warning in nl-list-caches 2008-04-29 23:11:09 +02:00
Thomas Graf 662887c052 Export nl_dump_line() and automatically count lines while dumping 2008-04-29 23:08:12 +02:00
Thomas Graf 1240cd6635 Move to version 1.2 and remove some dead code in configure.in 2008-04-29 23:02:42 +02:00
Thomas Graf 5ab64d5173 Define datarootdir to silent autoconf 2008-04-29 23:01:39 +02:00
Thomas Graf 477e351fd4 Don't wipe cscope database on make clean 2008-04-29 22:59:30 +02:00
Thomas Graf f4f7704b0d Ignore NULL pointers passed to nl_cache_free() 2008-04-29 22:58:07 +02:00
Thomas Graf 22f0ece5ac Remove dead code in nl-list-sockets 2008-04-29 10:50:23 +02:00
Thomas Graf 25ccbf1dab Prepare nl-list-sockets for 64bit addresses 2008-04-29 10:48:34 +02:00
Thomas Graf 0ca291d9e4 Fix 64bit alignment issue on x86_64. 2008-03-31 22:43:04 +02:00
Patrick McHardy 38c37dda2e [LIBNL]: Install netlink/route/link headers
Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-03-29 13:20:25 +01:00
Thomas Graf 0c2cb97924 libnl: fix policy check for NFQA_HWADDR
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
2008-03-10 14:59:32 +01:00
Thomas Graf a9183a9c9f Fix from Benoit Boissinot <benoit.boissinot@ens-lyon.org> required to
install libnl in non-standard locations.
2008-03-10 14:57:01 +01:00
Thomas Graf 358e44efa4 Optimize nl_cache_ops_associate by checking protocol early 2008-03-05 14:11:05 +01:00
Thomas Graf 6a7606fa29 Initialize message type list to avoid overrun 2008-03-05 14:10:09 +01:00
Rui Tiago Cação Matos cca3921f15 [PATCH] Remove usage of C++ keyword 'class' on htb.h header.
Signed-off-by: Rui Tiago Cação Matos <rmatos@av.it.pt>
2008-03-05 13:39:12 +01:00
Thomas Graf 639b66b1f6 Update local copy of linux/rtnetlink.h 2008-03-05 11:31:41 +01:00
Thomas Graf 4be02ace48 Be liberal when receiving an empty nested attribute
No longer enforce at least one attribute in a container of nested
attributes. The application may do so itself by setting minlen
to NLA_HDRLEN.
2008-02-22 15:20:58 +01:00
Patrick McHardy ca0988a2a7 Fix nfnl_queue_msg_get_packetid() return type
[LIBNL]: Fix nfnl_queue_msg_get_packetid() return type

The packet-ID is a 32 bit value, but nfnl_queue_msg_get_packetid() returns
an uint16_t. Makes queueing fail after 2^16 packets.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-02-07 13:18:34 +01:00
Patrick McHardy 574d4af2b1 [LIBNL]: Install netfilter headers
libnl currently forgets to install the netfilter headers.
Fix that.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-02-07 13:14:56 +01:00
Patrick McHardy 596d3bc2e9 [LIBNL]: Support conntrack add/delete/query requests
Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-02-07 13:13:03 +01:00
Patrick McHardy 2f4f8a5094 [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.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-02-07 13:09:17 +01:00
Patrick McHardy 3f48e49102 [LIBNL]: nfnetlink_log: support NUFLA_GID attribute
The NUFLA_GID attribute (currently only in net-2.6.25) contains the
gid of the sending process for locally generated packets.

Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-02-07 13:02:41 +01:00