diff -Nru nfs-utils.1.1.2-ipv6client/support/export/client.c nfs-utils.1.1.2-ipv6server/support/export/client.c
--- nfs-utils.1.1.2-ipv6client/support/export/client.c	2008-09-18 13:49:31.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/export/client.c	2008-09-18 13:32:05.000000000 +0200
@@ -30,7 +30,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, };
 
@@ -49,9 +49,23 @@
 	htype = client_gettype(hname);
 
 	if (htype == MCL_FQDN && !canonical) {
+		struct in6_addr addr;
 		struct hostent *hp2;
-		hp = gethostbyname(hname);
-		if (hp == NULL || hp->h_addrtype != AF_INET) {
+ 		
+ 		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;
 		}
@@ -74,7 +88,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))
@@ -100,7 +114,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;
 	}
 
@@ -140,23 +154,50 @@
 	if (clp->m_type == MCL_SUBNETWORK) {
 		char	*cp = strchr(clp->m_hostname, '/');
 		static char slash32[] = "/32";
+		int	netmask = 0;
 
 		if(!cp) cp = slash32;
 		*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));
-			}
-			else {
-				xlog(L_FATAL, "invalid netmask `%s' for %s",
-				     cp + 1, clp->m_hostname);
-			}
+ 		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)<0)
+ 					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 {
+ 	    			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;
@@ -167,7 +208,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;
 	}
@@ -234,14 +275,14 @@
 }
 
 struct hostent *
-client_resolve(struct in_addr addr)
+client_resolve(struct in6_addr addr)
 {
 	struct hostent *he = NULL;
 
 	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);
 
 	return he;
 }
@@ -354,7 +395,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;
@@ -373,7 +414,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 */
@@ -381,12 +422,13 @@
 				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)>0) {
+				if (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;
+				}
 			}
 
 			/* Okay, strip off the domain (if we have one) */
@@ -414,20 +456,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.1.2-ipv6client/support/export/hostname.c nfs-utils.1.1.2-ipv6server/support/export/hostname.c
--- nfs-utils.1.1.2-ipv6client/support/export/hostname.c	2008-09-18 13:49:53.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/export/hostname.c	2008-09-18 13:32:33.000000000 +0200
@@ -18,6 +18,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <xlog.h>
 #ifdef TEST
 #define xmalloc malloc
@@ -44,6 +45,7 @@
   struct hostent *cp;
   int len_ent;
   const char *name;
+  char buf[INET6_ADDRSTRLEN];
   int len_name;
   int num_aliases = 1;
   int len_aliases = sizeof (char *);
@@ -58,6 +60,14 @@
       ipv4 = (struct in_addr *) addr;
       name = inet_ntoa (*ipv4);
       break;
+    
+    case AF_INET6:
+      if (!inet_ntop(AF_INET6,(void *) addr, buf, sizeof(buf))) {
+		xlog(L_ERROR, "hostname: errno %d (%s)\n", errno, strerror(errno));
+		return NULL;
+      }
+      name = buf;
+      break;
 
     default:
       return NULL;
@@ -254,14 +264,24 @@
 		}
 		else {
 			/* it was a FAKE */
-			xlog (L_WARNING, "Fake hostname %s for %s - forward lookup doesn't match reverse",
-			      reverse->h_name, inet_ntoa(*(struct in_addr*)addr));
+			char buf[INET6_ADDRSTRLEN];
+			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 {
+		                xlog(L_ERROR, "hostname: errno %d (%s)\n", errno, strerror(errno));
+				return NULL;
+			}
 		}
 	}
 	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));
+		char buf[INET6_ADDRSTRLEN];
+		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 );
+		} else {
+			xlog(L_ERROR, "hostname: errno %d (%s)\n", errno, strerror(errno));
+			return NULL;
+		}
 	}
 
 	free (reverse);
@@ -282,8 +302,14 @@
       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[INET6_ADDRSTRLEN];
+	if (inet_ntop(AF_INET6, (void *)sp, toprint, sizeof(toprint))) {
+		printf ("  %s\n", toprint);
+	} else {
+		xlog(L_ERROR, "hostname: errno %d (%s)\n", errno, strerror(errno));
+	}
+      }
     }
   else
     printf ("Not host information\n");
@@ -294,7 +320,8 @@
 {
   struct hostent *hp = gethostbyname (argv [1]);
   struct hostent *cp;
-  struct in_addr addr;
+  struct in6_addr addr;
+  char toprint[INET6_ADDRSTRLEN];
 
   print_host (hp);
 
@@ -306,9 +333,22 @@
     }
   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");
+  }
+  if (inet_ntop(AF_INET6, (void *)&addr, toprint, sizeof(toprint))) {
+    printf ("%s\n", toprint);
+  } else {
+	xlog(L_ERROR, "hostname: errno %d (%s)\n", errno, strerror(errno));
+	return 0
+  }
+  cp = get_hostent ((const char *)&addr, sizeof(addr), AF_INET6);
   print_host (cp);
   return 0;
 }
