]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[nfs] Fix an issue with the selection of a local port
authorMarin Hannache <git@mareo.fr>
Thu, 18 Jul 2013 12:35:30 +0000 (14:35 +0200)
committerMichael Brown <mcb30@ipxe.org>
Tue, 6 Aug 2013 14:58:35 +0000 (15:58 +0100)
Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/oncrpc/nfs_open.c

index ff2b7404add7e3f288ba974059f2e7d6b87d0eaa..349957ffebd583b9689c4f5242b3f7a65e6a6eff 100644 (file)
@@ -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,