libnl/lib
Thomas Haller 4dd5fdd0af lib/socket: retry generate local port in nl_connect on ADDRINUSE
It can easily happen that the generated local netlink port is alrady in
use. In that case bind will fail with ADDRINUSE.

Users of libnl3 could workaround this, by managing the local ports
themselves, but sometimes these users are libraries too and they also
don't know which ports might be used by other components.

This patch changes that nl_socket_alloc() no longer initilizes the local
port id immediately. Instead it will be initialized when the user calls
nl_socket_get_local_port() the first time and thereby shows interest in
the value.

If bind() fails with ADDRINUSE, check if the user ever cared about the
local port, i.e. whether the local port is still unset. If it is still
unset, assume that libnl should choose a suitable port and retry until
an unused port can be found.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-06 14:34:58 +02:00
..
cli add fq_codel cli module 2013-11-22 10:13:40 +01:00
fib_lookup Use thread-safe strerror_r() instead of strerror() 2013-02-28 13:07:04 +01:00
genl genl: Fix cb reference leak in genl_ctrl_probe_by_name() 2013-04-02 11:51:53 +02:00
idiag More safely parse vegas info and mem info. 2013-07-25 17:59:56 -07:00
netfilter netfilter/ct: expand CT parameters that can be used in add/delete operations 2014-04-14 19:20:53 +02:00
route ipvti: introduce vti tunnel support 2014-05-06 12:04:02 +02:00
.gitignore Added lex.yy.c to .gitignore 2012-08-30 03:19:04 +06:00
addr.c do not compile some address families when not available 2013-11-09 01:07:19 +01:00
attr.c The commit 6a8d90f5fe "attr: Allow attribute type 0" intended to 2013-11-29 09:41:28 +01:00
cache.c cache: Return -NLE_PROTO_MISMATCH if socket provided mismatches cache protocol 2013-07-01 12:41:42 +02:00
cache_mngr.c Handle -NLE_AGAIN in nl_cache_mngr_data_ready 2013-06-27 01:12:36 +02:00
cache_mngt.c Move private header files to <netlink-private/*> 2013-01-24 13:51:24 +01:00
data.c Move private header files to <netlink-private/*> 2013-01-24 13:51:24 +01:00
error.c Move private header files to <netlink-private/*> 2013-01-24 13:51:24 +01:00
handlers.c nl_cb: store nl_cb_type in struct nl_cb 2013-09-05 17:46:00 +02:00
hash.c Hash: Properly prefix hash functions 2012-11-10 10:22:26 +01:00
hashtable.c Move private header files to <netlink-private/*> 2013-01-24 13:51:24 +01:00
Makefile.am ipvti: introduce vti tunnel support 2014-05-06 12:04:02 +02:00
msg.c Remove extra memset from __nlmsg_alloc 2013-11-08 17:15:16 +01:00
nl.c lib/socket: retry generate local port in nl_connect on ADDRINUSE 2014-05-06 14:34:58 +02:00
object.c obj: Check for NULL pointer in nl_object_clone() 2013-10-22 14:20:41 +02:00
socket.c lib/socket: retry generate local port in nl_connect on ADDRINUSE 2014-05-06 14:34:58 +02:00
utils.c lib/socket: retry generate local port in nl_connect on ADDRINUSE 2014-05-06 14:34:58 +02:00
version.c Run-time version information is now available 2012-08-30 03:19:04 +06:00