dect
/
libnl
Archived
13
0
Fork 0
Commit Graph

19 Commits

Author SHA1 Message Date
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
Jiri Pirko 17781e44dd socket: fix two typos
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
2011-08-31 09:24:01 +02:00
Jiri Pirko 6faeffe64a socket: introduce nl_socket_modify_err_cb
This function does the same as nl_socket_modify_cb except for error
callback

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
2011-08-31 09:23:58 +02:00
Andrew Rybchenko b367024167 Local port leak on nl_socket_alloc/nl_socket_set_local_port(, 0)
I've found a bug in the following scenario (fragment of code):

while (1) {
    struct nl_sock *sk = nl_socket_alloc();

    if (sk == NULL) {
        fprintf(stderr, "Failed to allocate nl socket\n");
	break;
    }
    nl_socket_set_local_port(sk, 0);
    nl_socket_free(sk);
}

The problem is that nl_socket_set_local_port(, 0) does not
release local port if it is allocated before.
2011-08-30 09:55:46 +02:00
Thomas Graf 569bec5b5c make port map thread safe
This patch has been in Fedora and RHEL for a while. It adds a mutex
to protect the port map from concurrent thread accesses.

Original patch from Stefan Berger <stefanb@us.ibm.com>.
Modified to use configure.in to check for libpthread
2011-08-11 15:17:56 +02:00
Thomas Graf c32c3f3664 socket: constify interface 2010-11-18 12:47:16 +01:00
dima 2dbc1ca76c Generic Netlink multicast groups support
I have a patch against commit d378220c96
extending libnl with a facility to receive generic netlink messages sent
to multicast groups.

Essentially it add one new function genl_ctrl_resolve_grp which
prototype looks like this
int genl_ctrl_resolve_grp(struct nl_sock *sk, const char *family_name,
        const char *grp_name)
It resolves  the family name and the group name to group id. Then
the returned id can be used in nl_socket_add_membership to subscribe
to multicast messages.

Besides that it adds two more functions

uint32_t nl_socket_get_peer_groups(struct nl_sock *sk)
void nl_socket_set_peer_groups(struct nl_sock *sk, uint32_t groups)

allowing to modify the socket peer groups field. So it's possible to
multicast messages from the user space using the legacy interface.
Looks like there is no way (or I was not able to find one?) to modify
the netlink socket destination group from the user space, when the
group id is greater then 32.
2010-10-14 13:46:02 +02:00
Inaky Perez-Gonzalez ef8ba32e0c release_local_port: properly compute the bitmap position
Current calculation is always off, not reflecting the right position
in the bitmap, which results in failures due to conflicts (detected at
the kernel level) when trying to open a new handle.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
2009-05-04 14:56:24 +02:00
Thomas Graf 6782b6f709 restructure module documentation order
split hiearchy into one top level module per library
2008-12-10 18:12:30 +01:00
Thomas Graf 724dfa6d70 Consistent naming of socket functions 2008-12-10 18:00:11 +01:00
Thomas Graf 4fd5f7cb66 Documentation update 2008-12-03 19:58:41 +01:00
Holger Eitzenberger 72aa861c48 Allow to pass multiple group values to membership functions
Instead of calling the membership functions several times it is
helpfull to extend the API and make the single group functions a
special case.

The value 0 (NFNLGRP_NONE) terminates this list.

Example use:

  nl_socket_add_memberships(sock, group_1, group_2, 0);
  nl_socket_drop_memberships(sock, group_1, group_2, 0);

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
2008-12-03 19:54:21 +01:00
Thomas Graf 2bdee95a76 Add socket flag NL_NO_AUTO_ACK to allow disabling auto ACKS 2008-10-20 13:02:38 +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 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
Thomas Graf 680c54fd46 Support defining the default callback handler with an environment variable 2007-12-18 13:06:48 +01:00
Thomas Graf 155ad439a4 Fix memory leak when parsing netlink messages into caches
The reference created by the parsers was never given back.
2007-12-17 16:52:41 +01:00
Thomas Graf 91c330aae5 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.
2007-12-17 16:26:49 +01:00
Thomas Graf 44d362409d Initial import 2007-09-15 01:28:01 +02:00