[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NFS-trouble



Hi!

I'm not sure if I posted my fix for nfs-0.50 here before, so here it is
anyway.  Without it, you cannot mount a remote machine's filesystem on
the MiNT machine.  Apply this message using patch, and recompile
mount.

BTW, I have never really had much luck using MiNT's NFS anyway, despite
these fixes...

Have fun,

--Charles

--- nfs-050/mount/nfsmnt.c.orig	Sat Jul  9 18:36:52 1994
+++ nfs-050/mount/nfsmnt.c	Mon Jun 17 02:26:18 1996
@@ -104,12 +104,41 @@
 
 
 
+/* bindresvport() copied from nfs-050/xfs/sock_ipc.c  --cpbs */
+
+long
+bindresvport(int s)
+{
+#define EADDRINUSE	(-310)
+	struct sockaddr_in sin;
+	short port;
+	long r;
+
+	sin.sin_family = AF_INET;
+	sin.sin_addr.s_addr = htonl(INADDR_ANY);
+	for (port = IPPORT_RESERVED-1; port > IPPORT_RESERVED/2; --port)
+	{
+		sin.sin_port = htons(port);
+		r = bind(s, (struct sockaddr *)&sin, sizeof(sin));
+		if (r == 0)
+			return 0;
+
+		if (r < 0 && (-errno) != EADDRINUSE)
+			return r;
+	}
+	return EADDRINUSE;
+}
+
+
+
 static int
 make_socket(long maxmsgsize)
 {
 	long res;
 	int fd;
+#if 0
 	struct sockaddr_in sin;
+#endif
 
 	fd = socket(PF_INET, SOCK_DGRAM, 0);
 	if (fd < 0)
@@ -127,11 +156,15 @@
 	}
 #endif
 
+#if 0
 	sin.sin_family = AF_INET;
 	sin.sin_addr.s_addr = htonl(INADDR_ANY);
 	sin.sin_port = htons(0);
 
 	res = bind(fd, (struct sockaddr*)&sin, sizeof(sin));
+#else
+	res = bindresvport(fd);
+#endif
 	if (res < 0)
 	{
 		fprintf(stderr, "open_connection: bind() failed with %d\n", -errno);

---end of patch