public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* sunrpc patch that fixes nfs-server initialization timeouts
@ 2013-11-04 10:41 George Prekas
  0 siblings, 0 replies; only message in thread
From: George Prekas @ 2013-11-04 10:41 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 749 bytes --]

This patch fixes the problem that is causing the following error message:

Cannot register service: RPC: Timed out
rpcmisc.c 99 : unable to register

The problem is described here:
http://cygwin.com/ml/cygwin/2004-08/msg00900.html
http://cygwin.com/ml/cygwin/2013-06/msg00304.html

Sunrpc uses an ioctl to get the local IP address of the machine. This is error prone and in case you have more than one network interfaces it will most probably not work. A better alternative would be to use the loopback address (127.0.0.1).

The procedure to apply the patch is the following:
* Download source packages nfs-server and sunrpc.
* Execute use_loopback.sh

--
George Prekas
Dipl. Electrical and Computer Engineer, National Technical University of Athens

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix_compile.patch --]
[-- Type: text/x-diff; name="fix_compile.patch", Size: 505 bytes --]

--- a/etc/portmap.c
+++ b/etc/portmap.c
@@ -52,7 +52,6 @@ static	char sccsid[] = "@(#)portmap.c 1.32 87/08/06 Copyr 1984 Sun Micro";
 
 static callit();
 
-char *malloc();
 int reg_service();
 void reap();
 struct pmaplist *pmaplist;
diff --git a/rpc/xdr.c b/rpc/xdr.c
index e9c8382..f370b10 100644
--- a/rpc/xdr.c
+++ b/rpc/xdr.c
@@ -42,7 +42,6 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
  */
 
 #include <stdio.h>
-char *malloc();
 
 #include <rpc/types.h>
 #include <rpc/xdr.h>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: use_loopback.patch --]
[-- Type: text/x-diff; name="use_loopback.patch", Size: 1209 bytes --]

--- a/rpc/get_myaddress.c
+++ b/rpc/get_myaddress.c
@@ -53,38 +53,7 @@ static char sccsid[] = "@(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro";
 get_myaddress(addr)
 	struct sockaddr_in *addr;
 {
-	int s;
-	char buf[BUFSIZ];
-	struct ifconf ifc;
-	struct ifreq ifreq, *ifr;
-	int len;
-
-	if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-	    perror("get_myaddress: socket");
-	    exit(1);
-	}
-	ifc.ifc_len = sizeof (buf);
-	ifc.ifc_buf = buf;
-	if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) {
-		perror("get_myaddress: ioctl (get interface configuration)");
-		exit(1);
-	}
-	ifr = ifc.ifc_req;
-	for (len = ifc.ifc_len; len; len -= sizeof ifreq) {
-		ifreq = *ifr;
-		if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) {
-			perror("get_myaddress: ioctl");
-			exit(1);
-		}
-		if ((ifreq.ifr_flags & IFF_UP) &&
-		    ifr->ifr_addr.sa_family == AF_INET) {
-			*addr = *((struct sockaddr_in *)&ifr->ifr_addr);
-			addr->sin_port = htons(PMAPPORT);
-			if (0 != addr->sin_addr.s_addr) {
-				break;
-			}
-		}
-		ifr++;
-	}
-	(void) close(s);
+	addr->sin_family = AF_INET;
+	addr->sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+	addr->sin_port = htons(PMAPPORT);
 }

[-- Attachment #4: use_loopback.sh --]
[-- Type: application/x-sh, Size: 221 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-04 10:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 10:41 sunrpc patch that fixes nfs-server initialization timeouts George Prekas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).