summaryrefslogtreecommitdiffstats
path: root/src/net/oncrpc
diff options
context:
space:
mode:
authorMarin Hannache2013-07-18 14:35:30 +0200
committerMichael Brown2013-08-06 16:58:35 +0200
commit53c01d6444d9e7d5b420c65e9486e990960aba45 (patch)
tree73f946e95845043ad1814ce91fc8a16acdfd26b0 /src/net/oncrpc
parent[tcpip] Allow binding to unspecified privileged ports (below 1024) (diff)
downloadipxe-53c01d6444d9e7d5b420c65e9486e990960aba45.tar.gz
ipxe-53c01d6444d9e7d5b420c65e9486e990960aba45.tar.xz
ipxe-53c01d6444d9e7d5b420c65e9486e990960aba45.zip
[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>
Diffstat (limited to 'src/net/oncrpc')
-rw-r--r--src/net/oncrpc/nfs_open.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/net/oncrpc/nfs_open.c b/src/net/oncrpc/nfs_open.c
index ff2b7404..349957ff 100644
--- a/src/net/oncrpc/nfs_open.c
+++ b/src/net/oncrpc/nfs_open.c
@@ -160,12 +160,12 @@ static int nfs_connect ( struct interface *intf, uint16_t port,
return -EINVAL;
memset ( &peer, 0, sizeof ( peer ) );
- memset ( &peer, 0, sizeof ( local ) );
+ memset ( &local, 0, sizeof ( local ) );
peer.st_port = htons ( port );
/* Use a local port < 1024 to avoid using the 'insecure' option in
* /etc/exports file. */
- local.st_port = htons ( 1 + ( rand() % 1023 ) );
+ local.st_flags = TCPIP_BIND_PRIVILEGED;
return xfer_open_named_socket ( intf, SOCK_STREAM,
( struct sockaddr * ) &peer, hostname,