[PATCH 2/3] lib/socket: don't fail if no more local ports can be assigned in nl_socket_alloc

Thomas Graf tgraf at suug.ch
Tue Apr 8 23:56:52 PDT 2014


On 04/08/14 at 02:06pm, Thomas Haller wrote:
> By failing inside of nl_socket_alloc(), the user can not even work around
> when running out of local ports. This patch changes that if there are no more
> local ports, we set the port to UINT32_MAX. This is a consistent behavior
> to calling nl_socket_set_local_port(sk, 0).
> 
> In general, since nl_socket_set_local_port() does not restict the generated
> ports in any way and we cannot assume to have a valid port. So the check in
> the constructor was harmful and users who ever encountered it (because they
> created 1024 libnl3 sockets) could not even work around it.
> 
> Signed-off-by: Thomas Haller <thaller at redhat.com>

Agreed

Acked-by: Thomas Graf <tgraf at suug.ch>



More information about the libnl mailing list