Sébastien Szymanski d2986567b2 net: nfs: fix file handle length in NFSv3
The NFS protocol uses file handles to refer to file or directory.
In NFSv2 file handles have a fixed size of 32 bytes.
In NFSv3 file handles have a variable length up to 64 bytes. This is
also true for the MOUNT protocol. [1]
When the NFSv3 server replies with a file handle length > 32 bytes, U-Boot
only copies 32 bytes of that file handle and the next LOOKUP Call fails:

BIOS> nfs ${loadaddr} 192.168.1.51:/nfsroot/opos93dev-br/boot/Image
Using ethernet@428a0000 device
File transfer via NFS from server 192.168.1.51; our IP address is 192.168.1.133
Filename '/nfsroot/opos93dev-br/boot/Image'.
Load address: 0x80400000
Loading: *** ERROR: File lookup fail

done
BIOS>

Looking at this transfer in Wireshark, we can see that the server
replies with the following file handle:

    length: 36
    [hash (CRC-32): 0x230ac67b]
    FileHandle: 0100070101005e000000000091763911f87c449fa73c298552db19ba0c9f60002980cfd2

and U-Boot sends the following file handle in the next LOOKUP Call:

    length: 32
    [hash (CRC-32): 0x6314131b]
    FileHandle: 000000240100070101005e000000000091763911f87c449fa73c298552db19ba

Fix this by using a variable length file handle for dirfh.

[1] https://www.rfc-editor.org/rfc/rfc1813.html#page-106

Fixes: b0baca982048 ("net: NFS: Add NFSv3 support")
Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Tested-by: Andrew Davis <afd@ti.com>
2024-04-10 09:34:53 -06:00
..
2023-12-21 08:54:37 -05:00
2023-06-14 15:48:45 -04:00
2020-06-12 13:17:23 -04:00
2022-12-07 16:04:17 -05:00
2024-01-09 14:58:33 +01:00
2024-01-03 09:22:47 -05:00
2023-12-21 08:54:37 -05:00
2023-12-21 08:54:37 -05:00
2023-11-05 16:11:38 -05:00
2019-09-04 11:37:19 -05:00
2022-12-05 12:47:16 -05:00
2023-12-21 08:54:37 -05:00
2020-09-30 16:55:03 -04:00
2024-01-03 09:22:47 -05:00
2018-07-02 14:14:20 -05:00