[PATCH v2 0/4] lib/socket: use proper typed constant UINT32_MAX for uint32_t typed port

Thomas Haller thaller at redhat.com
Wed Apr 9 03:08:49 PDT 2014


Rework the 3 patches sent on "Tue,  8 Apr 2014 14:06:24 +0200",
including some bugfixes and actual testing of the code.
It seems to work correctly now (which it didn't before).

I also included the patch from "Mon,  7 Apr 2014 20:26:51 +0200"
> [PATCH 1/1] lib/socket: randomize the generated local port
so, that one is obsolete as well.
The "randomization" now also shuffles the order of how to access the
lower 32 bits. In testing, this actually makes a lot of a difference.

Thomas Haller (4):
  lib/socket: use proper typed constant UINT32_MAX for uint32_t typed
    port
  lib/socket: don't fail if no more local ports can be assigned in
    nl_socket_alloc
  lib/socket: retry generate local port in nl_connect on ADDRINUSE
  lib/socket: randomize the generated local port

 include/Makefile.am              |  1 +
 include/netlink-private/socket.h | 31 ++++++++++++++
 lib/nl.c                         | 52 +++++++++++++++++++----
 lib/socket.c                     | 91 +++++++++++++++++++++++++++++++++++-----
 libnl.sym.in                     |  5 +++
 5 files changed, 163 insertions(+), 17 deletions(-)
 create mode 100644 include/netlink-private/socket.h

-- 
1.9.0




More information about the libnl mailing list