lib/socket: in nl_socket_set_fd() always reset the local port

Even if the local port of @sk already equals to the port of
the file descriptor @fd, we want to release a possibly generated
port and set NL_OWN_PORT.

Fixes: 2d61e89037
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller 2015-08-14 18:12:25 +02:00
parent ffe58f3203
commit fa47237cf5

View File

@ -686,12 +686,7 @@ no_so_protocol:
so_protocol = protocol;
}
if (sk->s_local.nl_pid != local.nl_pid) {
/* the port id differs. The socket is using a port id not managed by
* libnl, hence reset the local port id to release a possibly generated
* port. */
nl_socket_set_local_port (sk, local.nl_pid);
}
nl_socket_set_local_port (sk, local.nl_pid);
sk->s_local = local;
sk->s_fd = fd;
sk->s_proto = so_protocol;