diff -Nru nfs-utils-1.0.6-23/support/export/client.c nfs-utils-1.0.6-23-gq-02/support/export/client.c
--- nfs-utils-1.0.6-23/support/export/client.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/support/export/client.c	2005-02-17 10:18:08.542715000 +0100
@@ -13,6 +13,7 @@
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <netdb.h>
 #include "xmalloc.h"
 #include "misc.h"
@@ -27,7 +28,7 @@
 #endif
 static void	client_init(nfs_client *clp, const char *hname,
 					struct hostent *hp);
-static int	client_checkaddr(nfs_client *clp, struct in_addr addr);
+static int	client_checkaddr(nfs_client *clp, struct in6_addr addr);
 
 nfs_client	*clientlist[MCL_MAXTYPES] = { NULL, };
 
@@ -46,13 +47,26 @@
 	htype = client_gettype(hname);
 
 	if (htype == MCL_FQDN && !canonical) {
-		struct hostent *hp2;
-		hp = gethostbyname(hname);
-		if (hp == NULL || hp->h_addrtype != AF_INET) {
+		struct in6_addr addr;
+		struct hostent *hp2, *hp3;
+		
+		if (inet_pton(AF_INET6, hname, &addr) > 0) {
+			hp = gethostbyaddr(&addr, sizeof(addr), AF_INET6);
+		}
+		else if (inet_pton(AF_INET, hname, &addr.s6_addr32[3]) > 0) {
+			addr.s6_addr32[0] = 0;
+			addr.s6_addr32[1] = 0;
+			addr.s6_addr32[2] = htonl(0xffff);
+			hp = gethostbyaddr(&addr, sizeof(addr), AF_INET6);
+	    	}
+	    	else {
+			hp = gethostbyname(hname);
+		}
+
+		if (hp == NULL || hp->h_addrtype != AF_INET6) {
 			xlog(L_ERROR, "%s has non-inet addr", hname);
 			return NULL;
 		}
-		/* make sure we have canonical name */
 		hp2 = hostent_dup(hp);
 		hp = gethostbyaddr(hp2->h_addr, hp2->h_length,
 				   hp2->h_addrtype);
@@ -71,7 +85,7 @@
 		} else
 			hp = hp2;
 
-		hname = (char *) hp->h_name;
+		hname = hp->h_name;
 
 		for (clp = clientlist[htype]; clp; clp = clp->m_next) {
 			if (client_check(clp, hp))
@@ -97,7 +111,7 @@
 		int	i;
 
 		for (i = 0; *ap && i < NFSCLNT_ADDRMAX; i++, ap++)
-			clp->m_addrlist[i] = *(struct in_addr *)*ap;
+			clp->m_addrlist[i] = *(struct in6_addr *)*ap;
 		clp->m_naddr = i;
 	}
 
@@ -138,22 +152,49 @@
 
 	if (clp->m_type == MCL_SUBNETWORK) {
 		char	*cp = strchr(clp->m_hostname, '/');
+		int	netmask = 0;
 
 		*cp = '\0';
-		clp->m_addrlist[0].s_addr = inet_addr(clp->m_hostname);
-		if (strchr(cp + 1, '.')) {
-			clp->m_addrlist[1].s_addr = inet_addr(cp+1);
-		}
-		else {
-			int netmask = atoi(cp + 1);
-			if (0 < netmask && netmask <= 32) {
-				clp->m_addrlist[1].s_addr =
-					htonl ((uint32_t) ~0 << (32 - netmask));
+		if (inet_pton(AF_INET6, clp->m_hostname, &clp->m_addrlist[0]) > 0) {
+			/* IPv6 address: format 3ffe:501:ffff:100::/64 */
+			netmask = atoi(cp + 1);
+        	}
+		else if (inet_pton(AF_INET, clp->m_hostname,
+			    &clp->m_addrlist[0].s6_addr32[3]) > 0) {
+			/* IPv4 address: format 172.16.109.0/255.255.255.0
+			 *                   or 172.16.109.0/24 */
+			clp->m_addrlist[0].s6_addr32[0] = 0;
+			clp->m_addrlist[0].s6_addr32[1] = 0;
+			clp->m_addrlist[0].s6_addr32[2] = htonl(0xffff);
+			if (strchr(cp + 1, '.')) {
+				int byte, bit;
+				unsigned char addr[8];
+				if (!inet_pton(AF_INET, cp + 1, addr))
+					xlog(L_FATAL, "invalid netmask `%s' for %s",
+						cp + 1, clp->m_hostname);
+				for (byte = 0; byte < 4; byte++, netmask += 8)
+					if (addr[byte] != 0xff)
+						break;
+				if (byte < 4) {
+					for (bit = 7; bit != 0; bit--, netmask++)
+						if (!(addr[byte] & (1 << bit)))
+							break;
+				}
 			}
 			else {
-				xlog(L_FATAL, "invalid netmask `%s' for %s",
-				     cp + 1, clp->m_hostname);
-			}
+	    			netmask = atoi(cp + 1);
+	    			if (0 < netmask && netmask <= 32) {
+	    				clp->m_addrlist[1].s6_addr32[3] =
+	    					htonl ((uint32_t) ~0 << (32 - netmask));
+	    			}
+	    			else {
+	    				xlog(L_FATAL, "invalid netmask `%s' for %s",
+	    				     	cp + 1, clp->m_hostname);
+	    			}
+	    		}
+        	}
+	    	if (0 < netmask && netmask <= 128) {
+			clp->m_addr_preflen = netmask;
 		}
 		*cp = '/';
 		clp->m_naddr = 0;
@@ -164,9 +205,10 @@
 		int	i;
 
 		for (i = 0; *ap && i < NFSCLNT_ADDRMAX; i++, ap++) {
-			clp->m_addrlist[i] = *(struct in_addr *)*ap;
+			clp->m_addrlist[i] = *(struct in6_addr *)*ap;
 		}
 		clp->m_naddr = i;
+		clp->m_addr_preflen = 0;
 	}
 }
 
@@ -238,16 +280,16 @@
 static char *add_name(char *old, char *add);
 
 char *
-client_compose(struct in_addr addr)
+client_compose(struct in6_addr *addr)
 {
 	struct hostent *he = NULL;
 	char *name = NULL;
 	int i;
 
 	if (clientlist[MCL_WILDCARD] || clientlist[MCL_NETGROUP])
-		he = get_reliable_hostbyaddr((const char*)&addr, sizeof(addr), AF_INET);
+		he = get_reliable_hostbyaddr((const char*)addr, sizeof(*addr), AF_INET6);
 	if (he == NULL)
-		he = get_hostent((const char*)&addr, sizeof(addr), AF_INET);
+		he = get_hostent((const char*)addr, sizeof(*addr), AF_INET6);
 
 	for (i = 0 ; i < MCL_MAXTYPES; i++) {
 		nfs_client	*clp;
@@ -342,7 +384,7 @@
 	case MCL_FQDN:
 	case MCL_SUBNETWORK:
 		for (ap = hp->h_addr_list; *ap; ap++) {
-			if (client_checkaddr(clp, *(struct in_addr *) *ap))
+			if (client_checkaddr(clp, *(struct in6_addr *) *ap))
 				return 1;
 		}
 		return 0;
@@ -361,7 +403,7 @@
 			char	*dot;
 			int	match;
 			struct hostent *nhp = NULL;
-			struct sockaddr_in addr;
+			struct sockaddr_in6 addr;
 
 			/* First, try to match the hostname without
 			 * splitting off the domain */
@@ -369,9 +411,9 @@
 				return 1;
 
 			/* If hname is ip address convert to FQDN */
-			if (inet_aton(hname, &addr.sin_addr) &&
-			   (nhp = gethostbyaddr((const char *)&(addr.sin_addr),
-			    sizeof(addr.sin_addr), AF_INET))) {
+			if (inet_pton(AF_INET6, hname, (void *)&addr.sin6_addr) &&
+			   (nhp = gethostbyaddr((const char *)&(addr.sin6_addr),
+			    sizeof(addr.sin6_addr), AF_INET6))) {
 				hname = (char *)nhp->h_name;
 				if (innetgr(cname+1, hname, NULL, NULL))
 					return 1;
@@ -402,20 +444,21 @@
 }
 
 static int
-client_checkaddr(nfs_client *clp, struct in_addr addr)
+client_checkaddr(nfs_client *clp, struct in6_addr addr)
 {
 	int	i;
 
 	switch (clp->m_type) {
 	case MCL_FQDN:
 		for (i = 0; i < clp->m_naddr; i++) {
-			if (clp->m_addrlist[i].s_addr == addr.s_addr)
+			if (memcmp(&clp->m_addrlist[i], &addr, sizeof(addr)))
 				return 1;
 		}
 		return 0;
 	case MCL_SUBNETWORK:
-		return !((clp->m_addrlist[0].s_addr ^ addr.s_addr)
-			& clp->m_addrlist[1].s_addr);
+		if (memcmp(&clp->m_addrlist[0], &addr, clp->m_addr_preflen))
+			return 1;
+		return 0;
 	}
 	return 0;
 }
diff -Nru nfs-utils-1.0.6-23/support/export/hostname.c nfs-utils-1.0.6-23-gq-02/support/export/hostname.c
--- nfs-utils-1.0.6-23/support/export/hostname.c	2003-09-12 07:41:32.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/support/export/hostname.c	2005-02-17 10:18:08.542715000 +0100
@@ -42,6 +42,7 @@
   struct hostent *cp;
   int len_ent;
   const char *name;
+  char buf[40];
   int len_name;
   int num_aliases = 1;
   int len_aliases = sizeof (char *);
@@ -56,6 +57,11 @@
       ipv4 = (struct in_addr *) addr;
       name = inet_ntoa (*ipv4);
       break;
+    
+    case AF_INET6:
+      inet_ntop(AF_INET6,(void *) addr, buf, sizeof(buf));
+      name = buf;
+      break;
 
     default:
       return NULL;
@@ -252,14 +258,20 @@
 		}
 		else {
 			/* it was a FAKE */
-			xlog (L_WARNING, "Fake hostname %s for %s - forward lookup doesn't match reverse",
+		  char buf[40];
+		  /*
+		  xlog (L_WARNING, "Fake hostname %s for %s - forward lookup doesn't match reverse",
 			      reverse->h_name, inet_ntoa(*(struct in_addr*)addr));
+		  */
+		  if (inet_ntop(AF_INET6, (void *) addr, buf, sizeof(buf)))
+		  xlog (L_WARNING, "Fake hostname %s for %s - forward lookup doesn't match reverse", reverse->h_name, buf);
 		}
 	}
 	else {
-		/* never heard of it. misconfigured DNS? */
-		xlog (L_WARNING, "Fake hostname %s for %s - forward lookup doesn't exist",
-		      reverse->h_name, inet_ntoa(*(struct in_addr*)addr));
+	  /* never heard of it. misconfigured DNS? */
+	  char buf[40];
+	  if (inet_ntop(AF_INET6, (void *) addr, buf, sizeof(buf)))
+	  xlog (L_WARNING, "Fake hostname %s for %s - forward lookup doesn't exist", reverse->h_name,buf );
 	}
 
 	free (reverse);
@@ -280,8 +292,11 @@
       for (sp = hp->h_aliases; *sp; sp++)
 	printf ("  %s\n", *sp);
       printf ("IP addresses:\n");
-      for (sp = hp->h_addr_list; *sp; sp++)
-	printf ("  %s\n", inet_ntoa (*(struct in_addr *) *sp));
+      for (sp = hp->h_addr_list; *sp; sp++) {
+	char toprint[40];
+        if (inet_ntop(AF_INET6, (void *)sp, toprint, sizeof(toprint)))
+	  printf ("  %s\n", toprint);
+      }
     }
   else
     printf ("Not host information\n");
@@ -292,7 +307,8 @@
 {
   struct hostent *hp = gethostbyname (argv [1]);
   struct hostent *cp;
-  struct in_addr addr;
+  struct in6_addr addr;
+  char toprint[40];
 
   print_host (hp);
 
@@ -304,9 +320,19 @@
     }
   printf ("127.0.0.1 == %s: %d\n", argv [1],
 	  matchhostname ("127.0.0.1", argv [1]));
-  addr.s_addr = inet_addr(argv [2]);
-  printf ("%s\n", inet_ntoa (addr));
-  cp = get_hostent ((const char *)&addr, sizeof(addr), AF_INET);
+ 
+  if (inet_pton(AF_INET, argv[2], (void *)&addr.s6_addr32[3]) > 0) {
+    addr.s6_addr32[0] = 0;
+    addr.s6_addr32[1] = 0;
+    addr.s6_addr32[2] = htonl(0xffff);
+  }
+  else if (inet_pton(AF_INET6, argv[2], (void *)&addr.s6_addr32[0]) <= 0) {
+    printf ("bad addressn\n");
+  }
+  inet_ntop(AF_INET6, (void *)&addr, toprint, sizeof(toprint));
+  printf ("%s\n", toprint);
+
+  cp = get_hostent ((const char *)&addr, sizeof(addr), AF_INET6);
   print_host (cp);
   return 0;
 }
diff -Nru nfs-utils-1.0.6-23/support/export/nfsctl.c nfs-utils-1.0.6-23-gq-02/support/export/nfsctl.c
--- nfs-utils-1.0.6-23/support/export/nfsctl.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/support/export/nfsctl.c	2005-02-17 10:18:08.543715000 +0100
@@ -76,7 +76,8 @@
 	str_tolower(cltarg->cl_ident);
 	cltarg->cl_naddr = clp->m_naddr;
 	for (i = 0; i < cltarg->cl_naddr && i < NFSCLNT_ADDRMAX; i++)
-		cltarg->cl_addrlist[i] = clp->m_addrlist[i];
+		memcpy(&cltarg->cl_addrlist[i], &clp->m_addrlist[i],
+			sizeof(struct in6_addr));
 
 	return 1;
 }
