CFR/CFT: IPv6 patch for quota (PR 42004)

Don Lewis truckman at FreeBSD.org
Sun Aug 12 13:31:57 PDT 2007


PR 42004, which has been open for nearly five years, includes the patch
below to add IPv6 support to /usr/bin/quota.  This patch applies cleanly
and compiles without error, but I'm unable to test it because I use
neither IPv6 nor disk quotas over NFS.

If someone who uses IPv6 and quotas over NFS can test this patch, then
we could commit this change and close the PR.

--- usr.bin/quota/quota.c.1.18	Fri Aug  9 06:36:48 2002
+++ usr.bin/quota/quota.c	Sun Aug 25 17:43:36 2002
@@ -665,26 +665,20 @@
 callaurpc(char *host, int prognum, int versnum, int procnum,
     xdrproc_t inproc, char *in, xdrproc_t outproc, char *out)
 {
-	struct sockaddr_in server_addr;
 	enum clnt_stat clnt_stat;
-	struct hostent *hp;
 	struct timeval timeout, tottimeout;
  
-	CLIENT *client = NULL;
-	int sock = RPC_ANYSOCK;
+	CLIENT *client;
  
-	if ((hp = gethostbyname(host)) == NULL)
-		return ((int) RPC_UNKNOWNHOST);
+	/* XXX - If clnt_call fails, we should try other addresses and AF_ */
+	client = clnt_create(host, prognum, versnum, "udp");
+	if (client == NULL)
+		return ((int) rpc_createerr.cf_stat);
+
 	timeout.tv_usec = 0;
 	timeout.tv_sec = 6;
-	bcopy(hp->h_addr, &server_addr.sin_addr,
-			MIN(hp->h_length,(int)sizeof(server_addr.sin_addr)));
-	server_addr.sin_family = AF_INET;
-	server_addr.sin_port =  0;
-
-	if ((client = clntudp_create(&server_addr, prognum,
-	    versnum, timeout, &sock)) == NULL)
-		return ((int) rpc_createerr.cf_stat);
+	(void) CLNT_CONTROL(client,
+			CLSET_RETRY_TIMEOUT, (char *)(void *)&timeout);
 
 	client->cl_auth = authunix_create_default();
 	tottimeout.tv_sec = 25;



More information about the freebsd-current mailing list