diff -Nru nfs-utils.1.1.2-ipv6client/support/export/nfsctl.c nfs-utils.1.1.2-ipv6server/support/export/nfsctl.c
--- nfs-utils.1.1.2-ipv6client/support/export/nfsctl.c	2008-09-18 13:50:05.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/export/nfsctl.c	2008-09-18 13:32:48.000000000 +0200
@@ -78,7 +78,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.1.2-ipv6client/support/include/exportfs.h nfs-utils.1.1.2-ipv6server/support/include/exportfs.h
--- nfs-utils.1.1.2-ipv6client/support/include/exportfs.h	2008-09-18 13:51:08.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/include/exportfs.h	2008-09-18 13:33:38.000000000 +0200
@@ -35,7 +35,9 @@
 	char *			m_hostname;
 	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;
@@ -65,7 +67,7 @@
 void				client_release(nfs_client *);
 void				client_freeall(void);
 char *				client_compose(struct hostent *he);
-struct hostent *		client_resolve(struct in_addr addr);
+struct hostent *		client_resolve(struct in6_addr addr);
 int 				client_member(char *client, char *name);
 
 int				export_read(char *fname);
diff -Nru nfs-utils.1.1.2-ipv6client/support/include/nfs/nfs.h nfs-utils.1.1.2-ipv6server/support/include/nfs/nfs.h
--- nfs-utils.1.1.2-ipv6client/support/include/nfs/nfs.h	2008-09-18 13:52:35.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/include/nfs/nfs.h	2008-09-18 13:34:54.000000000 +0200
@@ -100,7 +100,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;
@@ -108,14 +108,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.1.2-ipv6client/support/include/nfslib.h nfs-utils.1.1.2-ipv6server/support/include/nfslib.h
--- nfs-utils.1.1.2-ipv6client/support/include/nfslib.h	2008-09-18 13:51:43.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/include/nfslib.h	2008-09-18 13:34:14.000000000 +0200
@@ -126,7 +126,7 @@
  * nfsd library functions.
  */
 int			nfsctl(int, struct nfsctl_arg *, union nfsctl_res *);
-int			nfssvc(int port, int nrservs, unsigned int versbits, unsigned int portbits, char *haddr);
+int			nfssvc(int port, int nrservs, unsigned int versbits, unsigned int portbits, char *haddr, int nfsdfamily);
 int			nfsaddclient(struct nfsctl_client *clp);
 int			nfsdelclient(struct nfsctl_client *clp);
 int			nfsexport(struct nfsctl_export *exp);
