dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

8 Commits

Author SHA1 Message Date
Thomas Graf 96bc6d6f66 Improve rtnl_link_change() behaviour
- avoid unncessary name change requests
    The kernel does not check if the specified IFNAME is different
    from the current name. It assumes that if IFNAME and ifindex
    are both specified, a name change is requested. Therefore avoid
    specyfing IFNAME if ifindex is provided and original and new
    name are identical.
- move link building to own function (to allow link add later on)
- error if immutable changes have been made
- better documentation
2011-04-13 16:42:34 +02:00
Nicolas Sitbon 7e9d5f69e5 correctly handle the object not found case
Removing non existent route (both ipv4 and ipv6) using
rtnl_route_delete return NLE_FAILURE generic error code. After
investigation, it seems the linux kernel return -ESRCH in that case
(see http://lxr.linux.no/linux+v2.6.38/net/ipv6/route.c#L1367). Same
behaviour apply for removing non existent address. The function
nl_syserr2nlerr (lib/error.c) which is responsible for translating
from kernel error to libnl error doesn't handle ESRCH.
2011-03-25 16:51:31 +01:00
Thomas Graf 93b6c114a8 Add NLE_NODEV error 2011-03-24 16:56:10 +01:00
Thomas Graf 65e386c8ba Packet location updates
This patch includes various bugfixes in the packet location parser.
Namely it removes two memory leaks if parsing fails. The parser is
correctly quit if an allocation error occurs and it is no longer
possible to add duplicates.

It removes the possibility to differ between net and host byteorder.
This is better done in the actual classifiers as it makes more sense
to specify this together with the value to compare against.

The patch also extends the API to add new packet locations via
rtnl_pktloc_add().

It introduces reference counting, therefore you now have to give
back packet locations with rtnl_pktloc_put() after looking them up
with rtnl_pktloc_lookup(). But you are allowed to keep using them
if the packet location file has been reread.

The packet location file now also understands "eth", "ip", and
"tcp" for "link", "net", and "transport".

A --list option has been added to nl-pktloc-lookup to list all
packet location definitions

A --u32=VALUE option has been added to let nl-pktloc-lookup print
the definition in iproute2's u32 selector style.

A manual page has been written for nl-pktloc-lookup.

Finally, nl-pktloc-lookup has been made installable.
2010-10-27 01:21:50 +02:00
Thomas Graf db5bd57899 Packet Location Interface 2010-07-02 14:06:59 +02:00
Patrick McHardy 8d2bb90726 libnl: add ERANGE to errno translation
Signed-off-by: Patrick McHardy <kaber@trash.net>
2009-11-10 11:29:07 +01:00
Patrick McHardy 37f9855f4c libnl: add some errno codes to nl_syserr2nlerr
Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-10-30 12:29:37 +01: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