Browse Source

[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>
tags/v1.20.1
Marin Hannache 11 years ago
parent
commit
53c01d6444
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/net/oncrpc/nfs_open.c

+ 2
- 2
src/net/oncrpc/nfs_open.c View File

@@ -160,12 +160,12 @@ static int nfs_connect ( struct interface *intf, uint16_t port,
160 160
 		return -EINVAL;
161 161
 
162 162
 	memset ( &peer, 0, sizeof ( peer ) );
163
-	memset ( &peer, 0, sizeof ( local ) );
163
+	memset ( &local, 0, sizeof ( local ) );
164 164
 	peer.st_port = htons ( port );
165 165
 
166 166
 	/* Use a local port < 1024 to avoid using the 'insecure' option in
167 167
 	 * /etc/exports file. */
168
-	local.st_port = htons ( 1 + ( rand() % 1023 ) );
168
+	local.st_flags = TCPIP_BIND_PRIVILEGED;
169 169
 
170 170
 	return xfer_open_named_socket ( intf, SOCK_STREAM,
171 171
 	                                ( struct sockaddr * ) &peer, hostname,

Loading…
Cancel
Save