diff -Nru nfs-utils-1.0.6-23/support/include/exportfs.h nfs-utils-1.0.6-23-gq-02/support/include/exportfs.h
--- nfs-utils-1.0.6-23/support/include/exportfs.h	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/support/include/exportfs.h	2005-02-17 10:18:08.543715000 +0100
@@ -28,7 +28,9 @@
 	char			m_hostname[NFSCLNT_IDMAX+1];
 	int			m_type;
 	int			m_naddr;
-	struct in_addr		m_addrlist[NFSCLNT_ADDRMAX];
+	struct in6_addr		m_addrlist[NFSCLNT_ADDRMAX];
+	int			m_addr_preflen;	/* prefix length for
+						   subnet address */
 	int			m_exported;	/* exported to nfsd */
 	int			m_count;
 } nfs_client;
@@ -55,7 +57,7 @@
 int				client_match(nfs_client *, char *hname);
 void				client_release(nfs_client *);
 void				client_freeall(void);
-char *				client_compose(struct in_addr addr);
+char *				client_compose(struct in6_addr *addr);
 int 				client_member(char *client, char *name);
 
 int				export_read(char *fname);
diff -Nru nfs-utils-1.0.6-23/support/include/nfs/nfs.h nfs-utils-1.0.6-23-gq-02/support/include/nfs/nfs.h
--- nfs-utils-1.0.6-23/support/include/nfs/nfs.h	2003-07-03 04:07:25.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/support/include/nfs/nfs.h	2005-02-17 10:18:08.543715000 +0100
@@ -93,7 +93,7 @@
 
 /* GETFH */
 struct nfsctl_fhparm {
-	struct sockaddr		gf_addr;
+	struct sockaddr_storage	gf_addr;
 	__nfsd_dev_t		gf_dev;
 	__kernel_ino_t		gf_ino;
 	int			gf_version;
@@ -101,14 +101,14 @@
 
 /* GETFD */
 struct nfsctl_fdparm {
-	struct sockaddr		gd_addr;
+	struct sockaddr_storage	gd_addr;
 	char			gd_path[NFS_MAXPATHLEN+1];
 	int			gd_version;
 };
 
 /* GETFS - GET Filehandle with Size */
 struct nfsctl_fsparm {
-	struct sockaddr		gd_addr;
+	struct sockaddr_storage	gd_addr;
 	char			gd_path[NFS_MAXPATHLEN+1];
 	int			gd_maxlen;
 };
diff -Nru nfs-utils-1.0.6-23/support/include/tcpwrapper.h nfs-utils-1.0.6-23-gq-02/support/include/tcpwrapper.h
--- nfs-utils-1.0.6-23/support/include/tcpwrapper.h	2000-08-26 01:10:47.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/support/include/tcpwrapper.h	2005-02-17 10:18:08.544714000 +0100
@@ -10,9 +10,9 @@
 extern int allow_severity;
 extern int deny_severity;
 
-extern int good_client(char *daemon, struct sockaddr_in *addr);
-extern int from_local (struct sockaddr_in *addr);
-extern int check_default(char *daemon, struct sockaddr_in *addr,
+extern int good_client(char *daemon, struct sockaddr_in6 *addr);
+extern int from_local (struct sockaddr_in6 *addr);
+extern int check_default(char *daemon, struct sockaddr_in6 *addr,
 			 u_long proc, u_long prog);
 
 #endif /* TCP_WRAPPER_H */
diff -Nru nfs-utils-1.0.6-23/support/misc/from_local.c nfs-utils-1.0.6-23-gq-02/support/misc/from_local.c
--- nfs-utils-1.0.6-23/support/misc/from_local.c	2000-08-26 01:10:51.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/support/misc/from_local.c	2005-02-17 10:18:08.544714000 +0100
@@ -35,16 +35,13 @@
  * Mountain View, California  94043
  */
 
-#ifndef lint
-static char sccsid[] = "@(#) from_local.c 1.3 96/05/31 15:52:57";
-#endif
-
 #ifdef TEST
 #undef perror
 #endif
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <arpa/inet.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <netdb.h>
@@ -67,13 +64,13 @@
   */
 static int num_local;
 static int num_addrs;
-static struct in_addr *addrs;
+static struct in6_addr *addrs;
 
 /* grow_addrs - extend list of local interface addresses */
 
 static int grow_addrs()
 {
-    struct in_addr *new_addrs;
+    struct in6_addr *new_addrs;
     int     new_num;
 
     /*
@@ -81,7 +78,7 @@
      * really get hosed if we simply give up.
      */
     new_num = (addrs == 0) ? 1 : num_addrs + num_addrs;
-    new_addrs = (struct in_addr *) malloc(sizeof(*addrs) * new_num);
+    new_addrs = (struct in6_addr *) malloc(sizeof(*addrs) * new_num);
     if (new_addrs == 0) {
 	perror("portmap: out of memory");
 	return (0);
@@ -97,7 +94,7 @@
     }
 }
 
-/* find_local - find all IP addresses for this host */
+/* find_local - find all IPv4 addresses for this host */
 static int
 find_local()
 {
@@ -105,8 +102,10 @@
     struct ifreq ifreq;
     struct ifreq *ifr;
     struct ifreq *the_end;
+    struct in6_addr addr6;
     int     sock;
     char    buf[BUFSIZ];
+    FILE   *f;
 
     /*
      * Get list of network interfaces. We use a huge buffer to allow for the
@@ -124,8 +123,10 @@
 	(void) close(sock);
 	return (0);
     }
-    /* Get IP address of each active IP network interface. */
 
+    /* Get IPv4 address of each active IP network interface. */
+    addr6.s6_addr32[0] = addr6.s6_addr32[1] = 0;
+    addr6.s6_addr32[2] = htonl(0xffff);
     the_end = (struct ifreq *) (ifc.ifc_buf + ifc.ifc_len);
     num_local = 0;
     for (ifr = ifc.ifc_req; ifr < the_end; ifr++) {
@@ -140,11 +141,13 @@
 		    if (num_local >= num_addrs)
 			if (grow_addrs() == 0)
 			    break;
-		    addrs[num_local++] = ((struct sockaddr_in *)
-					  & ifreq.ifr_addr)->sin_addr;
+		    addr6.s6_addr32[3] = *(uint32_t *)&(((struct sockaddr_in *)
+					  & ifreq.ifr_addr)->sin_addr);
+		    addrs[num_local++] = addr6;
 		}
 	    }
 	}
+
 	/* Support for variable-length addresses. */
 #ifdef HAS_SA_LEN
 	ifr = (struct ifreq *) ((caddr_t) ifr
@@ -152,13 +155,35 @@
 #endif
     }
     (void) close(sock);
+
+    /* Get IPv6 addresses from /proc/net/if_inet6 file. */
+#define _PATH_PROCNET_IFINET6               "/proc/net/if_inet6"
+    if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) {
+	int if_idx, plen, scope, dad_status;
+	char addr6p[8][5];
+	char addr[40], devname[20];
+
+	while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
+			addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+			addr6p[4], addr6p[5], addr6p[6], addr6p[7],
+			&if_idx, &plen, &scope, &dad_status, devname) != EOF) {
+	    sprintf(addr, "%s:%s:%s:%s:%s:%s:%s:%s",
+		 	  addr6p[0], addr6p[1], addr6p[2], addr6p[3],
+			  addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
+	    if (num_local >= num_addrs)
+		if (grow_addrs() == 0)
+		    break;
+	    inet_pton(AF_INET6, (char *)addr, (void *)&addrs[num_local++]);
+	}
+	fclose(f);
+    }
     return (num_local);
 }
 
 /* from_local - determine whether request comes from the local system */
 int
 from_local(addr)