diff -Nru nfs-utils.1.1.2-ipv6client/support/include/tcpwrapper.h nfs-utils.1.1.2-ipv6server/support/include/tcpwrapper.h
--- nfs-utils.1.1.2-ipv6client/support/include/tcpwrapper.h	2008-09-18 13:51:23.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/include/tcpwrapper.h	2008-09-18 13:33:52.000000000 +0200
@@ -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.1.2-ipv6client/support/misc/from_local.c nfs-utils.1.1.2-ipv6server/support/misc/from_local.c
--- nfs-utils.1.1.2-ipv6client/support/misc/from_local.c	2008-09-18 13:53:33.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/misc/from_local.c	2008-09-18 13:35:53.000000000 +0200
@@ -45,6 +45,7 @@
 
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <arpa/inet.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <netdb.h>
@@ -67,13 +68,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(void)
 {
-    struct in_addr *new_addrs;
+    struct in6_addr *new_addrs;
     int     new_num;
 
     /*
@@ -81,7 +82,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 +98,7 @@
     }
 }
 
-/* find_local - find all IP addresses for this host */
+/* find_local - find all IPv4 addresses for this host */
 static int
 find_local(void)
 {
@@ -105,8 +106,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 +127,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 +145,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,12 +159,34 @@
 #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(struct sockaddr_in *addr)
+from_local(struct sockaddr_in6 *addr)
 {
     int     i;
 
@@ -165,23 +194,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[INET6_ADDRSTRLEN];
+   
     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.1.2-ipv6client/support/misc/tcpwrapper.c nfs-utils.1.1.2-ipv6server/support/misc/tcpwrapper.c
--- nfs-utils.1.1.2-ipv6client/support/misc/tcpwrapper.c	2008-09-18 13:53:45.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/misc/tcpwrapper.c	2008-09-18 13:36:07.000000000 +0200
@@ -39,6 +39,8 @@
 #include <string.h>
 #include <rpc/rpc.h>
 #include <rpc/pmap_prot.h>
+#include <errno.h>
+#include "xlog.h"
 #include <syslog.h>
 #include <netdb.h>
 #include <pwd.h>
@@ -49,7 +51,7 @@
 #include <rpc/rpcent.h>
 #endif
 
-static void logit(int severity, struct sockaddr_in *addr,
+static void logit(int severity, struct sockaddr_in6 *addr,
 		  u_long procnum, u_long prognum, char *text);
 static void toggle_verboselog(int sig);
 int     verboselog = 0;
@@ -89,19 +91,26 @@
 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[INET6_ADDRSTRLEN];
+    if (!inet_ntop(addr->sin6_family,(void *)&addr->sin6_addr.s6_addr32[0], str, sizeof(str))) {
+		xlog(L_ERROR, "tcpwrapper: errno %d (%s)\n", errno, strerror(errno));
+		return 0;
+    }
+
+    
+    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;
@@ -113,7 +122,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)
@@ -180,7 +189,7 @@
 int
 check_default(daemon, addr, proc, prog)
 char *daemon;
-struct sockaddr_in *addr;
+struct sockaddr_in6 *addr;
 u_long  proc;
 u_long  prog;
 {
@@ -195,7 +204,7 @@
 
 /* check_privileged_port - additional checks for privileged-port updates */
 int
-check_privileged_port(struct sockaddr_in *addr,	
+check_privileged_port(struct sockaddr_in6 *addr,	
 		      u_long proc, u_long prog, u_long port)
 {
 #ifdef CHECK_PORT
@@ -217,7 +226,7 @@
 
 /* logit - report events of interest via the syslog daemon */
 
-static void logit(int severity, struct sockaddr_in *addr,
+static void logit(int severity, struct sockaddr_in6 *addr,
 		  u_long procnum, u_long prognum, char *text)
 {
     char   *procname;
@@ -225,6 +234,7 @@
     char   *progname;
     char    progbuf[16 + 4 * sizeof(u_long)];
     struct rpcent *rpc;
+    char    str[INET6_ADDRSTRLEN];
 
     /*
      * Fork off a process or the portmap daemon might hang while
@@ -253,8 +263,12 @@
 
 	/* Write syslog record. */
 
-	syslog(severity, "connect from %s to %s in %s%s",
-	       inet_ntoa(addr->sin_addr), procname, progname, text);
+        if (!inet_ntop(addr->sin6_family,(void *)&addr->sin6_addr.s6_addr32[0], str, sizeof(str))) {
+		xlog(L_ERROR, "tcpwrapper: errno %d (%s)\n", errno, strerror(errno));
+		return 0;
+}
+        syslog(severity, "connect from %s to %s in %s%s",
+	       str, procname, progname, text);
 	exit(0);
     }
 }
diff -Nru nfs-utils.1.1.2-ipv6client/support/nfs/getfh.c nfs-utils.1.1.2-ipv6server/support/nfs/getfh.c
--- nfs-utils.1.1.2-ipv6client/support/nfs/getfh.c	2008-09-18 13:54:35.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/nfs/getfh.c	2008-09-18 13:37:01.000000000 +0200
@@ -30,7 +30,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;
@@ -52,7 +52,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;
@@ -72,7 +72,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.1.2-ipv6client/support/nfs/nfssvc.c nfs-utils.1.1.2-ipv6server/support/nfs/nfssvc.c
--- nfs-utils.1.1.2-ipv6client/support/nfs/nfssvc.c	2008-09-18 13:54:50.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/nfs/nfssvc.c	2008-09-18 13:37:11.000000000 +0200
@@ -26,12 +26,13 @@
 #define NFSD_THREAD_FILE  "/proc/fs/nfsd/threads"
 
 static void
-nfssvc_setfds(int port, unsigned int ctlbits, char *haddr)
+nfssvc_setfds(int port, unsigned int ctlbits, char *haddr, int nfsdfamily)
 {
 	int fd, n, on=1;
 	char buf[BUFSIZ];
 	int udpfd = -1, tcpfd = -1;
 	struct sockaddr_in sin;
+	struct sockaddr_in6 sin6;
 
 	fd = open(NFSD_PORTS_FILE, O_RDONLY);
 	if (fd < 0)
@@ -47,49 +48,118 @@
 	 * open it if not.  However we don't yet.  All sockets
 	 * have to be opened when the first daemon is started.
 	 */
-	fd = open(NFSD_PORTS_FILE, O_WRONLY);
-	if (fd < 0)
-		return;
-	sin.sin_family = AF_INET;
-	sin.sin_port   = htons(port);
-	sin.sin_addr.s_addr =  inet_addr(haddr);
-
-	if (NFSCTL_UDPISSET(ctlbits)) {
-		udpfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
-		if (udpfd < 0) {
-			syslog(LOG_ERR, "nfssvc: unable to create UPD socket: "
-				"errno %d (%s)\n", errno, strerror(errno));
-			exit(1);
-		}
-		if (bind(udpfd, (struct  sockaddr  *)&sin, sizeof(sin)) < 0){
-			syslog(LOG_ERR, "nfssvc: unable to bind UPD socket: "
-				"errno %d (%s)\n", errno, strerror(errno));
-			exit(1);
-		}
-	}
-
-	if (NFSCTL_TCPISSET(ctlbits)) {
-		tcpfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
-		if (tcpfd < 0) {
-			syslog(LOG_ERR, "nfssvc: unable to createt tcp socket: "
-				"errno %d (%s)\n", errno, strerror(errno));
-			exit(1);
-		}
-		if (setsockopt(tcpfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) {
-			syslog(LOG_ERR, "nfssvc: unable to set SO_REUSEADDR: "
-				"errno %d (%s)\n", errno, strerror(errno));
-			exit(1);
-		}
-		if (bind(tcpfd, (struct  sockaddr  *)&sin, sizeof(sin)) < 0){
+	switch (nfsdfamily)	{
+	case AF_INET:
+		fd = open(NFSD_PORTS_FILE, O_WRONLY);
+		if (fd < 0)
+			return;
+		sin.sin_family = AF_INET;
+		sin.sin_port   = htons(port);
+		sin.sin_addr.s_addr =  inet_addr(haddr);
+
+		if (NFSCTL_UDPISSET(ctlbits)) {
+			udpfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+			if (udpfd < 0) {
+				syslog(LOG_ERR, "nfssvc: unable to create UPD socket: "
+					"errno %d (%s)\n", errno, strerror(errno));
+				exit(1);
+			}
+
+			if (bind(udpfd, (struct  sockaddr  *)&sin, sizeof(sin)) < 0){
+				syslog(LOG_ERR, "nfssvc: unable to bind UPD socket: "
+					"errno %d (%s)\n", errno, strerror(errno));
+				exit(1);
+			}
+		}
+
+		if (NFSCTL_TCPISSET(ctlbits)) {
+			tcpfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+			if (tcpfd < 0) {
+				syslog(LOG_ERR, "nfssvc: unable to createt tcp socket: "
+					"errno %d (%s)\n", errno, strerror(errno));
+				exit(1);
+			}
+			if (setsockopt(tcpfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) {
+				syslog(LOG_ERR, "nfssvc: unable to set SO_REUSEADDR: "
+					"errno %d (%s)\n", errno, strerror(errno));
+				exit(1);
+			}
+			if (bind(tcpfd, (struct  sockaddr  *)&sin, sizeof(sin)) < 0){
 			syslog(LOG_ERR, "nfssvc: unable to bind TCP socket: "
 				"errno %d (%s)\n", errno, strerror(errno));
 			exit(1);
-		}
-		if (listen(tcpfd, 64) < 0){
-			syslog(LOG_ERR, "nfssvc: unable to create listening socket: "
-				"errno %d (%s)\n", errno, strerror(errno));
-			exit(1);
-		}
+			}
+			if (listen(tcpfd, 64) < 0){
+				syslog(LOG_ERR, "nfssvc: unable to create listening socket: "
+				"errno %d (%s)\n", errno, strerror(errno));
+				exit(1);
+			}
+		}
+		break;	
+	case AF_INET6:
+		fd = open(NFSD_PORTS_FILE, O_WRONLY);
+                if (fd < 0)
+                        return;
+		sin6.sin6_family = AF_INET6;
+		sin6.sin6_port   = htons(port);
+                                       
+		if (strchr((char *) haddr,':')) {// IPv6
+			if (inet_pton(AF_INET6,haddr,&(sin6.sin6_addr)) <= 0) {
+				syslog(LOG_ERR, "nfssvc: unable to inet_pton:haddr=%s\n",haddr);
+				exit(1);
+			} 
+		} else {//IPV4
+			if (inet_pton(AF_INET,haddr,&(sin6.sin6_addr.s6_addr32[3])) <=0) {
+				syslog(LOG_ERR, "nfssvc: unable to inet_pton:haddr=%s\n",haddr);
+			    	exit(1);
+			} else {
+				sin6.sin6_addr.s6_addr32[0] = 0;
+				sin6.sin6_addr.s6_addr32[1] = 0;
+				sin6.sin6_addr.s6_addr32[2] = htonl(0x0000FFFF);
+			}
+
+		}
+
+                if (NFSCTL_UDPISSET(ctlbits)) {
+			udpfd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
+			if (udpfd < 0) {
+				syslog(LOG_ERR, "nfssvc: unable to create UPD socket: "
+				"errno %d (%s)\n", errno, strerror(errno));
+				exit(1);
+			}
+			if (bind(udpfd, (struct  sockaddr  *)&sin6, sizeof(sin6)) < 0){
+				syslog(LOG_ERR, "nfssvc: unable to bind UPD socket: "
+					"errno %d (%s)\n", errno, strerror(errno));
+				exit(1);
+			}
+		}
+		if (NFSCTL_TCPISSET(ctlbits)) {
+                        tcpfd = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
+                        if (tcpfd < 0) {
+                                syslog(LOG_ERR, "nfssvc: unable to createt tcp socket: "
+                                        "errno %d (%s)\n", errno, strerror(errno));
+                                exit(1);
+                        }
+                        if (setsockopt(tcpfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) {
+                                syslog(LOG_ERR, "nfssvc: unable to set SO_REUSEADDR: "
+                                        "errno %d (%s)\n", errno, strerror(errno));
+                                exit(1);
+                        }
+                        if (bind(tcpfd, (struct  sockaddr  *)&sin6, sizeof(sin6)) < 0){
+                        syslog(LOG_ERR, "nfssvc: unable to bind TCP socket: "
+                                "errno %d (%s)\n", errno, strerror(errno));
+                        exit(1);
+                	}
+                if (listen(tcpfd, 64) < 0){
+                        syslog(LOG_ERR, "nfssvc: unable to create listening socket: "
+                                "errno %d (%s)\n", errno, strerror(errno));
+                        exit(1);
+                	}
+		}
+		break;
+	default:
+		syslog(LOG_ERR, "nfssvc: unrecognized address family\n");
+                                exit(1);
 	}
 	if (udpfd >= 0) {
 		snprintf(buf, BUFSIZ,"%d\n", udpfd); 
@@ -144,7 +214,7 @@
 }
 int
 nfssvc(int port, int nrservs, unsigned int versbits, unsigned protobits,
-	char *haddr)
+	char *haddr, int nfsdfamily)
 {
 	struct nfsctl_arg	arg;
 	int fd;
@@ -154,7 +224,7 @@
 	 * versions
 	 */
 	nfssvc_versbits(versbits);
-	nfssvc_setfds(port, protobits, haddr);
+	nfssvc_setfds(port, protobits, haddr, nfsdfamily);
 
 	fd = open(NFSD_THREAD_FILE, O_WRONLY);
 	if (fd < 0)
diff -Nru nfs-utils.1.1.2-ipv6client/support/nfs/rpcmisc.c nfs-utils.1.1.2-ipv6server/support/nfs/rpcmisc.c
--- nfs-utils.1.1.2-ipv6client/support/nfs/rpcmisc.c	2008-09-18 13:55:04.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/nfs/rpcmisc.c	2008-09-18 14:42:38.000000000 +0200
@@ -33,11 +33,13 @@
 #include <unistd.h>
 #include <time.h>
 #include "nfslib.h"
+#include <tirpc/netconfig.h>
 
 #if SIZEOF_SOCKLEN_T - 0 == 0
 #define socklen_t int
 #endif
 
+int	bindport(int fd, int port, int af);
 static void	closedown(int sig);
 int	makesock(int port, int proto);
 
@@ -51,98 +53,216 @@
 	 void (*dispatch)(struct svc_req *, register SVCXPRT *),
 	 int defport)
 {
-	struct sockaddr_in saddr;
-	SVCXPRT	*transp;
-	int	sock;
-	socklen_t asize;
-
-	asize = sizeof(saddr);
-	sock = 0;
-	if (getsockname(0, (struct sockaddr *) &saddr, &asize) == 0
-	    && saddr.sin_family == AF_INET) {
-		socklen_t ssize = sizeof (int);
-		int fdtype = 0;
-		if (getsockopt(0, SOL_SOCKET, SO_TYPE,
-				(char *)&fdtype, &ssize) == -1)
-			xlog(L_FATAL, "getsockopt failed: %s", strerror(errno));
-		/* inetd passes a UDP socket or a listening TCP socket.
-		 * listen will fail on a connected TCP socket(passed by rsh).
-		 */
-		if (!(fdtype == SOCK_STREAM && listen(0,5) == -1)) {
-			_rpcfdtype = fdtype;
-			_rpcpmstart = 1;
-		}
-	}
-	if (!_rpcpmstart) {
-		pmap_unset(prog, vers);
-		sock = RPC_ANYSOCK;
-	}
-
-	if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_DGRAM)) {
-		static SVCXPRT *last_transp = NULL;
+ 	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;
  
-		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;
-	}
-
-	if ((_rpcfdtype == 0) || (_rpcfdtype == SOCK_STREAM)) {
-		static SVCXPRT *last_transp = 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);
-			}
-		}
-		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);
+ #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);
+ }
+  
+ int
+ bindport(int fd, int port, int af)
+ {
+ 	struct sockaddr_in	sin;
+ 	struct sockaddr_in6	sin6;
+  
+ 	if (port == 0)
+ 	        return bindresvport(fd, NULL);
+  
+ 	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;
+  			}
+  		}
+  		}
+ 		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)
 int sig;
@@ -166,24 +286,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 (proto == IPPROTO_TCP)
@@ -215,63 +337,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;
-		time_t time;
-		struct tm *tm;
-
-		unix_cred = (struct authunix_parms *) rqstp->rq_clntcred;
-		time = unix_cred->aup_time;
-		tm = localtime(&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.1.2-ipv6client/support/nfs/svc_socket.c nfs-utils.1.1.2-ipv6server/support/nfs/svc_socket.c
--- nfs-utils.1.1.2-ipv6client/support/nfs/svc_socket.c	2008-09-18 13:55:17.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/support/nfs/svc_socket.c	2008-09-18 13:37:41.000000000 +0200
@@ -38,15 +38,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 = NULL;
   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;
@@ -65,7 +65,7 @@
     }
 
   memset (&addr, 0, sizeof (addr));
-  addr.sin_family = AF_INET;
+  addr.sin6_family = AF_INET6;
 
   ret = getrpcbynumber_r (number, &rpcbuf, rpcdata, sizeof rpcdata,
 			  &rpcp);
@@ -91,7 +91,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"));
@@ -101,7 +101,7 @@
     }
   else
     {
-	  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.1.2-ipv6client/utils/exportfs/exportfs.c nfs-utils.1.1.2-ipv6server/utils/exportfs/exportfs.c
--- nfs-utils.1.1.2-ipv6client/utils/exportfs/exportfs.c	2008-09-18 13:56:51.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/utils/exportfs/exportfs.c	2008-09-18 13:39:06.000000000 +0200
@@ -19,6 +19,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"
@@ -94,6 +98,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) {
@@ -232,11 +240,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 != '/') {
@@ -244,21 +253,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)) ||
@@ -287,11 +302,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 != '/') {
@@ -301,10 +317,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.1.2-ipv6client/utils/mountd/auth.c nfs-utils.1.1.2-ipv6server/utils/mountd/auth.c
--- nfs-utils.1.1.2-ipv6client/utils/mountd/auth.c	2008-09-18 13:57:34.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/utils/mountd/auth.c	2008-09-18 13:43:22.000000000 +0200
@@ -42,7 +42,6 @@
 void
 auth_init(char *exports)
 {
-
 	export_file = exports;
 	auth_reload();
 	xtab_mount_write();
@@ -108,7 +107,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)
 {
@@ -118,10 +117,11 @@
 		int i;
 		/* return static nfs_export with details filled in */
 		char *n;
+		char str[INET6_ADDRSTRLEN];
 		free(my_client.m_hostname);
 		if (use_ipaddr) {
-			my_client.m_hostname =
-				strdup(inet_ntoa(caller->sin_addr));
+			inet_ntop(caller->sin6_family, (void *)&caller->sin6_addr, str,INET6_ADDRSTRLEN);
+			my_client.m_hostname = strdup(str);
 		} else {
 			n = client_compose(hp);
 			*error = unknown_host;
@@ -137,7 +137,7 @@
 		if (my_client.m_hostname == NULL)
 			return NULL;
 		my_client.m_naddr = 1;
-		my_client.m_addrlist[0] = caller->sin_addr;
+		memcpy(&my_client.m_addrlist[0], &caller->sin6_addr, sizeof(caller->sin6_addr));
 		my_exp.m_client = &my_client;
 
 		exp = NULL;
@@ -169,8 +169,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;
 	}
@@ -180,18 +180,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 = bad_path;
+	char		str[INET6_ADDRSTRLEN];
+ 
+ 	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;
 	}
 
@@ -199,7 +205,7 @@
 	epath[sizeof (epath) - 1] = '\0';
 	auth_fixpath(epath); /* strip duplicate '/' etc */
 
-	hp = client_resolve(caller->sin_addr);
+	hp = client_resolve(caller->sin6_addr);
 	if (!hp)
 		return exp;
 
@@ -218,13 +224,13 @@
 
 	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, 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, str, path, epath);
 		break;
 
 	case no_entry:
@@ -239,16 +245,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.1.2-ipv6client/utils/mountd/cache.c nfs-utils.1.1.2-ipv6server/utils/mountd/cache.c
--- nfs-utils.1.1.2-ipv6client/utils/mountd/cache.c	2008-09-18 13:57:52.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/utils/mountd/cache.c	2008-09-18 13:43:31.000000000 +0200
@@ -74,10 +74,12 @@
 	 */
 	char *cp;
 	char class[20];
-	char ipaddr[20];
+	char ipaddr[INET6_ADDRSTRLEN];
 	char *client = NULL;
-	struct in_addr addr;
+	struct in6_addr addr ;
+	struct in_addr addr4;
 	struct hostent *he = NULL;
+	int err=0;
 	if (readline(fileno(f), &lbuf, &lbuflen) != 1)
 		return;
 
@@ -89,11 +91,23 @@
 	    strcmp(class, "nfsd") != 0)
 		return;
 
-	if (qword_get(&cp, ipaddr, 20) <= 0)
-		return;
-
-	if (inet_aton(ipaddr, &addr)==0)
+	if (qword_get(&cp, ipaddr, INET6_ADDRSTRLEN) <= 0) 
 		return;
+	err = 0;
+	if (strchr((char *) ipaddr,':')) {// IPv6
+		if ((inet_pton(AF_INET6,ipaddr,&addr.s6_addr)) <=0 ) { 
+			xlog(L_ERROR, "auth_unix_ip: inet_pton() function IPv6 conversion fails\n");
+		}	
+	} else {// IPv4
+		if ((inet_pton(AF_INET,ipaddr,&addr4.s_addr)) >0) { 
+			printf("ipaddr is %s is  (IPv4)\n",ipaddr);
+			addr.s6_addr32[0] = 0;
+			addr.s6_addr32[1] = 0;
+			addr.s6_addr32[2] = htonl(0x0000FFFF);
+			addr.s6_addr32[3] = addr4.s_addr;
+		} else
+			xlog(L_ERROR, "auth_unix_ip: inet_pton() function IPv4 conversion fails\n");
+	}
 
 	auth_reload();
 
@@ -106,10 +120,12 @@
 	qword_print(f, "nfsd");
 	qword_print(f, ipaddr);
 	qword_printint(f, time(0)+30*60);
-	if (use_ipaddr)
+	if (use_ipaddr) {
 		qword_print(f, ipaddr);
-	else if (client)
+	}
+	else if (client){
 		qword_print(f, *client?client:"DEFAULT");
+	}
 	qword_eol(f);
 	xlog(D_CALL, "auth_unix_ip: client %p '%s'", client, client?client: "DEFAULT");
 
@@ -272,7 +288,7 @@
 	char fsid[32];
 	struct exportent *found = NULL;
 	struct hostent *he = NULL;
-	struct in_addr addr;
+	struct in6_addr addr;
 	char *found_path = NULL;
 	nfs_export *exp;
 	int i;
@@ -454,7 +470,7 @@
 			}
 			if (use_ipaddr) {
 				if (he == NULL) {
-					if (!inet_aton(dom, &addr))
+					if ((inet_pton(AF_INET6,dom, &addr)) <=0)
 						goto out;
 					he = client_resolve(addr);
 				}
@@ -611,7 +627,7 @@
 	char *dom, *path;
 	nfs_export *exp, *found = NULL;
 	int found_type = 0;
-	struct in_addr addr;
+	struct in6_addr addr;
 	struct hostent *he = NULL;
 
 
@@ -653,7 +669,7 @@
 				continue;
 			if (use_ipaddr) {
 				if (he == NULL) {
-					if (!inet_aton(dom, &addr))
+					if ((inet_pton(AF_INET6,dom, &addr)) <=0)
 						goto out;
 					he = client_resolve(addr);
 				}
@@ -824,13 +840,18 @@
 {
 	int err;
 	FILE *f;
+	char str[INET6_ADDRSTRLEN];
 
 	f = fopen("/proc/net/rpc/auth.unix.ip/channel", "w");
 	if (!f)
 		return -1;
 
 	qword_print(f, "nfsd");
-	qword_print(f, inet_ntoa(exp->m_client->m_addrlist[0]));
+	if (inet_ntop(AF_INET6, (void *)&exp->m_client->m_addrlist[0], str, sizeof(str))) {
+		qword_print(f, str);
+	} else {
+		xlog(L_ERROR, "cache_export: errno %d (%s)\n", errno, strerror(errno));
+	}
 	qword_printint(f, time(0)+30*60);
 	qword_print(f, exp->m_client->m_hostname);
 	err = qword_eol(f);
diff -Nru nfs-utils.1.1.2-ipv6client/utils/mountd/mountd.c nfs-utils.1.1.2-ipv6server/utils/mountd/mountd.c
--- nfs-utils.1.1.2-ipv6client/utils/mountd/mountd.c	2008-09-18 13:58:02.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/utils/mountd/mountd.c	2008-09-18 13:43:51.000000000 +0200
@@ -26,6 +26,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);
@@ -200,10 +202,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(D_CALL, "dump request from %s.", inet_ntoa(addr->sin_addr));
+	char str[INET6_ADDRSTRLEN];
+ 	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;
@@ -212,12 +217,14 @@
 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];
 
+	char str[INET6_ADDRSTRLEN];
+
 	if (*p == '\0')
 		p = "/";
 
@@ -233,7 +240,11 @@
 	if (!new_cache)
 		export_reset (exp);
 
-	mountlist_del(inet_ntoa(sin->sin_addr), p);
+	if (!inet_ntop(sin->sin6_family,(void *)&sin->sin6_addr,str,INET6_ADDRSTRLEN)) {
+		xlog(L_ERROR, "mount_umnt_1_svc: errno %d (%s)\n", errno, strerror(errno));
+	} else {
+		mountlist_del(str, p);
+	}
 	return 1;
 }
 
@@ -243,18 +254,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);
+ 	char str[INET6_ADDRSTRLEN];
+ 	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);
 
-	xlog(D_CALL, "export request from %s.", inet_ntoa(addr->sin_addr));
-	*resp = get_exportlist();
 		
 	return 1;
 }
@@ -262,10 +275,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(D_CALL, "exportall request from %s.", inet_ntoa(addr->sin_addr));
+ 	char str[INET6_ADDRSTRLEN];
+ 	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;
@@ -285,8 +301,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];
@@ -361,12 +377,13 @@
 static struct nfs_fh_len *
 get_rootfh(struct svc_req *rqstp, dirpath *path, mountstat3 *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];
 	char		*p = *path;
+	char str[INET6_ADDRSTRLEN];
 
 	if (*p == '\0')
 		p = "/";
@@ -426,7 +443,13 @@
 			*error = NFSERR_ACCES;
 		else {
 			*error = NFS_OK;
-			mountlist_add(inet_ntoa(sin->sin_addr), p);
+		        if (!inet_ntop(sin->sin6_family,(void *)&sin->sin6_addr,str,INET6_ADDRSTRLEN)) { 
+				xlog(L_ERROR, "get_rootfh: errno %d (%s)\n", errno, strerror(errno));
+				*error = NFSERR_ACCES;
+				return NULL;
+			} else {
+				mountlist_add(str, p);
+			}
 		}
 		return fh;
 	} else {
@@ -448,8 +471,13 @@
 						stb.st_dev, stb.st_ino);
 		}
 		if (fh != NULL) {
-			mountlist_add(inet_ntoa(sin->sin_addr), p);
-			*error = NFS_OK;
+                        if (!inet_ntop(sin->sin6_family,(void *)&sin->sin6_addr,str,INET6_ADDRSTRLEN)) {
+				xlog(L_ERROR, "get_rootfh: errno %d (%s)\n", errno, strerror(errno));
+				*error = NFSERR_ACCES;
+			} else {
+                        	mountlist_add(str, p);
+				*error = NFS_OK;
+			}
 			export_reset (exp);
 			return fh;
 		}
@@ -682,6 +710,9 @@
 	if (!foreground)
 		closeall(3);
 
+	res_init();
+	_res.options |= RES_USE_INET6;
+
 	new_cache = check_new_cache();
 	if (new_cache)
 		cache_open();
diff -Nru nfs-utils.1.1.2-ipv6client/utils/mountd/mountd.h nfs-utils.1.1.2-ipv6server/utils/mountd/mountd.h
--- nfs-utils.1.1.2-ipv6client/utils/mountd/mountd.h	2008-09-18 13:58:11.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/utils/mountd/mountd.h	2008-09-18 13:43:58.000000000 +0200
@@ -41,13 +41,13 @@
 void		mount_dispatch(struct svc_req *, SVCXPRT *);
 void		auth_init(char *export_file);
 unsigned 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.1.2-ipv6client/utils/mountd/rmtab.c nfs-utils.1.1.2-ipv6server/utils/mountd/rmtab.c
--- nfs-utils.1.1.2-ipv6client/utils/mountd/rmtab.c	2008-09-18 13:58:23.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/utils/mountd/rmtab.c	2008-09-18 13:44:09.000000000 +0200
@@ -130,9 +130,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;
@@ -141,10 +141,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[INET6_ADDRSTRLEN];
+	    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);
diff -Nru nfs-utils.1.1.2-ipv6client/utils/nfsd/nfsd.c nfs-utils.1.1.2-ipv6server/utils/nfsd/nfsd.c
--- nfs-utils.1.1.2-ipv6client/utils/nfsd/nfsd.c	2008-09-18 13:58:43.000000000 +0200
+++ nfs-utils.1.1.2-ipv6server/utils/nfsd/nfsd.c	2008-09-18 13:44:50.000000000 +0200
@@ -49,6 +49,13 @@
 	int	count = 1, c, error, port, fd, found_one;
 	struct servent *ent;
 	struct hostent *hp;
+	int nfsdfamily = AF_INET;
+
+	FILE *file = fopen("/proc/net/if_inet6", "r");
+	if (file != NULL) {
+		nfsdfamily = AF_INET6;
+		fclose(file);
+	};
 
 	ent = getservbyname ("nfs", "udp");
 	if (ent != NULL)
@@ -56,7 +63,7 @@
 	else
 		port = 2049;
 
-	while ((c = getopt_long(argc, argv, "H:hN:p:P:TU", longopts, NULL)) != EOF) {
+	while ((c = getopt_long(argc, argv, "H:hN:p:P:TU46", longopts, NULL)) != EOF) {
 		switch(c) {
 		case 'H':
 			if (inet_addr(optarg) != INADDR_NONE) {
@@ -96,6 +103,12 @@
 		case 'U':
 				NFSCTL_UDPUNSET(protobits);
 				break;
+		case '4':
+			nfsdfamily = AF_INET;
+			break;
+		case '6':
+			nfsdfamily = AF_INET6;
+			break;
 		default:
 			fprintf(stderr, "Invalid argument: '%c'\n", c);
 		case 'h':
@@ -124,8 +137,16 @@
 		exit(1);
 	}
 	if (haddr == NULL) {
-		struct in_addr in = {INADDR_ANY}; 
-		haddr = strdup(inet_ntoa(in));
+		if (nfsdfamily==AF_INET) {
+			struct in_addr in = {INADDR_ANY}; 
+			haddr = strdup(inet_ntoa(in));
+		}
+		if (nfsdfamily==AF_INET6) {
+			struct in6_addr in6 = {IN6ADDR_ANY_INIT};
+			char str[INET6_ADDRSTRLEN];
+			inet_ntop(AF_INET6,&in6, &str, sizeof(str));
+			haddr=strdup(&str);
+		}	
 	}
 
 	if (chdir(NFS_STATEDIR)) {
@@ -158,7 +179,7 @@
 	closeall(3);
 
 	openlog("nfsd", LOG_PID, LOG_DAEMON);
-	if ((error = nfssvc(port, count, versbits, protobits, haddr)) < 0) {
+	if ((error = nfssvc(port, count, versbits, protobits, haddr, nfsdfamily)) < 0) {
 		int e = errno;
 		syslog(LOG_ERR, "nfssvc: %s", strerror(e));
 		closelog();
@@ -171,7 +192,7 @@
 usage(const char *prog)
 {
 	fprintf(stderr, "Usage:\n"
-		"%s [-H hostname] [-p|-P|--port port] [-N|--no-nfs-version version ] [-T|--no-tcp] [-U|--no-udp] nrservs\n", 
+		"%s [-H hostname] [-p|-P|--port port] [-N|--no-nfs-version version ] [-T|--no-tcp] [-U|--no-udp] [-4|-6] nrservs\n", 
 		prog);
 	exit(2);
 }

