mirror of https://github.com/ipxe/ipxe.git
[nfs] Fix an issue with the selection of a local port
Reported-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Marin Hannache <git@mareo.fr> Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/598/head
parent
252d28f098
commit
53c01d6444
|
@ -160,12 +160,12 @@ static int nfs_connect ( struct interface *intf, uint16_t port,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
memset ( &peer, 0, sizeof ( peer ) );
|
memset ( &peer, 0, sizeof ( peer ) );
|
||||||
memset ( &peer, 0, sizeof ( local ) );
|
memset ( &local, 0, sizeof ( local ) );
|
||||||
peer.st_port = htons ( port );
|
peer.st_port = htons ( port );
|
||||||
|
|
||||||
/* Use a local port < 1024 to avoid using the 'insecure' option in
|
/* Use a local port < 1024 to avoid using the 'insecure' option in
|
||||||
* /etc/exports file. */
|
* /etc/exports file. */
|
||||||
local.st_port = htons ( 1 + ( rand() % 1023 ) );
|
local.st_flags = TCPIP_BIND_PRIVILEGED;
|
||||||
|
|
||||||
return xfer_open_named_socket ( intf, SOCK_STREAM,
|
return xfer_open_named_socket ( intf, SOCK_STREAM,
|
||||||
( struct sockaddr * ) &peer, hostname,
|
( struct sockaddr * ) &peer, hostname,
|
||||||
|
|
Loading…
Reference in New Issue