-struct sockaddr_in *addr;
+struct sockaddr_in6 *addr;
 {
     int     i;
 
@@ -166,23 +191,29 @@
 	syslog(LOG_ERR, "cannot find any active local network interfaces");
 
     for (i = 0; i < num_local; i++) {
-	if (memcmp((char *) &(addr->sin_addr), (char *) &(addrs[i]),
-		   sizeof(struct in_addr)) == 0)
+	if (memcmp((char *) &(addr->sin6_addr), (char *) &(addrs[i]),
+		   sizeof(struct in6_addr)) == 0)
 	    return (TRUE);
     }
     return (FALSE);
+    
 }
 
 #ifdef TEST
 
 main()
 {
-    char   *inet_ntoa();
     int     i;
-
+    char    str[64];
+   
     find_local();
-    for (i = 0; i < num_local; i++)
-	printf("%s\n", inet_ntoa(addrs[i]));
+    for (i = 0; i < num_local; i++) {
+      if(IN6_IS_ADDR_V4MAPPED(&addrs[i]))
+	inet_ntop(AF_INET, (void *)&addrs[i].s6_addr32[3], str, sizeof(str));
+      else
+	inet_ntop(AF_INET6, (void *)&addrs[i], str, sizeof(str));
+      printf("local address : %s\n", str);
+    }
 }
 
 #endif
diff -Nru nfs-utils-1.0.6-23/support/misc/tcpwrapper.c nfs-utils-1.0.6-23-gq-02/support/misc/tcpwrapper.c
--- nfs-utils-1.0.6-23/support/misc/tcpwrapper.c	2001-11-26 20:57:56.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/support/misc/tcpwrapper.c	2005-02-17 10:18:08.545714000 +0100
@@ -79,19 +79,23 @@
 int
 good_client(daemon, addr)
 char *daemon;
-struct sockaddr_in *addr;
+struct sockaddr_in6 *addr;
 {
     struct hostent *hp;
     char **sp;
     char *tmpname;
 
     /* Check the IP address first. */
-    if (hosts_ctl(daemon, "", inet_ntoa(addr->sin_addr), ""))
+    char str[64];
+      //if (hosts_ctl(daemon, "", inet_ntoa(addr->sin_addr), ""))
+    inet_ntop(addr->sin6_family,(void *)&addr->sin6_addr.s6_addr32[0], str, sizeof(str));
+    
+    if (hosts_ctl(daemon, "", str, ""))
 	return 1;
 
     /* Check the hostname. */
-    hp = gethostbyaddr ((const char *) &(addr->sin_addr),
-			sizeof (addr->sin_addr), AF_INET);
+    hp = gethostbyaddr ((const char *) &(addr->sin6_addr),
+			sizeof (addr->sin6_addr), AF_INET6);
 
     if (!hp)
 	return 0;
@@ -103,7 +107,7 @@
     if (hp) {
 	/* now make sure the "addr->sin_addr" is on the list */
 	for (sp = hp->h_addr_list ; *sp ; sp++) {
-	    if (memcmp(*sp, &(addr->sin_addr), hp->h_length)==0)
+	    if (memcmp(*sp, &(addr->sin6_addr), hp->h_length)==0)
 		break;
 	}
 	if (!*sp)
@@ -170,7 +174,7 @@
 int
 check_default(daemon, addr, proc, prog)
 char *daemon;
-struct sockaddr_in *addr;
+struct sockaddr_in6 *addr;
 u_long  proc;
 u_long  prog;
 {
@@ -186,7 +190,7 @@
 /* check_privileged_port - additional checks for privileged-port updates */
 int
 check_privileged_port(addr, proc, prog, port)
-struct sockaddr_in *addr;
+struct sockaddr_in6 *addr;
 u_long  proc;
 u_long  prog;
 u_long  port;
@@ -213,7 +217,7 @@
 
 static void logit(severity, addr, procnum, prognum, text)
 int     severity;
-struct sockaddr_in *addr;
+struct sockaddr_in6 *addr;
 u_long  procnum;
 u_long  prognum;
 char   *text;
@@ -223,6 +227,7 @@
     char   *progname;
     char    progbuf[16 + 4 * sizeof(u_long)];
     struct rpcent *rpc;
+    char    str[64];
 
     /*
      * Fork off a process or the portmap daemon might hang while
@@ -251,8 +256,9 @@
 
 	/* Write syslog record. */
 
-	syslog(severity, "connect from %s to %s in %s%s",
-	       inet_ntoa(addr->sin_addr), procname, progname, text);
+        inet_ntop(addr->sin6_family,(void *)&addr->sin6_addr.s6_addr32[0], str, sizeof(str));
+        syslog(severity, "connect from %s to %s in %s%s",
+	       str, procname, progname, text);
 	exit(0);
     }
 }
diff -Nru nfs-utils-1.0.6-23/support/nfs/getfh.c nfs-utils-1.0.6-23-gq-02/support/nfs/getfh.c
--- nfs-utils-1.0.6-23/support/nfs/getfh.c	2000-03-21 01:46:17.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/support/nfs/getfh.c	2005-02-17 10:18:08.545714000 +0100
@@ -28,7 +28,7 @@
 	arg.ca_getfh.gf_version = 2;	/* obsolete */
 	arg.ca_getfh.gf_dev = dev;
 	arg.ca_getfh.gf_ino = ino;
-	memcpy(&arg.ca_getfh.gf_addr, addr, sizeof(struct sockaddr_in));
+	memcpy(&arg.ca_getfh.gf_addr, addr, sizeof(struct sockaddr_in6));
 
 	if (nfsctl(NFSCTL_GETFH, &arg, &res) < 0)
 		return NULL;
@@ -50,7 +50,7 @@
         strncpy(arg.ca_getfd.gd_path, path,
 		sizeof(arg.ca_getfd.gd_path) - 1);
 	arg.ca_getfd.gd_path[sizeof (arg.ca_getfd.gd_path) - 1] = '\0';
-        memcpy(&arg.ca_getfd.gd_addr, addr, sizeof(struct sockaddr_in));
+        memcpy(&arg.ca_getfd.gd_addr, addr, sizeof(struct sockaddr_in6));
 
         if (nfsctl(NFSCTL_GETFD, &arg, &res) < 0)
                 return NULL;
@@ -70,7 +70,7 @@
         strncpy(arg.ca_getfs.gd_path, path,
 		sizeof(arg.ca_getfs.gd_path) - 1);
 	arg.ca_getfs.gd_path[sizeof (arg.ca_getfs.gd_path) - 1] = '\0';
-        memcpy(&arg.ca_getfs.gd_addr, addr, sizeof(struct sockaddr_in));
+        memcpy(&arg.ca_getfs.gd_addr, addr, sizeof(struct sockaddr_in6));
 	arg.ca_getfs.gd_maxlen = size;
 
         if (nfsctl(NFSCTL_GETFS, &arg, &res) < 0)
diff -Nru nfs-utils-1.0.6-23/support/nfs/rmtab.c nfs-utils-1.0.6-23-gq-02/support/nfs/rmtab.c
--- nfs-utils-1.0.6-23/support/nfs/rmtab.c	2002-04-09 01:06:03.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/support/nfs/rmtab.c	2005-02-17 10:18:08.545714000 +0100
@@ -67,14 +67,14 @@
 		host = buf;
 		if ((path = strchr(host, '\n')) != NULL)
 			*path = '\0';
-		if (!(path = strchr(host, ':'))) {
+		if (!(path = strchr(host, '|'))) {
 			if (log)
 				xlog(L_ERROR, "malformed entry in rmtab file");
 			errno = EINVAL;
 			return NULL;
 		}
 		*path++ = '\0';
-		count = strchr(path, ':');
+		count = strchr(path, '|');
 		if (count) {
 			*count++ = '\0';
 			re.r_count = strtol (count, NULL, 0);
@@ -100,7 +100,7 @@
 {
 	if (!fp || (pos && fseek (fp, *pos, SEEK_SET) != 0))
 		return;
-	fprintf(fp, "%s:%s:0x%.8x\n", rep->r_client, rep->r_path,
+	fprintf(fp, "%s|%s|0x%.8x\n", rep->r_client, rep->r_path,
 		rep->r_count);
 }
 
diff -Nru nfs-utils-1.0.6-23/support/nfs/rpcmisc.c nfs-utils-1.0.6-23-gq-02/support/nfs/rpcmisc.c
--- nfs-utils-1.0.6-23/support/nfs/rpcmisc.c	2003-02-19 05:25:04.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/support/nfs/rpcmisc.c	2005-02-17 10:18:08.568711000 +0100
@@ -31,7 +31,13 @@
 #include <unistd.h>
 #include <time.h>
 #include "nfslib.h"
+#include <netconfig.h>
 
+/* GQ: only for test
+#define RPCINIT_DEBUG 1
+*/
+
+int	bindport(int fd, int port, int af);
 static void	closedown(int sig);
 int	makesock(int port, int proto);
 
@@ -43,90 +49,215 @@
 void
 rpc_init(char *name, int prog, int vers, void (*dispatch)(), int defport)
 {
-	struct sockaddr_in saddr;
-	SVCXPRT	*transp;
-	int	sock;
-	int	asize;
-
-	asize = sizeof(saddr);
-	sock = 0;
-	if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0
-	    && saddr.sin_family == AF_INET) {
-		int ssize = sizeof (int);
-		_rpcfdtype = 0;
-		if (getsockopt(0, SOL_SOCKET, SO_TYPE,
-				(char *)&_rpcfdtype, &ssize) == -1)
-			xlog(L_FATAL, "getsockopt failed: %s", strerror(errno));
-		_rpcpmstart = 1;
-	} else {
-		pmap_unset(prog, vers);
-		sock = RPC_ANYSOCK;
-	}
+	struct netconfig *udp_nconf, *udp_nconf6, *tcp_nconf, *tcp_nconf6;
+	static SVCXPRT *transp_udp = NULL;
+	static SVCXPRT *transp_tcp = NULL;
+	int fd_udp = -1, fd_tcp = -1;
+
+#ifdef RPCINIT_DEBUG
+	printf("rpc_init: name = %s, prog = %d, vers = %d\n", name, prog, vers);
+#endif /* DEBUG */        
+
+	/* unregister any existing copy of this service */
+	/* XXX if it is possible to bind on the "defport" at the end */
+	svc_unreg(prog,vers);
+	
+        /* Read udp, udp6, tcp and tcp6 in /etc/netconfig */
+	udp_nconf6 = getnetconfigent("udp6");
+        if (udp_nconf6 == (struct netconfig *)NULL) {
+                xlog(L_WARNING, "getnetconfigent %s failed: %s",
+                    "udp6",strerror(errno));
+        }
+        udp_nconf = getnetconfigent("udp");
+        if (udp_nconf == (struct netconfig *)NULL) {
+                xlog(L_WARNING, "getnetconfigent %s failed: %s", "udp",
+                        strerror(errno));
+        }
+        tcp_nconf6 = getnetconfigent("tcp6");
+        if (tcp_nconf6 == (struct netconfig *)NULL) {
+                xlog(L_WARNING, "getnetconfigent %s failed: %s",
+                        "tcp6",strerror(errno));
+        }
+        tcp_nconf = getnetconfigent("tcp");
+        if (tcp_nconf == (struct netconfig *)NULL)
+        {
+                xlog(L_WARNING, "getnetconfigent %s failed: %s"
+		     ,"tcp",strerror(errno));
+        }
+        if (!udp_nconf6 && !udp_nconf && !tcp_nconf && !tcp_nconf6)
+	        xlog(L_FATAL, "getnetconfigent failed for all: %s",
+			strerror(errno)); 
+#ifdef RPCINIT_DEBUG
+	fprintf(stderr,"rpcinit: call getnetconfignet pass\n");
+#endif /* DEBUG */
+	
+ 	/* jump directly to registration step if we already created a socket */
+	if (transp_udp && transp_tcp)
+	        goto udp_register;      
+
+        /* create socket with the good transport (INET or INET6 or INET6+INET) */
+        if (udp_nconf6 != NULL) {
+               if (-1 == (fd_udp = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)))
+			xlog(L_FATAL, "can't open inet6/udp socket");
+               
+        } else if (udp_nconf != NULL) {
+                if (-1 == (fd_udp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)))
+		        xlog(L_FATAL, "can't open inet/udp socket");
+        }
+        if (tcp_nconf6 != NULL) {
+               if (-1 == (fd_tcp = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP)))
+		        xlog(L_FATAL, "can't open inet6/tcp socket");
+               
+        } else if (tcp_nconf != NULL) {
+                if (-1 == (fd_tcp = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)))
+		        xlog(L_FATAL, "can't open inet/tcp socket");
+        }       
+#ifdef RPCINIT_DEBUG
+	fprintf(stderr,"rpcinit: call socket pass\n");
+#endif /* DEBUG */
+
+        /* Use botton level API of TI-RPC & bind socket */
+        if (fd_udp != -1) {
+                bindport(fd_udp, defport, udp_nconf6 ? AF_INET6 : AF_INET);
+#ifdef RPCINIT_DEBUG
+		fprintf(stderr,"rpcinit: call udp bind pass\n");
+#endif /* DEBUG */
+                transp_udp = svc_dg_create(fd_udp, 0, 0);
+#ifdef RPCINIT_DEBUG
+		fprintf(stderr,"rpcinit: call svc_dg_create pass\n");
+#endif /* DEBUG */
+                if (transp_udp != (SVCXPRT *)NULL) {
+udp_register:
+                        if (!svc_reg(transp_udp, prog,vers, dispatch, udp_nconf6 ?
+                                    udp_nconf6 : udp_nconf))
+                                xlog(L_FATAL, "can't register UDP");
+			if (transp_tcp) 
+			        goto tcp_register;
+#ifdef RPCINIT_DEBUG
+		fprintf(stderr,"rpcinit: call svc_reg step pass\n");
+#endif /* DEBUG */
+                } else {
+                        xlog(L_FATAL, "svc_dg_create %d %d failed: %s", 
+                             prog, vers,strerror(errno));
+                }
+        }
+
+        if (fd_tcp != -1) {
+	        bindport(fd_tcp, defport, tcp_nconf6 ? AF_INET6 : AF_INET);
+		listen(fd_tcp, SOMAXCONN);
+#ifdef RPCINIT_DEBUG
+		fprintf(stderr,"rpcinit: call tcp listen&bind pass\n");
+#endif /* DEBUG */
+                transp_tcp = svc_vc_create(fd_tcp, 0, 0);
+
+                if (transp_tcp != (SVCXPRT *)NULL) {
+#ifdef RPCINIT_DEBUG
+			fprintf(stderr,"rpcinit: call svc_vc_create step pass\n");
+#endif /* DEBUG */
+tcp_register:
+                        if (!svc_reg(transp_tcp, prog,vers, dispatch, tcp_nconf6 ?
+                                    tcp_nconf6 : tcp_nconf))
+                                xlog(L_FATAL, "can't register TCP");
+#ifdef RPCINIT_DEBUG
+		fprintf(stderr,"rpcinit: call svc_reg step pass\n");
+#endif /* DEBUG */
+                } else {
+                        xlog(L_FATAL, "svc_vc_create %d %d failed: %s", 
+                             prog, vers, strerror(errno));
+                }
+        }
+
+	if (udp_nconf6)
+        	freenetconfigent(udp_nconf6);
+	if (udp_nconf)
+        	freenetconfigent(udp_nconf);
+	if (tcp_nconf6)
+        	freenetconfigent(tcp_nconf6);
+	if (tcp_nconf)
+        	freenetconfigent(tcp_nconf);
+}
 
