Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFS client fails with System.IO.EndOfStreamException #285

Open
Rainmaker52 opened this issue Jun 21, 2023 · 3 comments
Open

NFS client fails with System.IO.EndOfStreamException #285

Rainmaker52 opened this issue Jun 21, 2023 · 3 comments

Comments

@Rainmaker52
Copy link

Rainmaker52 commented Jun 21, 2023

Hi,

I'm trying to use the NFS client implementation. I'm trying to connect from a Windows 11 client to a Rocky Linux 9 server. I've also tested with a RHEL8 server, with the same result.

Commands like showmount are indicating the share is exported and reachable.

When trying to run the bear minimum:

        string nfsServer = "rhel8.mshome.net";
        _ = NfsFileSystem.GetExports(nfsServer);

I receive a the following stacktrace:


Unhandled exception: System.IO.EndOfStreamException: Unable to complete read of 4 bytes
   at DiscUtils.Streams.StreamUtilities.ReadExact(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
   at DiscUtils.Streams.DataReader.ReadToBuffer(Int32 count)
   at DiscUtils.Streams.BigEndianDataReader.ReadUInt32()
   at DiscUtils.Nfs.PortMap2.GetPort(Int32 program, Int32 version, PortMap2Protocol protocol)
   at DiscUtils.Nfs.RpcClient.GetTransport(Int32 program, Int32 version)
   at DiscUtils.Nfs.RpcProgram.DoSend(MemoryStream ms)
   at DiscUtils.Nfs.Nfs3Mount.Exports()
   at DiscUtils.Nfs.NfsFileSystem.GetExports(String address)+MoveNext()
   at Program.MainAsync in C:\Users\Rainmaker\source\repos\NFSClient\NFSClient\Program.cs:line 86

I've installed DiscUtils.Complete (and .Transport, and .NFS for good measure). I've tried to use the SetupHelper.SetupTransports(), but this does not help.

In examples on the internet I saw RpcClient being created separately and then passed to the constructor of NFS3Client. However, all of these classes seem to have been marked internal now and the only (obvious) public class I could find is NfsFileSystem.

However, this does mean I'm not 100% confident I'm using the library correctly. If I'm using it wrong, please let me know.

NFSClient.pcapng.gz

I've attached a packet trace in case you need it.

@GuerinVII
Copy link

GuerinVII commented Feb 6, 2024

The correction is
return (int)port.Port;
instead of
return (int)reply.BodyReader.ReadUInt32();

in PortMap2.cs line 62

Can someone update this or is it abandonware ?

@LTRData
Copy link

LTRData commented Feb 6, 2024

This repo is pretty much abandoned. I am working on a fork with lots of updated and modernized code over at https://github.com/LTRData/DiscUtils

You are welcome to post the issue there, I'll take a look at it!

LTRData added a commit to LTRData/DiscUtils that referenced this issue Feb 6, 2024
@LTRData
Copy link

LTRData commented Feb 7, 2024

Just pushed new NuGet packages with this fix. LTRData.DiscUtils.* with version number 1.0.38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants