summaryrefslogtreecommitdiffstats
path: root/lib/socket.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix leak of cb if nl_socket_alloc_cb() failed to allocate socketКоренберг Марк (дома)2013-04-271-4/+13
| | | | | - each *_get() should have corresponding *_put(). That rule was broken in nl_socket_alloc() - Also, check if cb is NULL in nl_socket_set_cb (calls BUG())
* Move private header files to <netlink-private/*>Thomas Graf2013-01-241-1/+1
| | | | | | | This clarifies the seperation between public and private header files. Signed-off-by: Thomas Graf <tgraf@suug.ch>
* lock abstraction layerThomas Graf2012-11-151-22/+6
| | | | | | Hide pthread availability and enablement behind internal API Signed-off-by: Thomas Graf <tgraf@suug.ch>
* socket: document nl_socket_get_fd()Thomas Graf2012-11-061-0/+9
|
* Add missing va_end() callsMichele Baldessari2012-10-291-4/+12
| | | | Add missing va_end() calls on all error paths
* Add configure option to disable pthreads supportRich Fought2012-10-261-0/+16
|
* nl: Provide API to specify the default buffer size when receiving netlink ↵Thomas Graf2012-10-091-0/+30
| | | | | | | | | | | | messages New functions: nl_socket_set_msg_buf_size(sk, size) nl_socket_get_msg_buf_size(sk) Default remains getpagesize() Signed-off-by: Thomas Graf <tgraf@redhat.com>
* doc: documentation restructuringThomas Graf2012-05-101-2/+14
| | | | | | | | | | - 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
* socket: fix two typosJiri Pirko2011-08-311-2/+2
| | | | Signed-off-by: Jiri Pirko <jpirko@redhat.com>
* socket: introduce nl_socket_modify_err_cbJiri Pirko2011-08-311-0/+15
| | | | | | | This function does the same as nl_socket_modify_cb except for error callback Signed-off-by: Jiri Pirko <jpirko@redhat.com>
* Local port leak on nl_socket_alloc/nl_socket_set_local_port(, 0)Andrew Rybchenko2011-08-301-1/+8
| | | | | | | | | | | | | | | | | | 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.
* make port map thread safeThomas Graf2011-08-111-2/+14
| | | | | | | | 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
* socket: constify interfaceThomas Graf2010-11-181-6/+6
|
* Generic Netlink multicast groups supportdima2010-10-141-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | I have a patch against commit d378220c96c3c8b6f27dca33e7d8ba03318f9c2d 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.
* release_local_port: properly compute the bitmap positionInaky Perez-Gonzalez2009-05-041-1/+1
| | | | | | | | 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>
* restructure module documentation orderThomas Graf2008-12-101-1/+1
| | | | split hiearchy into one top level module per library
* Consistent naming of socket functionsThomas Graf2008-12-101-3/+14
|
* Documentation updateThomas Graf2008-12-031-71/+0
|
* Allow to pass multiple group values to membership functionsHolger Eitzenberger2008-12-031-16/+42
| | | | | | | | | | | | | | | 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>
* Add socket flag NL_NO_AUTO_ACK to allow disabling auto ACKSThomas Graf2008-10-201-0/+27
|
* Rename struct nl_handle to struct nl_sockThomas Graf2008-05-151-118/+115
| | | | | | | | 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.
* Thread-safe error handlingThomas Graf2008-05-141-23/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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!
* Support defining the default callback handler with an environment variableThomas Graf2007-12-181-1/+21
|
* Fix memory leak when parsing netlink messages into cachesThomas Graf2007-12-171-1/+1
| | | | The reference created by the parsers was never given back.
* Fix creation and destruction of socketsThomas Graf2007-12-171-3/+34
| | | | | | | | 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.
* Initial importThomas Graf2007-09-141-0/+548