-	if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) {
-		static SVCXPRT *last_transp = NULL;
- 
-		if (_rpcpmstart == 0) {
-			if (last_transp
-			    && (!defport || defport == last_transp->xp_port)) {
-				transp = last_transp;
-				goto udp_transport;
-			}
-			if (defport == 0)
-				sock = RPC_ANYSOCK;
-			else if ((sock = makesock(defport, IPPROTO_UDP)) < 0) {
-				xlog(L_FATAL, "%s: cannot make a UDP socket\n",
-						name);
-			}
-		}
-		if (sock == RPC_ANYSOCK)
-			sock = svcudp_socket (prog, 1);
-		transp = svcudp_create(sock);
-		if (transp == NULL) {
-			xlog(L_FATAL, "cannot create udp service.");
-		}
-      udp_transport:
-		if (!svc_register(transp, prog, vers, dispatch, IPPROTO_UDP)) {
-			xlog(L_FATAL, "unable to register (%s, %d, udp).",
-					name, vers);
-		}
-		last_transp = transp;
-	}
+int
+bindport(int fd, int port, int af)
+{
+	struct sockaddr_in	sin;
+	struct sockaddr_in6	sin6;
 
-	if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) {
-		static SVCXPRT *last_transp = NULL;
+	if (port == 0)
+	        return bindresvport(fd, NULL);
 
-		if (_rpcpmstart == 0) {
-			if (last_transp
-			    && (!defport || defport == last_transp->xp_port)) {
-				transp = last_transp;
-				goto tcp_transport;
-			}
-			if (defport == 0)
-				sock = RPC_ANYSOCK;
-			else if ((sock = makesock(defport, IPPROTO_TCP)) < 0) {
-				xlog(L_FATAL, "%s: cannot make a TCP socket\n",
-						name);
+	switch (af) {
+	case AF_INET:
+                sin.sin_family = AF_INET;
+		sin.sin_port = port;
+		sin.sin_addr.s_addr = INADDR_ANY;
+		return bindresvport(fd, &sin);
+        case AF_INET6:
+                sin6.sin6_family = AF_INET6;
+                sin6.sin6_port = port;
+		memset(&sin6.sin6_addr, 0, sizeof(struct in6_addr));
+		return bindresvport(fd, (struct sockaddr_in *)&sin6);
+	default:
+		errno = EPFNOSUPPORT;
+		return (-1);
+        }
+}
+
+/* Log an incoming call. */
+void
+rpc_logcall(struct svc_req *rqstp, char *xname, char *arg)
+{
+	char		buff[1024];
+	int		buflen=sizeof(buff);
+	int		len;
+	char		*sp;
+	int		i;
+
+	if (!xlog_enabled(D_CALL))
+		return;
+
+	sp = buff;
+	switch (rqstp->rq_cred.oa_flavor) {
+	case AUTH_NULL:
+		sprintf(sp, "NULL");
+		break;
+	case AUTH_UNIX: {
+		struct authunix_parms *unix_cred;
+		struct tm *tm;
+
+		unix_cred = (struct authunix_parms *) rqstp->rq_clntcred;
+		tm = localtime(&unix_cred->aup_time);
+		snprintf(sp, buflen, "UNIX %d/%d/%d %02d:%02d:%02d %s %d.%d",
+			tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
+			tm->tm_hour, tm->tm_min, tm->tm_sec,
+			unix_cred->aup_machname,
+			unix_cred->aup_uid,
+			unix_cred->aup_gid);
+		sp[buflen-1] = 0;
+		len = strlen(sp);
+		sp += buflen;
+		buflen -= len;
+		if ((int) unix_cred->aup_len > 0) {
+			snprintf(sp, buflen, "+%d", unix_cred->aup_gids[0]);
+			sp[buflen-1] = 0;
+			len = strlen(sp);
+			sp += buflen;
+			buflen -= len;
+			for (i = 1; i < unix_cred->aup_len; i++) {
+				snprintf(sp, buflen, ",%d", 
+					unix_cred->aup_gids[i]);
+				sp[buflen-1] = 0;
+				len = strlen(sp);
+				sp += buflen;
+				buflen -= len;
 			}
 		}
-		if (sock == RPC_ANYSOCK)
-			sock = svctcp_socket (prog, 1);
-		transp = svctcp_create(sock, 0, 0);
-		if (transp == NULL) {
-			xlog(L_FATAL, "cannot create tcp service.");
 		}
-      tcp_transport:
-		if (!svc_register(transp, prog, vers, dispatch, IPPROTO_TCP)) {
-			xlog(L_FATAL, "unable to register (%s, %d, tcp).",
-					name, vers);
-		}
-		last_transp = transp;
-	}
-
-	if (_rpcpmstart) {
-		signal (SIGALRM, closedown);
-		alarm (_RPCSVC_CLOSEDOWN);
+		break;
+	default:
+		sprintf(sp, "CRED %d", rqstp->rq_cred.oa_flavor);
 	}
+	xlog(D_CALL, "%s [%s]\n\t%s\n", xname, buff, arg);
 }
 
 static void closedown(sig)
@@ -151,24 +282,26 @@
 	(void) alarm(_RPCSVC_CLOSEDOWN);
 }
 
+
 int makesock(int port, int proto)
 {
-	struct sockaddr_in sin;
+	struct sockaddr_in6 sin;
 	int	s;
 	int	sock_type;
 	int	val;
 
 	sock_type = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
-	s = socket(AF_INET, sock_type, proto);
+	s = socket(AF_INET6, sock_type, proto);
 	if (s < 0) {
 		xlog(L_FATAL, "Could not make a socket: %s\n",
 					strerror(errno));
 		return (-1);
 	}
 	memset((char *) &sin, 0, sizeof(sin));
-	sin.sin_family = AF_INET;
-	sin.sin_addr.s_addr = INADDR_ANY;
-	sin.sin_port = htons(port);
+	sin.sin6_family = AF_INET6;
+	sin.sin6_addr.s6_addr32[0] = sin.sin6_addr.s6_addr32[1] = 0;
+	sin.sin6_addr.s6_addr32[2] = sin.sin6_addr.s6_addr32[3] = 0;
+	sin.sin6_port = htons(port);
 
 	val = 1;
 	if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0)
@@ -197,61 +330,3 @@
 	}
 	return (s);
 }
-
-
-/* Log an incoming call. */
-void
-rpc_logcall(struct svc_req *rqstp, char *xname, char *arg)
-{
-	char		buff[1024];
-	int		buflen=sizeof(buff);
-	int		len;
-	char		*sp;
-	int		i;
-
-	if (!xlog_enabled(D_CALL))
-		return;
-
-	sp = buff;
-	switch (rqstp->rq_cred.oa_flavor) {
-	case AUTH_NULL:
-		sprintf(sp, "NULL");
-		break;
-	case AUTH_UNIX: {
-		struct authunix_parms *unix_cred;
-		struct tm *tm;
-
-		unix_cred = (struct authunix_parms *) rqstp->rq_clntcred;
-		tm = localtime(&unix_cred->aup_time);
-		snprintf(sp, buflen, "UNIX %d/%d/%d %02d:%02d:%02d %s %d.%d",
-			tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
-			tm->tm_hour, tm->tm_min, tm->tm_sec,
-			unix_cred->aup_machname,
-			unix_cred->aup_uid,
-			unix_cred->aup_gid);
-		sp[buflen-1] = 0;
-		len = strlen(sp);
-		sp += buflen;
-		buflen -= len;
-		if ((int) unix_cred->aup_len > 0) {
-			snprintf(sp, buflen, "+%d", unix_cred->aup_gids[0]);
-			sp[buflen-1] = 0;
-			len = strlen(sp);
-			sp += buflen;
-			buflen -= len;
-			for (i = 1; i < unix_cred->aup_len; i++) {
-				snprintf(sp, buflen, ",%d", 
-					unix_cred->aup_gids[i]);
-				sp[buflen-1] = 0;
-				len = strlen(sp);
-				sp += buflen;
-				buflen -= len;
-			}
-		}
-		}
-		break;
-	default:
-		sprintf(sp, "CRED %d", rqstp->rq_cred.oa_flavor);
-	}
-	xlog(D_CALL, "%s [%s]\n\t%s\n", xname, buff, arg);
-}
diff -Nru nfs-utils-1.0.6-23/support/nfs/svc_socket.c nfs-utils-1.0.6-23-gq-02/support/nfs/svc_socket.c
--- nfs-utils-1.0.6-23/support/nfs/svc_socket.c	2002-09-13 05:50:56.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/support/nfs/svc_socket.c	2005-02-17 10:18:08.569711000 +0100
@@ -37,15 +37,15 @@
 static int
 svc_socket (u_long number, int type, int protocol, int reuse)
 {
-  struct sockaddr_in addr;
-  socklen_t len = sizeof (struct sockaddr_in);
+  struct sockaddr_in6 addr;
+  socklen_t len = sizeof (struct sockaddr_in6);
   char rpcdata [1024], servdata [1024];
   struct rpcent rpcbuf, *rpcp;
   struct servent servbuf, *servp;
   int sock, ret;
   const char *proto = protocol == IPPROTO_TCP ? "tcp" : "udp";
 
-  if ((sock = __socket (AF_INET, type, protocol)) < 0)
+  if ((sock = __socket (AF_INET6, type, protocol)) < 0)
     {
       perror (_("svc_socket: socket creation problem"));
       return sock;
@@ -64,7 +64,7 @@
     }
 
   __bzero ((char *) &addr, sizeof (addr));
-  addr.sin_family = AF_INET;
+  addr.sin6_family = AF_INET6;
 
   ret = getrpcbynumber_r (number, &rpcbuf, rpcdata, sizeof rpcdata,
 			  &rpcp);
@@ -90,7 +90,7 @@
 
   if (ret == 0 && servp != NULL)
     {
-      addr.sin_port = servp->s_port;
+      addr.sin6_port = servp->s_port;
       if (bind (sock, (struct sockaddr *) &addr, len) < 0)
 	{
 	  perror (_("svc_socket: bind problem"));
@@ -102,7 +102,7 @@
     {
       if (bindresvport (sock, &addr))
 	{
-	  addr.sin_port = 0;
+	  addr.sin6_port = 0;
 	  if (bind (sock, (struct sockaddr *) &addr, len) < 0)
 	    {
 	      perror (_("svc_socket: bind problem"));
diff -Nru nfs-utils-1.0.6-23/utils/exportfs/exportfs.c nfs-utils-1.0.6-23-gq-02/utils/exportfs/exportfs.c
--- nfs-utils-1.0.6-23/utils/exportfs/exportfs.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/exportfs/exportfs.c	2005-02-17 10:18:08.570710000 +0100
@@ -16,6 +16,10 @@
 #include <getopt.h>
 #include <netdb.h>
 #include <errno.h>
+#include <ctype.h>
+#include <resolv.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
 #include "xmalloc.h"
 #include "misc.h"
 #include "nfslib.h"
@@ -31,7 +35,6 @@
 static void	error(nfs_export *exp, int err);
 static void	usage(void);
 
-
 int
 main(int argc, char **argv)
 {
@@ -91,6 +94,10 @@
 		fprintf(stderr, "exportfs: -r and -u are incompatible.\n");
 		return 1;
 	}
+
+	res_init();
+	_res.options |= RES_USE_INET6;
+
 	new_cache = check_new_cache();
 	if (optind == argc && ! f_all) {
 		if (force_flush) {
@@ -130,8 +137,7 @@
 		if (!f_export)
 			for (i = optind ; i < argc ; i++)
 				unexportfs(argv[i], f_verbose);
-		if (!new_cache)
-			rmtab_read();
+		rmtab_read();
 	}
 	if (!new_cache) {
 		xtab_mount_read();
@@ -150,7 +156,7 @@
 exports_update_one(nfs_export *exp, int verbose)
 {
 		/* check mountpoint option */
-	if (exp->m_mayexport &&
+	if (exp->m_mayexport && 
 	    exp->m_export.e_mountpoint &&
 	    !is_mountpoint(exp->m_export.e_mountpoint[0]?
 			   exp->m_export.e_mountpoint:
@@ -227,11 +233,12 @@
 	struct exportent *eep;
 	nfs_export	*exp;
 	struct hostent	*hp = NULL;
+	struct in6_addr	addr;
 	char		*path;
 	char		*hname = arg;
 	int		htype;
 
-	if ((path = strchr(arg, ':')) != NULL)
+	if ((path = strrchr(arg, ':')) != NULL)
 		*path++ = '\0';
 
 	if (!path || *path != '/') {
@@ -239,21 +246,27 @@
 		return;
 	}
 
-	if ((htype = client_gettype(hname)) == MCL_FQDN &&
-	    (hp = gethostbyname(hname)) != NULL) {
-		struct hostent *hp2 = hostent_dup (hp);
-		hp = gethostbyaddr(hp2->h_addr, hp2->h_length,
-				   hp2->h_addrtype);
-		if (hp) {
-			free(hp2);
-			hp = hostent_dup(hp);
-		} else
-			hp = hp2;
+	if ((htype = client_gettype(hname)) == MCL_FQDN) {
+		if (inet_pton(AF_INET6, hname, &addr) > 0) {
+			hp = gethostbyaddr(&addr, sizeof(addr), AF_INET6);
+		}
+		else if (inet_pton(AF_INET, hname, &addr.s6_addr32[3]) > 0) {
+			addr.s6_addr32[0] = 0;
+			addr.s6_addr32[1] = 0;
+			addr.s6_addr32[2] = htonl(0xffff);
+			hp = gethostbyaddr(&addr, sizeof(addr), AF_INET6);
+		}
+		else {
+			hp = gethostbyname(hname);
+		}
+	}
+	if (hp) {
+		hp = hostent_dup(hp);
 		exp = export_find(hp, path);
 		hname = hp->h_name;
-	} else {
-		exp = export_lookup(hname, path, 0);
 	}
+	else
+		exp = export_lookup(hname, path, 0);
 
 	if (!exp) {
 		if (!(eep = mkexportent(hname, path, options)) ||
@@ -280,11 +293,12 @@
 {
 	nfs_export	*exp;
 	struct hostent	*hp = NULL;
+	struct in6_addr	addr;
 	char		*path;
 	char		*hname = arg;
 	int		htype;
 
-	if ((path = strchr(arg, ':')) != NULL)
+	if ((path = strrchr(arg, ':')) != NULL)
 		*path++ = '\0';
 
 	if (!path || *path != '/') {
@@ -294,10 +308,22 @@
 	}
 
 	if ((htype = client_gettype(hname)) == MCL_FQDN) {
-		if ((hp = gethostbyname(hname)) != 0) {
-			hp = hostent_dup (hp);
-			hname = (char *) hp->h_name;
+		if (inet_pton(AF_INET6, hname, &addr) > 0) {
+			hp = gethostbyaddr(&addr, sizeof(addr), AF_INET6);
+		}
+		else if (inet_pton(AF_INET, hname, &addr.s6_addr32[3]) > 0) {
+			addr.s6_addr32[0] = 0;
+			addr.s6_addr32[1] = 0;
+			addr.s6_addr32[2] = htonl(0xffff);
+			hp = gethostbyaddr(&addr, sizeof(addr), AF_INET6);
 		}
+		else {
+			hp = gethostbyname(hname);
+		}
+	}
+	if (hp) {
+		hp = hostent_dup(hp);
+		hname = hp->h_name;
 	}
 
 	for (exp = exportlist[htype]; exp; exp = exp->m_next) {
diff -Nru nfs-utils-1.0.6-23/utils/gssd/Makefile nfs-utils-1.0.6-23-gq-02/utils/gssd/Makefile
--- nfs-utils-1.0.6-23/utils/gssd/Makefile	2005-01-27 15:35:47.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/gssd/Makefile	2005-02-17 10:18:08.573710000 +0100
@@ -11,5 +11,5 @@
 
 include $(TOP)rules.mk
 
-CFLAGS += -DKRB5_VERSION=$(KRB5_VERSION) -I$(TOP)support/rpc/include/ \
- 	-I$(KRBDIR)/include
+CFLAGS += -DHAVE_RPCSEC_GSS -DKRB5_VERSION=$(KRB5_VERSION) \
+	-I$(TOP)support/rpc/include/ -I$(KRBDIR)/include
diff -Nru nfs-utils-1.0.6-23/utils/mountd/auth.c nfs-utils-1.0.6-23-gq-02/utils/mountd/auth.c
--- nfs-utils-1.0.6-23/utils/mountd/auth.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/mountd/auth.c	2005-02-17 10:18:08.570710000 +0100
@@ -36,7 +36,6 @@
 void
 auth_init(char *exports)
 {
-
 	export_file = exports;
 	auth_reload();
 	xtab_mount_write();
@@ -62,7 +61,7 @@
 }
 
 static nfs_export *
-auth_authenticate_internal(char *what, struct sockaddr_in *caller,
+auth_authenticate_internal(char *what, struct sockaddr_in6 *caller,
 			   char *path, struct hostent *hp,
 			   enum auth_error *error)
 {
@@ -74,12 +73,12 @@
 		int i;
 		/* return static nfs_export with details filled in */
 		if (my_client.m_naddr != 1 ||
-		    my_client.m_addrlist[0].s_addr != caller->sin_addr.s_addr) {
+		   !memcmp(&my_client.m_addrlist[0], &caller->sin6_addr, sizeof(caller->sin6_addr))) {
 			/* different client to last time, so do a lookup */
 			char *n;
 			my_client.m_naddr = 0;
-			my_client.m_addrlist[0] = caller->sin_addr;
-			n = client_compose(caller->sin_addr);
+			memcpy(&my_client.m_addrlist[0], &caller->sin6_addr, sizeof(caller->sin6_addr));
+			n = client_compose(&caller->sin6_addr);
 			*error = unknown_host;
 			if (!n)
 				return NULL;
@@ -117,8 +116,8 @@
 		}
 	}
 	if (!(exp->m_export.e_flags & NFSEXP_INSECURE_PORT) &&
-		    (ntohs(caller->sin_port) <  IPPORT_RESERVED/2 ||
-		     ntohs(caller->sin_port) >= IPPORT_RESERVED)) {
+		    (ntohs(caller->sin6_port) <  IPPORT_RESERVED/2 ||
+		     ntohs(caller->sin6_port) >= IPPORT_RESERVED)) {
 		*error = illegal_port;
 		return NULL;
 	}
@@ -128,18 +127,24 @@
 }
 
 nfs_export *
-auth_authenticate(char *what, struct sockaddr_in *caller, char *path)
+auth_authenticate(char *what, struct sockaddr_in6 *caller, char *path)
 {
 	nfs_export	*exp = NULL;
 	char		epath[MAXPATHLEN+1];
 	char		*p = NULL;
 	struct hostent	*hp = NULL;
-	struct in_addr	addr = caller->sin_addr;
+	struct in6_addr	*addr = &caller->sin6_addr;
 	enum auth_error	error;
+	char		str[64];
+
+	if(IN6_IS_ADDR_V4MAPPED(addr))
+		inet_ntop(AF_INET, (void *)&addr->s6_addr32[3], str, sizeof(str));
+	else
+		inet_ntop(AF_INET6, (void *)addr, str, sizeof(str));
 
 	if (path [0] != '/') {
 		xlog(L_WARNING, "bad path in %s request from %s: \"%s\"",
-		     what, inet_ntoa(addr), path);
+		     what, str , path);
 		return exp;
 	}
 
@@ -147,11 +152,11 @@
 	epath[sizeof (epath) - 1] = '\0';
 	auth_fixpath(epath); /* strip duplicate '/' etc */
 
-	hp = get_reliable_hostbyaddr((const char*)&caller->sin_addr, sizeof(struct in_addr),
-				     AF_INET);
+	hp = get_reliable_hostbyaddr((const char*)&caller->sin6_addr, sizeof(struct in6_addr),
+				     AF_INET6);
 	if (!hp)
-		hp = get_hostent((const char*)&caller->sin_addr, sizeof(struct in_addr),
-				     AF_INET);
+		hp = get_hostent((const char*)&caller->sin6_addr, sizeof(struct in6_addr),
+				     AF_INET6);
 	if (!hp)
 		return exp;
 
@@ -168,15 +173,19 @@
 		*p = '\0';
 	}
 
-	switch (error) {
+    switch (error) {
 	case bad_path:
-		xlog(L_WARNING, "bad path in %s request from %s: \"%s\"",
-		     what, inet_ntoa(addr), path);
+	  /*	xlog(L_WARNING, "bad path in %s request from %s: \"%s\"",
+		what, inet_ntoa(addr), path);*/
+	  xlog(L_WARNING, "bad path in %s request from %s: \"%s\"",
+	       what, str, path);
 		break;
 
 	case unknown_host:
-		xlog(L_WARNING, "%s request from unknown host %s for %s (%s)",
-		     what, inet_ntoa(addr), path, epath);
+	  /*	xlog(L_WARNING, "%s request from unknown host %s for %s (%s)",
+		what, inet_ntoa(addr), path, epath);*/
+	  xlog(L_WARNING, "%s request from unknown host %s for %s (%s)",
+		what, str, path, epath);
 		break;
 
 	case no_entry:
@@ -191,16 +200,16 @@
 
 	case illegal_port:
 		xlog(L_WARNING, "refused %s request from %s for %s (%s): illegal port %d",
-		     what, hp->h_name, path, epath, ntohs(caller->sin_port));
+		     what, hp->h_name, path, epath, ntohs(caller->sin6_port));
 		break;
 
 	case success:
 		xlog(L_NOTICE, "authenticated %s request from %s:%d for %s (%s)",
-		     what, hp->h_name, ntohs(caller->sin_port), path, epath);
+		     what, hp->h_name, ntohs(caller->sin6_port), path, epath);
 		break;
 	default:
 		xlog(L_NOTICE, "%s request from %s:%d for %s (%s) gave %d",
-		     what, hp->h_name, ntohs(caller->sin_port), path, epath, error);
+		     what, hp->h_name, ntohs(caller->sin6_port), path, epath, error);
 	}
 
 	if (hp)
diff -Nru nfs-utils-1.0.6-23/utils/mountd/cache.c nfs-utils-1.0.6-23-gq-02/utils/mountd/cache.c
--- nfs-utils-1.0.6-23/utils/mountd/cache.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/mountd/cache.c	2005-02-17 10:18:08.571710000 +0100
@@ -49,9 +49,10 @@
 	 */
 	char *cp;
 	char class[20];
-	char ipaddr[20];
+	char ipaddr[40];
 	char *client;
-	struct in_addr addr;
+	struct in6_addr addr;
+
 	if (readline(fileno(f), &lbuf, &lbuflen) != 1)
 		return;
 
@@ -61,18 +62,17 @@
 	    strcmp(class, "nfsd") != 0)
 		return;
 
-	if (qword_get(&cp, ipaddr, 20) <= 0)
+	if (qword_get(&cp, ipaddr, 40) <= 0)
 		return;
-
-	if (inet_aton(ipaddr, &addr)==0)
+	
+	if (inet_pton(AF_INET6, ipaddr, &addr) == 0)
 		return;
 
 	auth_reload();
 
 	/* addr is a valid, interesting address, find the domain name... */
-	client = client_compose(addr);
+	client = client_compose(&addr);
 
-	
 	qword_print(f, "nfsd");
 	qword_print(f, ipaddr);
 	qword_printint(f, time(0)+30*60);
@@ -80,8 +80,18 @@
 		qword_print(f, *client?client:"DEFAULT");
 	qword_eol(f);
 
-	if (client && strcmp(ipaddr, client))
+	if (client && strcmp(ipaddr, client)) {
+		const char *in_loopback = "127.0.0.1";
+		const char *in6_loopback =
+				"0000:0000:0000:0000:0000:0000:0000:0001";
+
+		if (IN6_IS_ADDR_V4MAPPED(&addr))
+			inet_ntop(AF_INET, (void *)&addr.s6_addr32[3],
+				  ipaddr, sizeof(ipaddr));
+		else if (!memcmp(ipaddr, in6_loopback, strlen(in6_loopback)))
+			memcpy(ipaddr, in_loopback, strlen(in_loopback) + 1);
 		mountlist_add(ipaddr, *client?client:"DEFAULT");
+	}
 
 	if (client) free(client);
 	
@@ -352,21 +362,29 @@
 void cache_export(nfs_export *exp)
 {
 	FILE *f;
+	char str[40];
 
 	f = fopen("/proc/net/rpc/auth.unix.ip/channel", "w");
 	if (!f)
 		return;
 
+	if (IN6_IS_ADDR_V4MAPPED(&exp->m_client->m_addrlist[0]))
+		inet_ntop(AF_INET,
+			  (void *)&exp->m_client->m_addrlist[0].s6_addr32[3],
+			  str, sizeof(str));
+	else
+		inet_ntop(AF_INET6, (void *)&exp->m_client->m_addrlist[0], str, sizeof(str));
+
 	qword_print(f, "nfsd");
-	qword_print(f, inet_ntoa(exp->m_client->m_addrlist[0]));
+	qword_print(f, str);
 	qword_printint(f, time(0)+30*60);
 	qword_print(f, exp->m_client->m_hostname);
 	qword_eol(f);
 	
 	fclose(f);
 
-	if (strcmp(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname))
-		mountlist_add(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname);
+	if (strcmp(str, exp->m_client->m_hostname))
+	  mountlist_add(str, exp->m_client->m_hostname);
 
 	cache_export_ent(exp->m_client->m_hostname, &exp->m_export);
 }
diff -Nru nfs-utils-1.0.6-23/utils/mountd/Makefile nfs-utils-1.0.6-23-gq-02/utils/mountd/Makefile
--- nfs-utils-1.0.6-23/utils/mountd/Makefile	2003-05-21 08:22:41.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/utils/mountd/Makefile	2005-02-17 10:18:08.573710000 +0100
@@ -6,7 +6,7 @@
 PREFIX	= rpc.
 OBJS	= mountd.o mount_dispatch.o auth.o rmtab.o cache.o svc_run.o
 LIBDEPS	= $(TOP)support/lib/libexport.a $(TOP)/support/lib/libnfs.a
-LIBS	= -lexport -lnfs -lmisc $(LIBBSD) $(LIBWRAP) $(LIBNSL)
+LIBS	= -lexport -lnfs -lmisc -lpthread -ltirpc $(LIBBSD) $(LIBWRAP) $(LIBNSL)
 MAN8	= mountd
 
 include $(TOP)rules.mk
diff -Nru nfs-utils-1.0.6-23/utils/mountd/mountd.c nfs-utils-1.0.6-23-gq-02/utils/mountd/mountd.c
--- nfs-utils-1.0.6-23/utils/mountd/mountd.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/mountd/mountd.c	2005-02-17 10:18:08.572710000 +0100
@@ -23,6 +23,8 @@
 #include "misc.h"
 #include "mountd.h"
 #include "rpcmisc.h"
+#include <resolv.h>
+#include <netdb.h>
 
 extern void	cache_open(void);
 extern struct nfs_fh_len *cache_get_filehandle(nfs_export *exp, int len, char *p);
@@ -94,10 +96,13 @@
 bool_t
 mount_dump_1_svc(struct svc_req *rqstp, void *argp, mountlist *res)
 {
-	struct sockaddr_in *addr =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
-	xlog(L_NOTICE, "dump request from %s",
-		inet_ntoa(addr->sin_addr));
+	char str[40];
+	struct sockaddr_in6 *addr =
+		(struct sockaddr_in6 *) svc_getcaller(rqstp->rq_xprt);
+
+	inet_ntop(addr->sin6_family, (void *)&addr->sin6_addr, str,
+		sizeof(str));
+	xlog(L_NOTICE, "dump request from %s", str);
 
 	*res = mountlist_list();
 	return 1;
@@ -106,8 +111,8 @@
 bool_t
 mount_umnt_1_svc(struct svc_req *rqstp, dirpath *argp, void *resp)
 {
-	struct sockaddr_in *sin
-		= (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in6 *sin
+		= (struct sockaddr_in6 *) svc_getcaller(rqstp->rq_xprt);
 	nfs_export	*exp;
 	char		*p = *argp;
 	char		rpath[MAXPATHLEN+1];
@@ -124,8 +129,13 @@
 		return 1;
 	}
 	if (new_cache) {
-		if (strcmp(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname))
-			mountlist_del(inet_ntoa(exp->m_client->m_addrlist[0]), exp->m_client->m_hostname);
+		char str[64];
+		inet_ntop(AF_INET,
+			  (void *)&exp->m_client->m_addrlist[0].s6_addr32[3],
+			  str, sizeof(str));
+		if (strcmp(str, exp->m_client->m_hostname)) {
+			mountlist_del(str, exp->m_client->m_hostname);
+		}
 		mountlist_del(exp->m_client->m_hostname, p);
 	} else {
 		mountlist_del(exp->m_client->m_hostname, p);
@@ -140,17 +150,20 @@
 	/* Reload /etc/xtab if necessary */
 	auth_reload();
 
-	mountlist_del_all((struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt));
+	mountlist_del_all((struct sockaddr_in6 *)svc_getcaller(rqstp->rq_xprt));
 	return 1;
 }
 
 bool_t
 mount_export_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
 {
-	struct sockaddr_in *addr =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
-	xlog(L_NOTICE, "export request from %s",
-		inet_ntoa(addr->sin_addr));
+	char str[40];
+	struct sockaddr_in6 *addr =
+		(struct sockaddr_in6 *) svc_getcaller(rqstp->rq_xprt);
+
+	inet_ntop(AF_INET6, &addr->sin6_addr, str, sizeof(str));
+	xlog(L_NOTICE, "export request from %s", str);
+
 	*resp = get_exportlist();
 	return 1;
 }
@@ -158,10 +171,13 @@
 bool_t
 mount_exportall_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
 {
-	struct sockaddr_in *addr =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
-	xlog(L_NOTICE, "exportall request from %s",
-		inet_ntoa(addr->sin_addr));
+	char str[40];
+	struct sockaddr_in6 *addr =
+		(struct sockaddr_in6 *) svc_getcaller(rqstp->rq_xprt);
+
+	inet_ntop(AF_INET6, &addr->sin6_addr, str, sizeof(str));
+	xlog(L_NOTICE, "exportall request from %s", str);
+
 	*resp = get_exportlist();
 	return 1;
 }
@@ -180,8 +196,8 @@
 bool_t
 mount_pathconf_2_svc(struct svc_req *rqstp, dirpath *path, ppathcnf *res)
 {
-	struct sockaddr_in *sin
-		= (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in6 *sin =
+		(struct sockaddr_in6 *) svc_getcaller(rqstp->rq_xprt);
 	struct stat	stb;
 	nfs_export	*exp;
 	char		rpath[MAXPATHLEN+1];
@@ -256,8 +272,8 @@
 static struct nfs_fh_len *
 get_rootfh(struct svc_req *rqstp, dirpath *path, int *error, int v3)
 {
-	struct sockaddr_in *sin =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in6 *sin =
+		(struct sockaddr_in6 *) svc_getcaller(rqstp->rq_xprt);
 	struct stat	stb, estb;
 	nfs_export	*exp;
 	char		rpath[MAXPATHLEN+1];
@@ -535,7 +551,7 @@
 		}
 	}
 	/* Initialize logging. */
-/*	xlog_open("mountd"); */
+	/* xlog_open("mountd"); */
 
 	sa.sa_handler = SIG_IGN;
 	sa.sa_flags = 0;
@@ -554,6 +570,9 @@
 			(void) close(fd);
 	}
 
+	res_init();
+	_res.options |= RES_USE_INET6;
+
 	new_cache = check_new_cache();
 	if (new_cache)
 		cache_open();
diff -Nru nfs-utils-1.0.6-23/utils/mountd/mountd.h nfs-utils-1.0.6-23-gq-02/utils/mountd/mountd.h
--- nfs-utils-1.0.6-23/utils/mountd/mountd.h	2003-07-31 07:27:13.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/utils/mountd/mountd.h	2005-02-17 10:18:08.572710000 +0100
@@ -41,13 +41,13 @@
 void		mount_dispatch(struct svc_req *, SVCXPRT *);
 void		auth_init(char *export_file);
 int		auth_reload(void);
-nfs_export *	auth_authenticate(char *what, struct sockaddr_in *sin,
+nfs_export *	auth_authenticate(char *what, struct sockaddr_in6 *sin,
 					char *path);
 void		auth_export(nfs_export *exp);
 
 void		mountlist_add(char *host, const char *path);
 void		mountlist_del(char *host, const char *path);
-void		mountlist_del_all(struct sockaddr_in *sin);
+void		mountlist_del_all(struct sockaddr_in6 *sin);
 mountlist	mountlist_list(void);
 
 
diff -Nru nfs-utils-1.0.6-23/utils/mountd/mount_dispatch.c nfs-utils-1.0.6-23-gq-02/utils/mountd/mount_dispatch.c
--- nfs-utils-1.0.6-23/utils/mountd/mount_dispatch.c	2000-08-26 06:10:07.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/utils/mountd/mount_dispatch.c	2005-02-17 10:18:08.571710000 +0100
@@ -71,7 +71,7 @@
 
 #ifdef HAVE_TCP_WRAPPER
 	/* remote host authorization check */
-	if (!check_default("mountd", svc_getcaller(transp),
+	if (!check_default("mountd", (struct sockaddr_in6 *)svc_getcaller(transp),
 			   rqstp->rq_proc, MOUNTPROG)) {
 		svcerr_auth (transp, AUTH_FAILED);
 		return;
diff -Nru nfs-utils-1.0.6-23/utils/mountd/rmtab.c nfs-utils-1.0.6-23-gq-02/utils/mountd/rmtab.c
--- nfs-utils-1.0.6-23/utils/mountd/rmtab.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/mountd/rmtab.c	2005-02-17 10:18:08.572710000 +0100
@@ -126,9 +126,9 @@
 }
 
 void
-mountlist_del_all(struct sockaddr_in *sin)
+mountlist_del_all(struct sockaddr_in6 *sin)
 {
-	struct in_addr	addr = sin->sin_addr;
+	struct in6_addr	addr = sin->sin6_addr;
 	struct hostent	*hp;
 	struct rmtabent	*rep;
 	nfs_export	*exp;
@@ -137,10 +137,12 @@
 
 	if ((lockid = xflock(_PATH_RMTAB, "w")) < 0)
 		return;
-	if (!(hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET))) {
-		xlog(L_ERROR, "can't get hostname of %s", inet_ntoa(addr));
-		xfunlock(lockid);
-		return;
+	if (!(hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6))) {
+	    char str[40];
+	    inet_ntop(AF_INET6, (void *)&addr, str, sizeof(str));
+	    xlog(L_ERROR, "can't get hostname of %s", str);
+	    xfunlock(lockid);
+	    return;
 	}
 	else
 		hp = hostent_dup (hp);
@@ -202,7 +204,10 @@
 		setrmtabent("r");
 		while ((rep = getrmtabent(1, NULL)) != NULL) {
 			m = (mountlist) xmalloc(sizeof(*m));
-			m->ml_hostname = xstrdup(rep->r_client);
+			if (!strncmp(rep->r_client, "::ffff:", 7))
+				m->ml_hostname = xstrdup(rep->r_client + 7);
+			else
+				m->ml_hostname = xstrdup(rep->r_client);
 			m->ml_directory = xstrdup(rep->r_path);
 			m->ml_next = mlist;
 			mlist = m;
diff -Nru nfs-utils-1.0.6-23/utils/rquotad/Makefile nfs-utils-1.0.6-23-gq-02/utils/rquotad/Makefile
--- nfs-utils-1.0.6-23/utils/rquotad/Makefile	2000-08-26 06:10:09.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/utils/rquotad/Makefile	2005-02-17 10:18:08.573710000 +0100
@@ -8,6 +8,6 @@
 DEPLIBS	= 
 MAN8	= rquotad
 
-LIBS	+= -lnfs -lmisc $(LIBBSD) $(LIBWRAP) $(LIBNSL)
+LIBS	+= -lnfs -lmisc -lpthread -ltirpc $(LIBBSD) $(LIBWRAP) $(LIBNSL)
 
 include $(TOP)rules.mk
diff -Nru nfs-utils-1.0.6-23/utils/statd/Makefile nfs-utils-1.0.6-23-gq-02/utils/statd/Makefile
--- nfs-utils-1.0.6-23/utils/statd/Makefile	2003-09-15 01:29:39.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/utils/statd/Makefile	2005-02-17 10:18:08.573710000 +0100
@@ -16,7 +16,7 @@
 PREFIX	= rpc.
 OBJS	= $(SRCS:.c=.o)
 CCOPTS	= $(DEBUG) $(SIMUL)
-LIBS	= -lexport -lnfs -lmisc $(LIBWRAP) $(LIBNSL)
+LIBS	= -lexport -lnfs -lmisc -lpthread -ltirpc $(LIBWRAP) $(LIBNSL)
 
 SRCS	= $(RPCSRCS) $(SIMSRCS) \
 	  callback.c notlist.c log.c misc.c monitor.c notify.c simu.c \
diff -Nru nfs-utils-1.0.6-23/utils/statd/monitor.c nfs-utils-1.0.6-23-gq-02/utils/statd/monitor.c
--- nfs-utils-1.0.6-23/utils/statd/monitor.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/statd/monitor.c	2005-02-17 10:29:00.402617472 +0100
@@ -37,7 +37,7 @@
 	char            *path;
 	int             fd;
 	notify_list	*clnt;
-	struct in_addr	my_addr;
+	struct in6_addr	my_addr;
 #ifdef RESTRICTED_STATD
 	struct in_addr	mon_addr, caller;
 #else
@@ -112,7 +112,7 @@
 		note(N_WARNING, "gethostbyname error for %s", my_name);
 		goto failure;
 	} else
-		my_addr = *(struct in_addr *) hostinfo->h_addr;
+		my_addr = *(struct in6_addr *) hostinfo->h_addr;
 #endif
 
 	/*
diff -Nru nfs-utils-1.0.6-23/utils/statd/notlist.h nfs-utils-1.0.6-23-gq-02/utils/statd/notlist.h
--- nfs-utils-1.0.6-23/utils/statd/notlist.h	2002-09-16 21:35:21.000000000 +0200
+++ nfs-utils-1.0.6-23-gq-02/utils/statd/notlist.h	2005-02-17 10:29:00.403617320 +0100
@@ -12,7 +12,7 @@
  */
 struct notify_list {
   mon			mon;	/* Big honkin' NSM structure. */
-  struct in_addr	addr;	/* IP address for callback. */
+  struct in6_addr	addr;	/* IP address for callback. */
   unsigned short	port;	/* port number for callback */
   short int		times;	/* Counter used for various things. */
   int			state;	/* For storing notified state for callbacks. */
@@ -68,3 +68,12 @@
 #define NL_MY_VERS(L)	(NL_MY_ID((L)).my_vers)
 #define NL_WHEN(L)	((L)->when)
 #define NL_TYPE(L)	((L)->type)
+
+#define IS_ADDR6_ANY(a) \
+	((((uint32_t *) (a))[0] == 0) &&		\
+	 (((uint32_t *) (a))[1] == 0) &&		\
+	 ((((uint32_t *) (a))[2] == 0) &&		\
+	  (((uint32_t *) (a))[3] == htonl(1))) ||	\
+	 ((((uint32_t *) (a))[2] == htonl(0xffff)) &&	\
+	  (((uint32_t *) (a))[3] == 0)))
+
diff -Nru nfs-utils-1.0.6-23/utils/statd/rmtcall.c nfs-utils-1.0.6-23-gq-02/utils/statd/rmtcall.c
--- nfs-utils-1.0.6-23/utils/statd/rmtcall.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/statd/rmtcall.c	2005-02-17 10:29:00.404617168 +0100
@@ -51,12 +51,12 @@
 int
 statd_get_socket(int port)
 {
-	struct sockaddr_in	sin;
+	struct sockaddr_in6	sin;
 
 	if (sockfd >= 0)
 		return sockfd;
 
-	if ((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+	if ((sockfd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
 		note(N_CRIT, "Can't create socket: %m");
 		return -1;
 	}
@@ -64,8 +64,8 @@
 	FD_SET(sockfd, &SVC_FDSET);
 
 	memset(&sin, 0, sizeof(sin));
-	sin.sin_family = AF_INET;
-	sin.sin_port = port;
+	sin.sin6_family = AF_INET6;
+	sin.sin6_port = port;
 	if (bindresvport(sockfd, &sin) < 0) {
 		dprintf(N_WARNING,
 			"process_hosts: can't bind to reserved port\n");
@@ -108,6 +108,7 @@
 {
 	struct hostent	*hp;
 	char		*hname;
+	char		str[64];
 
 	if (NL_TYPE(lp) == NOTIFY_REBOOT)
 		hname = NL_MON_NAME(lp);
@@ -121,23 +122,24 @@
 		return 0;
 	}
 
-	if (hp->h_addrtype != AF_INET) {
-		note(N_ERROR, "%s is not an AF_INET address", hname);
+	if (hp->h_addrtype != AF_INET6) {
+		note(N_ERROR, "%s is not an AF_INET6 address", hname);
 		NL_TIMES(lp) = 0;
 		return 0;
 	}
 
 	/* FIXME: should try all addresses for multi-homed hosts in
 	 * alternation because one interface might be down/unreachable. */
-	NL_ADDR(lp) = *(struct in_addr *) hp->h_addr;
+	NL_ADDR(lp) = *(struct in6_addr *) hp->h_addr;
 
-	dprintf(N_DEBUG, "address of %s is %s", hname, inet_ntoa(NL_ADDR(lp)));
+	inet_ntop(AF_INET6, &NL_ADDR(lp), str, sizeof(str));
+	dprintf(N_DEBUG, "address of %s is %s", hname, str);
 	return 1;
 }
 #endif
 
 static unsigned long
-xmit_call(int sockfd, struct sockaddr_in *sin,
+xmit_call(int sockfd, struct sockaddr_in6 *sin,
 	  u_int32_t prog, u_int32_t vers, u_int32_t proc,
 	  xdrproc_t func, void *obj)
 /* 		__u32 prog, __u32 vers, __u32 proc, xdrproc_t func, void *obj) */
@@ -154,8 +156,8 @@
 	mesg.rm_xid = ++xid;
 	mesg.rm_direction = CALL;
 	mesg.rm_call.cb_rpcvers = 2;
-	if (sin->sin_port == 0) {
-		sin->sin_port = htons(PMAPPORT);
+	if (sin->sin6_port == 0) {
+		sin->sin6_port = htons(PMAPPORT);
 		mesg.rm_call.cb_prog = PMAPPROG;
 		mesg.rm_call.cb_vers = PMAPVERS;
 		mesg.rm_call.cb_proc = PMAPPROC_GETPORT;
@@ -203,13 +205,14 @@
 }
 
 static notify_list *
-recv_rply(int sockfd, struct sockaddr_in *sin, u_long *portp)
+recv_rply(int sockfd, struct sockaddr_in6 *sin, u_long *portp)
 {
 	unsigned int		msgbuf[MAXMSGSIZE], msglen;
 	struct rpc_msg		mesg;
 	notify_list		*lp = NULL;
 	XDR			xdr, *xdrs = &xdr;
 	int			alen = sizeof(*sin);
+	char			str[64];
 
 	/* Receive message */
 	if ((msglen = recvfrom(sockfd, msgbuf, sizeof(msgbuf), 0,
@@ -231,15 +234,15 @@
 	}
 
 	if (mesg.rm_reply.rp_stat != 0) {
+		inet_ntop(AF_INET6, &sin->sin6_addr, str, sizeof(str));
 		note(N_WARNING, "recv_rply: [%s] RPC status %d\n", 
-				inet_ntoa(sin->sin_addr),
-				mesg.rm_reply.rp_stat);
+				str, mesg.rm_reply.rp_stat);
 		goto done;
 	}
 	if (mesg.rm_reply.rp_acpt.ar_stat != 0) {
+		inet_ntop(AF_INET6, &sin->sin6_addr, str, sizeof(str));
 		note(N_WARNING, "recv_rply: [%s] RPC status %d\n",
-				inet_ntoa(sin->sin_addr),
-				mesg.rm_reply.rp_acpt.ar_stat);
+				str, mesg.rm_reply.rp_acpt.ar_stat);
 		goto done;
 	}
 
@@ -249,20 +252,21 @@
 		 * not the static, internal xid */
 		if (lp->xid != mesg.rm_xid)
 			continue;
-		if (lp->addr.s_addr != sin->sin_addr.s_addr) {
-			char addr [18];
-			strncpy (addr, inet_ntoa(lp->addr),
-				 sizeof (addr) - 1);
-			addr [sizeof (addr) - 1] = '\0';
+		if (memcmp(&lp->addr, &sin->sin6_addr,
+			   sizeof(struct in6_addr))) {
+			char addr [64];
+			inet_ntop(AF_INET6, &lp->addr, addr, sizeof(addr));
+			inet_ntop(AF_INET6, &sin->sin6_addr, str, sizeof(str));
 			dprintf(N_WARNING, "address mismatch: "
 				"expected %s, got %s\n",
-				addr, inet_ntoa(sin->sin_addr));
+				addr, str);
 		}
 		if (lp->port == 0) {
 			if (!xdr_u_long(xdrs, portp)) {
+				inet_ntop(AF_INET6, &sin->sin6_addr, str,
+					sizeof(str));
 				note(N_WARNING, "recv_rply: [%s] "
-					"can't decode reply body!\n",
-					inet_ntoa(sin->sin_addr));
+					"can't decode reply body!\n", str);
 				lp = NULL;
 				goto done;
 			}
@@ -281,24 +285,25 @@
 static int
 process_entry(int sockfd, notify_list *lp)
 {
-	struct sockaddr_in	sin;
+	struct sockaddr_in6	sin;
 	struct status		new_status;
 	xdrproc_t		func;
 	void			*objp;
 	u_int32_t		proc, vers, prog;
 /* 	__u32			proc, vers, prog; */
+	char			str[64];
 
-	if (lp->addr.s_addr == INADDR_ANY && !try_to_resolve(lp))
+	if (!IS_ADDR6_ANY(lp->addr.s6_addr32) && !try_to_resolve(lp))
 		return NL_TIMES(lp);
 	if (NL_TIMES(lp) == 0) {
-		note(N_DEBUG, "Cannot notify %s, giving up.\n",
-					inet_ntoa(NL_ADDR(lp)));
+		inet_ntop(AF_INET6, &NL_ADDR(lp), str, sizeof(str));
+		note(N_DEBUG, "Cannot notify %s, giving up.\n", str);
 		return 0;
 	}
 
 	memset(&sin, 0, sizeof(sin));
-	sin.sin_family = AF_INET;
-	sin.sin_port   = lp->port;
+	sin.sin6_family = AF_INET6;
+	sin.sin6_port   = lp->port;
 	/* LH - moved address into switch */
 
 	switch (NL_TYPE(lp)) {
@@ -308,7 +313,7 @@
 		proc = SM_NOTIFY;
 
 		/* Use source address for notify replies */
-		sin.sin_addr   = lp->addr;
+		memcpy(&sin.sin6_addr, &lp->addr, sizeof(lp->addr));
 
 		func = (xdrproc_t) xdr_stat_chge;
 		objp = &SM_stat_chge;
@@ -320,7 +325,10 @@
 
 		/* __FORCE__ loopback for callbacks to lockd ... */
 		/* Just in case we somehow ignored it thus far */
-		sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+		sin.sin6_addr.s6_addr32[0] = 0;
+		sin.sin6_addr.s6_addr32[1] = 0;
+		sin.sin6_addr.s6_addr32[2] = htonl(0xffff);
+		sin.sin6_addr.s6_addr32[3] = htonl(INADDR_LOOPBACK);
 
 		func = (xdrproc_t) xdr_status;
 		objp = &new_status;
@@ -336,8 +344,9 @@
 
 	lp->xid = xmit_call(sockfd, &sin, prog, vers, proc, func, objp);
 	if (!lp->xid) {
+		inet_ntop(AF_INET6, &lp->addr, str, sizeof(str));
 		note(N_WARNING, "notify_host: failed to notify %s\n",
-				inet_ntoa(lp->addr));
+				str);
 	}
 	NL_TIMES(lp) -= 1;
 
@@ -350,9 +359,10 @@
 int
 process_reply(FD_SET_TYPE *rfds)
 {
-	struct sockaddr_in	sin;
+	struct sockaddr_in6	sin;
 	notify_list		*lp;
 	u_long			port;
+	char			str[64];
 
 	if (sockfd == -1 || !FD_ISSET(sockfd, rfds))
 		return 0;
@@ -369,9 +379,9 @@
 			nlist_insert_timer(&notify, lp);
 			return 1;
 		}
+		inet_ntop(AF_INET6, &lp->addr, str, sizeof(str));
 		note(N_WARNING, "recv_rply: [%s] service %d not registered",
-			inet_ntoa(lp->addr),
-			NL_TYPE(lp) == NOTIFY_REBOOT? SM_PROG : NL_MY_PROG(lp));
+			str, NL_TYPE(lp) == NOTIFY_REBOOT? SM_PROG : NL_MY_PROG(lp));
 	} else if (NL_TYPE(lp) == NOTIFY_REBOOT) {
 		dprintf(N_DEBUG, "Notification of %s succeeded.",
 			NL_MON_NAME(lp));
diff -Nru nfs-utils-1.0.6-23/utils/statd/statd.c nfs-utils-1.0.6-23-gq-02/utils/statd/statd.c
--- nfs-utils-1.0.6-23/utils/statd/statd.c	2005-01-03 15:34:43.000000000 +0100
+++ nfs-utils-1.0.6-23-gq-02/utils/statd/statd.c	2005-02-17 10:29:00.404617168 +0100
@@ -20,6 +20,7 @@
 #include <rpcmisc.h>
 #include <sys/resource.h>
 #include <grp.h>
+#include <resolv.h>
 #include "statd.h"
 #include "version.h"
 
@@ -430,6 +431,9 @@
 	atexit(truncate_pidfile);
 	drop_privs();
 
+	res_init();
+	_res.options |= RES_USE_INET6;
+
 	for (;;) {
 		if (!(run_mode & MODE_NOTIFY_ONLY)) {
 			/* Do not do pmap_unset() when running in notify mode.

