diff -Nru util-linux-2.12-3/mount/Makefile util-linux-2.12-3-gq/mount/Makefile
--- util-linux-2.12-3/mount/Makefile	2005-03-21 08:36:53.000000000 +0100
+++ util-linux-2.12-3-gq/mount/Makefile	2005-03-21 08:59:34.000000000 +0100
@@ -7,8 +7,9 @@
 RPC_CFLAGS = -Wno-unused 
 RPCGEN = rpcgen
 
-COMPILE = $(CC) -c $(CFLAGS) $(DEFINES)
-LINK = $(CC) $(LDFLAGS)
+COMPILE = $(CC) -I/usr/include/tirpc -c $(CFLAGS) $(DEFINES)
+LINK = $(CC)
+LDFLAGS = -lpthread -ltirpc
 
 ifeq "$(OS)" "linux"
 SUID_PROGS = mount umount
@@ -47,11 +48,11 @@
 mount: mount.o fstab.o sundries.o realpath.o mntent.o version.o \
        mount_guess_fstype.o get_label_uuid.o mount_by_label.o getusername.o \
        $(LIB)/setproctitle.o $(LIB)/env.o $(NFS_OBJS) $(LO_OBJS)
-	$(LINK) $^ -o $@
+	$(LINK) $^ -o $@ $(LDFLAGS)
 
 umount: umount.o fstab.o sundries.o realpath.o mntent.o getusername.o \
 	get_label_uuid.o version.o $(LIB)/env.o $(NFS_OBJS) $(LO_OBJS)
-	$(LINK) $^ -o $@
+	$(LINK) $^ -o $@ $(LDFLAGS)
 
 swapon:	swapon.o version.o
 	$(LINK) $^ -o $@
diff -Nru util-linux-2.12-3/mount/nfs4mount.c util-linux-2.12-3-gq/mount/nfs4mount.c
--- util-linux-2.12-3/mount/nfs4mount.c	2005-03-21 08:36:53.000000000 +0100
+++ util-linux-2.12-3-gq/mount/nfs4mount.c	2005-03-21 08:59:48.000000000 +0100
@@ -49,13 +49,17 @@
 #include "mount_constants.h"
 #include "nfs4_mount.h"
 
+#include "sock.h"
+
 #include "nls.h"
 
 #ifndef NFS_PORT
 #define NFS_PORT 2049
 #endif
 
-extern int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int);
+extern int clnt_ping(struct sockaddr *, const u_long, const u_long, const u_int);
+extern int nfs_gethostbyname(const char *, unsigned short, struct sockaddr *);
+
 extern void rpc_strerror(void);
 
 struct {
@@ -113,7 +117,7 @@
 {
 	char *s;
 
-	if (!(s = strchr(hostdir, ':'))) {
+	if (!(s = strrchr(hostdir, ':'))) {
 		fprintf(stderr,
 			_("mount: "
 			  "directory to mount not in host:dir format\n"));
@@ -133,40 +137,21 @@
 	return 0;
 }
 
-static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr)
-{
-	struct hostent *hp;
-	addr->sin_family = AF_INET;
-
-	if (inet_aton(hostname, &addr->sin_addr))
-		return 0;
-	if ((hp = gethostbyname(hostname)) == NULL) {
-		fprintf(stderr, _("mount: can't get address for %s\n"),
-			hostname);
-		return -1;
-	}
-	if (hp->h_length > sizeof(struct in_addr)) {
-		fprintf(stderr,
-			_("mount: got bad hp->h_length\n"));
-		hp->h_length = sizeof(struct in_addr);
-	}
-	memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
-	return 0;
-}
-
-static int get_my_ipv4addr(char *ip_addr, int len)
+static int get_my_ipaddr(unsigned short family, char *ip_addr, int len)
 {
 	char myname[1024];
-	struct sockaddr_in myaddr;
+	struct sockaddr_storage addr;
+	struct sockaddr *myaddr = (struct sockaddr *)&addr;
 
 	if (gethostname(myname, sizeof(myname))) {
 		fprintf(stderr, _("mount: can't determine client address\n"));
 		return -1;
 	}
-	if (fill_ipv4_sockaddr(myname, &myaddr))
+	if (!nfs_gethostbyname(myname, family,  myaddr))
 		return -1;
-	snprintf(ip_addr, len, "%s", inet_ntoa(myaddr.sin_addr));
+	inet_ntop(myaddr->sa_family, _get_addr(myaddr), ip_addr, len);
 	ip_addr[len-1] = '\0';
+	printf("ip_addr = %s\n", ip_addr);	// GQ
 	return 0;
 }
 
@@ -176,15 +161,15 @@
 {
 	static struct nfs4_mount_data data;
 	static char hostdir[1024];
-	static char ip_addr[16] = "127.0.0.1";
-	static struct sockaddr_in server_addr;
+	static char ip_addr[80];	// GQ size TBC
+	static struct sockaddr_storage server_addr;
 	static int pseudoflavour[MAX_USER_FLAVOUR];
 	int num_flavour = 0;
 
 	char *hostname, *dirname, *old_opts;
 	char new_opts[1024];
 	char *opt, *opteq;
-	char *s;
+	char str[40];	// GQ size TBC
 	int val;
 	int bg, soft, intr;
 	int nocto, noac;
@@ -201,23 +186,25 @@
 	if (parse_devname(hostdir, &hostname, &dirname))
 		goto fail;
 
-	if (fill_ipv4_sockaddr(hostname, &server_addr))
-		goto fail;
-	if (get_my_ipv4addr(ip_addr, sizeof(ip_addr)))
+	printf("hostname = %s\n", hostname);
+	if (!nfs_gethostbyname(hostname, PF_UNSPEC, (struct sockaddr *)&server_addr))
 		goto fail;
 
 	/* add IP address to mtab options for use when unmounting */
-	s = inet_ntoa(server_addr.sin_addr);
+	inet_ntop(server_addr.ss_family,
+		  _get_addr((struct sockaddr *)&server_addr),
+		  str, sizeof(str));
+	printf("servaddr = %s\n", str);
 	old_opts = *extra_opts;
 	if (!old_opts)
 		old_opts = "";
-	if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
+	if (strlen(old_opts) + strlen(str) + 10 >= sizeof(new_opts)) {
 		fprintf(stderr, _("mount: "
 				  "excessively long option argument\n"));
 		goto fail;
 	}
 	snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s",
-		 old_opts, *old_opts ? "," : "", s);
+		 old_opts, *old_opts ? "," : "", str);
 	*extra_opts = xstrdup(new_opts);
 
 	/* Set default options.
@@ -242,10 +229,11 @@
 	/*
 	 * NFSv4 specifies that the default port should be 2049
 	 */
-	server_addr.sin_port = htons(NFS_PORT);
+	_set_port((struct sockaddr *)&server_addr, NFS_PORT);
 
 	/* parse options */
 
+	ip_addr[0] = '\0';
 	for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
 		if ((opteq = strchr(opt, '='))) {
 			val = atoi(opteq + 1);
@@ -275,7 +263,7 @@
 			else if (!strcmp(opt, "retry"))
 				retry = val;
 			else if (!strcmp(opt, "port"))
-				server_addr.sin_port = htons(val);
+				_set_port((struct sockaddr *)&server_addr, val);
 			else if (!strcmp(opt, "proto")) {
 				if (!strncmp(opteq+1, "tcp", 3))
 					data.proto = IPPROTO_TCP;
@@ -330,6 +318,12 @@
 		}
 	}
 
+	printf("ip_addr = %s\n", ip_addr);
+	if (ip_addr[0] == '\0' && get_my_ipaddr(server_addr.ss_family, ip_addr,
+		    				sizeof(ip_addr)))
+		goto fail;
+	printf("ip_addr = %s\n", ip_addr);
+
 	data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
 		| (intr ? NFS4_MOUNT_INTR : 0)
 		| (nocto ? NFS4_MOUNT_NOCTO : 0)
@@ -349,7 +343,7 @@
 	data.hostname.data = hostname;
 	data.hostname.len = strlen(hostname);
 	data.host_addr = (struct sockaddr *)&server_addr;
-	data.host_addrlen = sizeof(server_addr);
+	data.host_addrlen = _get_addrlen((struct sockaddr *)&server_addr);
 
 #ifdef NFS_MOUNT_DEBUG
 	printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
@@ -357,7 +351,7 @@
 	printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
 	       data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
 	printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
-	       ntohs(server_addr.sin_port), bg, retry, data.flags);
+	       _get_port(&server_addr), bg, retry, data.flags);
 	printf("soft = %d, intr = %d, nocto = %d, noac = %d\n",
 	       (data.flags & NFS4_MOUNT_SOFT) != 0,
 	       (data.flags & NFS4_MOUNT_INTR) != 0,
@@ -383,7 +377,7 @@
 
 	data.version = NFS4_MOUNT_VERSION;
 
-	clnt_ping(&server_addr, NFS_PROGRAM, 4, data.proto);
+	clnt_ping((struct sockaddr *)&server_addr, NFS_PROGRAM, 4, data.proto);
 	if (rpc_createerr.cf_stat) {
 		fprintf(stderr, "mount to NFS server '%s' failed.\n", data.hostname.data);
 		goto fail;
diff -Nru util-linux-2.12-3/mount/nfs_mount4.h util-linux-2.12-3-gq/mount/nfs_mount4.h
--- util-linux-2.12-3/mount/nfs_mount4.h	2005-03-21 08:36:53.000000000 +0100
+++ util-linux-2.12-3-gq/mount/nfs_mount4.h	2005-03-21 08:59:34.000000000 +0100
@@ -8,7 +8,7 @@
  * so it is easiest to ignore the kernel altogether (at compile time).
  */
 
-#define NFS_MOUNT_VERSION 6
+#define NFS_MOUNT_VERSION 7
 #define NFS_MAX_CONTEXT_LEN   256
 
 
@@ -40,6 +40,9 @@
 	struct nfs3_fh	root;			/* 4 */
 	int		pseudoflavor;		/* 5 */
 	char    context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */
+	/* Server IP address */
+	unsigned int	host_addrlen;		/* 7 */
+	struct sockaddr* host_addr;		/* 7 */
 
 };
 
diff -Nru util-linux-2.12-3/mount/nfsmount.c util-linux-2.12-3-gq/mount/nfsmount.c
--- util-linux-2.12-3/mount/nfsmount.c	2005-03-21 08:36:53.000000000 +0100
+++ util-linux-2.12-3-gq/mount/nfsmount.c	2005-03-21 08:59:46.000000000 +0100
@@ -44,6 +44,7 @@
 #include <rpc/rpc.h>
 #include <rpc/pmap_prot.h>
 #include <rpc/pmap_clnt.h>
+#include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <sys/utsname.h>
@@ -64,6 +65,8 @@
 #include "mount_constants.h"
 #include "nfs_mount4.h"
 
+#include <netconfig.h>
+#include "sock.h"
 #include "nls.h"
 
 #ifndef NFS_PORT
@@ -101,7 +104,7 @@
 
 typedef struct {
 	char **hostname;
-	struct sockaddr_in saddr;
+	struct sockaddr_storage saddr;
 	struct pmap pmap;
 } clnt_addr_t;
 
@@ -111,7 +114,9 @@
 
 static int nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp);
 
-int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int);
+void rpc_strerror(void);
+int nfs_gethostbyname(const char *, unsigned short, struct sockaddr *);
+int clnt_ping(struct sockaddr *, const u_long, const u_long, const u_int);
 
 /* Convert RPC errors into strings */
 void rpc_strerror(void)
@@ -234,33 +239,32 @@
 		  mnt_version = 3;
 	     else if (kernel_version < MAKE_VERSION(2,6,3))
 		  mnt_version = 4;
-	     else
+	     else if (kernel_version < MAKE_VERSION(2,6,11))	// GQ
 		  mnt_version = 6;
+	     else
+		  mnt_version = 7;
 	}
 	if (mnt_version > NFS_MOUNT_VERSION)
 	     mnt_version = NFS_MOUNT_VERSION;
 	return mnt_version;
 }
 
-static int
-nfs_gethostbyname(const char *hostname, struct sockaddr_in *saddr)
+int
+nfs_gethostbyname(const char *hostname, unsigned short family, struct sockaddr *saddr)
 {
-	struct hostent *hp;
+	struct addrinfo hints;
+	struct addrinfo *res;
 
-	saddr->sin_family = AF_INET;
-	if (!inet_aton(hostname, &saddr->sin_addr)) {
-		if ((hp = gethostbyname(hostname)) == NULL) {
-			fprintf(stderr, _("mount: can't get address for %s\n"),
-				hostname);
-			return 0;
-		} else {
-			if (hp->h_length > sizeof(*saddr)) {
-				fprintf(stderr,
-					_("mount: got bad hp->h_length\n"));
-				hp->h_length = sizeof(*saddr);
-			}
-			memcpy(&saddr->sin_addr, hp->h_addr, hp->h_length);
-		}
+	memset(&hints, '\0', sizeof(struct addrinfo));
+	hints.ai_family = family;
+	if (getaddrinfo(hostname, NULL, &hints, &res) != 0) {
+		fprintf(stderr, _("mount: can't get address for %s\n"),
+			hostname);
+		return 0;
+	}
+	if (res) {
+		memcpy(saddr, res->ai_addr, res->ai_addrlen);
+		freeaddrinfo(res);
 	}
 	return 1;
 }
@@ -272,28 +276,24 @@
  * RPC call.
  */
 int
-clnt_ping(struct sockaddr_in *saddr, const u_long prog, const u_long vers,
+clnt_ping(struct sockaddr *saddr, const u_long prog, const u_long vers,
 	  const u_int prot)
 {
-	CLIENT *clnt=NULL;
-	int sock, stat;
+	CLIENT *clnt = NULL;
+	struct netconfig *nconf;
+	struct netbuf bindaddr;
+	int stat;
 	static char clnt_res;
 
 	rpc_createerr.cf_stat = stat = 0;
-	sock = RPC_ANYSOCK;
-	switch(prot) {
-	case IPPROTO_UDP:
-		clnt = clntudp_bufcreate(saddr, prog, vers,
-					 RETRY_TIMEOUT, &sock,
-					 RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
-		break;
-	case IPPROTO_TCP:
-		clnt = clnttcp_create(saddr, prog, vers, &sock,
-				      RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
-		break;
-	default:
+	nconf = _getnetconfig(saddr, prot);
+	if (!nconf)
 		goto out_bad;
-	}
+	bindaddr.buf = saddr;
+	bindaddr.maxlen = bindaddr.len = _get_addrlen(saddr);
+	clnt = clnt_tli_create(RPC_ANYFD, nconf, &bindaddr, prog, vers,
+			       RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
+	freenetconfigent(nconf);
 	if (!clnt)
 		goto out_bad;
 	memset(&clnt_res, 0, sizeof(clnt_res));
@@ -302,7 +302,6 @@
 			 (xdrproc_t)xdr_void, (caddr_t)&clnt_res,
 			 TIMEOUT);
 	clnt_destroy(clnt);
-	close(sock);
 	if (stat != RPC_PROGVERSMISMATCH)
 		return 1;
 
@@ -313,14 +312,16 @@
 /*
  * Use the portmapper to discover whether or not the service we want is
  * available. The lists 'versions' and 'protos' define ordered sequences
+:q
  * of service versions and udp/tcp protocols to probe for.
  */
+
 static int
 probe_port(clnt_addr_t *server,
 	   const u_long *versions,
 	   const u_int *protos)
 {
-	struct sockaddr_in *saddr = &server->saddr;
+	struct sockaddr *saddr = (struct sockaddr *)&server->saddr;
 	struct pmap *pmap = &server->pmap;
 	const u_long prog = pmap->pm_prog,
 		vers = pmap->pm_vers,
@@ -329,20 +330,41 @@
 		*p_prot;
 	const u_short port = (u_short) pmap->pm_port;
 	u_short p_port;
+	struct netconfig *nconf;
+	char host[64];
+	struct netbuf addrbuf;
+
 	p_prot = prot ? &prot : protos;
 	p_vers = vers ? &vers : versions;
 	rpc_createerr.cf_stat = 0;
+
+	inet_ntop(saddr->sa_family, _get_addr(saddr),
+		  host, sizeof(host));
+	addrbuf.maxlen = _get_addrlen(saddr);
+	addrbuf.buf = (char *) malloc(addrbuf.maxlen);
+	if (!addrbuf.buf){
+		fprintf(stderr, "nfsmount impossible to alloc memory\n");
+		return 0;
+	}
+
 	for (;;) {
-		saddr->sin_port = htons(PMAPPORT);
-		p_port = pmap_getport(saddr, prog, *p_vers, *p_prot);
-		if (p_port) {
-			if (!port || port == p_port) {
-				saddr->sin_port = htons(port);
-				if (clnt_ping(saddr, prog, *p_vers, *p_prot))
-					goto out_ok;
+		nconf = _getnetconfig(saddr, *p_prot);
+		if (nconf &&
+		    rpcb_getaddr(prog, *p_vers, nconf, &addrbuf, host)) {
+			p_port = _get_port((struct sockaddr *)addrbuf.buf);
+			if (p_port) {
+				if (!port || port == p_port) {
+					// GQ TBC
+					_set_port(saddr, p_port);
+					if (clnt_ping(saddr, prog,
+						      *p_vers, *p_prot))
+						goto out_ok;
+				}
 			}
-		} else if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED)
-			break;
+			else if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED)
+				break;
+		}
+		freenetconfigent(nconf);
 		if (!prot) {
 			if (*++p_prot)
 				continue;
@@ -429,50 +451,57 @@
 }
 
 static CLIENT *
-mnt_openclnt(clnt_addr_t *mnt_server, int *msock, const int report_errs)
+mnt_openclnt(clnt_addr_t *mnt_server, const int report_errs)
 {
-	struct sockaddr_in *mnt_saddr = &mnt_server->saddr;
+	struct sockaddr *mnt_saddr = (struct sockaddr *)&mnt_server->saddr;
 	struct pmap *mnt_pmap = &mnt_server->pmap;
+	struct netconfig *nconf;
+	struct timeval pertry;
+	socklen_t saddrlen;
+	char hostname[NI_MAXHOST];
 	CLIENT *clnt;
 
 	/* contact the mount daemon via TCP */
-	mnt_saddr->sin_port = htons((u_short)mnt_pmap->pm_port);
-	*msock = RPC_ANYSOCK;
+	saddrlen = _get_addrlen(mnt_saddr);
+	if (getnameinfo(mnt_saddr, saddrlen, hostname, sizeof(hostname),
+			NULL, 0, NI_NUMERICHOST) != 0) {
+		goto out_bad;
+	}
+	printf("nfsmount: hostname = %s\n", hostname);
 
-	switch (mnt_pmap->pm_prot) {
-	case IPPROTO_UDP:
-		clnt = clntudp_bufcreate(mnt_saddr,
-					 mnt_pmap->pm_prog, mnt_pmap->pm_vers,
-					 RETRY_TIMEOUT, msock,
-					 MNT_SENDBUFSIZE, MNT_RECVBUFSIZE);
-		break;
-	case IPPROTO_TCP:
-		clnt = clnttcp_create(mnt_saddr,
-				      mnt_pmap->pm_prog, mnt_pmap->pm_vers,
-				      msock,
-				      MNT_SENDBUFSIZE, MNT_RECVBUFSIZE);
-		break;
-	default:
+        nconf = _getnetconfig(mnt_saddr, mnt_pmap->pm_prot);
+        saddrlen = _get_addrlen(mnt_saddr);
+	_set_port(mnt_saddr, (u_short)mnt_pmap->pm_port);
+	if (!nconf) {
+		if (report_errs)
+			nc_perror("mount");
 		goto out_bad;
 	}
+	clnt = clnt_tp_create(hostname, mnt_pmap->pm_prog, mnt_pmap->pm_vers,
+			      nconf);
 	if (!clnt)
 		goto report_err;
-	/* try to mount hostname:dirname */
+	if (strcmp(nconf->nc_proto, "udp")) {
+		pertry.tv_sec = 3;
+		pertry.tv_usec = 0;
+		clnt_control(clnt, CLSET_TIMEOUT, (char *) &pertry);
+	}
 	clnt->cl_auth = authunix_create_default();
+	freenetconfigent(nconf);
 	return clnt;
  report_err:
 	if (report_errs)
 		clnt_pcreateerror("mount");
+	freenetconfigent(nconf);
  out_bad:
 	return NULL;
 }
 
 static inline void
-mnt_closeclnt(CLIENT *clnt, int msock)
+mnt_closeclnt(CLIENT *clnt)
 {
 	auth_destroy(clnt->cl_auth);
 	clnt_destroy(clnt);
-	close(msock);
 }
 
 static inline enum clnt_stat
@@ -499,7 +528,6 @@
 {
 	CLIENT *clnt;
 	enum clnt_stat stat;
-	int msock;
 
 	if (!probe_bothports(mnt_server, nfs_server)) {
 		if (report_errs) {
@@ -521,7 +549,7 @@
 		goto out_bad;
 	}
 
-	clnt = mnt_openclnt(mnt_server, &msock, report_errs);
+	clnt = mnt_openclnt(mnt_server, report_errs);
 	if (!clnt)
 		goto out_bad;
 	/* make pointers in xdr_mountres3 NULL so
@@ -541,7 +569,7 @@
 	}
 	if (stat != RPC_SUCCESS && report_errs)
 		clnt_perror(clnt, "mount");
-	mnt_closeclnt(clnt, msock);
+	mnt_closeclnt(clnt);
 	if (stat == RPC_SUCCESS)
 		return 1;
  out_bad:
@@ -553,7 +581,7 @@
 	      int *bg, int *retry, clnt_addr_t *mnt_server,
 	      clnt_addr_t *nfs_server, char *new_opts, const int opt_size)
 {
-	struct sockaddr_in *mnt_saddr = &mnt_server->saddr;
+	struct sockaddr *mnt_saddr = (struct sockaddr *)&mnt_server->saddr;
 	struct pmap *mnt_pmap = &mnt_server->pmap;
 	struct pmap *nfs_pmap = &nfs_server->pmap;
 	int len;
@@ -774,7 +802,7 @@
 	}
 	/* See if the nfs host = mount host. */
 	if (mounthost) {
-		if (!nfs_gethostbyname(mounthost, mnt_saddr))
+		if (!nfs_gethostbyname(mounthost, PF_UNSPEC, mnt_saddr))
 			goto out_bad;
 		*mnt_server->hostname = mounthost;
 	}
@@ -822,7 +850,8 @@
 
 	clnt_addr_t mnt_server = { &mounthost, };
 	clnt_addr_t nfs_server = { &hostname, };
-	struct sockaddr_in *nfs_saddr = &nfs_server.saddr;
+	struct sockaddr *nfs_saddr = (struct sockaddr *)&nfs_server.saddr;
+	size_t saddr_len = 0;
 	struct pmap  *mnt_pmap = &mnt_server.pmap,
 		     *nfs_pmap = &nfs_server.pmap;
 	struct pmap  save_mnt, save_nfs;
@@ -833,6 +862,7 @@
 
 	struct stat statbuf;
 	char *s;
+	char str[64];
 	int bg, retry;
 	int retval;
 	time_t t;
@@ -853,7 +883,7 @@
 		goto fail;
 	}
 	strcpy(hostdir, spec);
-	if ((s = strchr(hostdir, ':'))) {
+	if ((s = strrchr(hostdir, ':'))) {
 		hostname = hostdir;
 		dirname = s + 1;
 		*s = '\0';
@@ -872,14 +902,11 @@
 		goto fail;
 	}
 
-	if (!nfs_gethostbyname(hostname, nfs_saddr))
+	if (!nfs_gethostbyname(hostname, PF_UNSPEC, nfs_saddr))
 		goto fail;
 	mounthost = hostname;
-	memcpy (&mnt_server.saddr, nfs_saddr, sizeof (mnt_server.saddr));
-
-	/* add IP address to mtab options for use when unmounting */
+	memcpy (&mnt_server.saddr, (void *)nfs_saddr, sizeof (mnt_server.saddr));
 
-	s = inet_ntoa(nfs_saddr->sin_addr);
 	old_opts = *extra_opts;
 	if (!old_opts)
 		old_opts = "";
@@ -1091,9 +1118,9 @@
 	/* create nfs socket for kernel */
 
 	if (nfs_pmap->pm_prot == IPPROTO_TCP)
-		fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+		fsock = socket(nfs_saddr->sa_family, SOCK_STREAM, IPPROTO_TCP);
 	else
-		fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+		fsock = socket(nfs_saddr->sa_family, SOCK_DGRAM, IPPROTO_UDP);
 	if (fsock < 0) {
 		perror(_("nfs socket"));
 		goto fail;
@@ -1105,15 +1132,16 @@
 #ifdef NFS_MOUNT_DEBUG
 	printf(_("using port %d for nfs deamon\n"), nfs_pmap->pm_port);
 #endif
-	nfs_saddr->sin_port = htons(nfs_pmap->pm_port);
+	_set_port(nfs_saddr, nfs_pmap->pm_port);
+	saddr_len = _get_addrlen(nfs_saddr);
+
 	/*
 	 * connect() the socket for kernels 1.3.10 and below only,
 	 * to avoid problems with multihomed hosts.
 	 * --Swen
 	 */
 	if (linux_version_code() <= 66314
-	    && connect(fsock, (struct sockaddr *) nfs_saddr,
-		       sizeof (*nfs_saddr)) < 0) {
+	    && connect(fsock, nfs_saddr, saddr_len) < 0) {
 		perror(_("nfs connect"));
 		goto fail;
 	}
@@ -1128,18 +1156,32 @@
 	/* prepare data structure for kernel */
 
 	data.fd = fsock;
-	memcpy((char *) &data.addr, (char *) nfs_saddr, sizeof(data.addr));
+	if (nfs_saddr->sa_family == AF_INET) {
+		memcpy((char *) &data.addr, (char *) nfs_saddr,
+		       sizeof(data.addr));
+	}
+	else if (nfs_mount_version < 7) {
+	       fprintf(stderr, _("mount: "
+				 "unsupported address family\n"));
+	   	goto fail;
+	}
+	if (nfs_mount_version >= 7) {
+		data.host_addr = nfs_saddr;
+		data.host_addrlen = _get_addrlen(nfs_saddr);
+	}
 	strncpy(data.hostname, hostname, sizeof(data.hostname));
 
  out_ok:
+	inet_ntop(nfs_saddr->sa_family, _get_addr(nfs_saddr), str, sizeof(str));
+
 	/* Ensure we have enough padding for the following strcat()s */
-	if (strlen(new_opts) + strlen(s) + 30 >= sizeof(new_opts)) {
+	if (strlen(new_opts) + strlen(str) + 30 >= sizeof(new_opts)) {
 		fprintf(stderr, _("mount: "
 				  "excessively long option argument\n"));
 		goto fail;
 	}
 
-	sprintf(cbuf, "addr=%s", s);
+	sprintf(cbuf, "addr=%s", str);
 	strcat(new_opts, cbuf);
 
 	*extra_opts = xstrdup(new_opts);
@@ -1179,9 +1221,8 @@
 {
 	CLIENT *clnt;
 	enum clnt_stat res = 0;
-	int msock;
 
-	clnt = mnt_openclnt(mnt_server, &msock, 1);
+	clnt = mnt_openclnt(mnt_server, 1);
 	if (!clnt)
 		goto out_bad;
 	switch (mnt_server->pmap.pm_vers) {
@@ -1195,7 +1236,7 @@
 	default:
 		break;
 	}
-	mnt_closeclnt(clnt, msock);
+	mnt_closeclnt(clnt);
 	if (res == RPC_SUCCESS)
 		return 1;
  out_bad:
@@ -1251,7 +1292,7 @@
 	if (opts && (p = strstr(opts, "mountvers=")) && isdigit(*(p+10)))
 		pmap->pm_vers = atoi(p+10);
 
-	if (!nfs_gethostbyname(hostname, &mnt_server.saddr))
+	if (!nfs_gethostbyname(hostname, PF_UNSPEC, (struct sockaddr *)&mnt_server.saddr))
 		goto out_bad;
 	if (!probe_mntport(&mnt_server))
 		goto out_bad;
diff -Nru util-linux-2.12-3/mount/sock.h util-linux-2.12-3-gq/mount/sock.h
--- util-linux-2.12-3/mount/sock.h	1970-01-01 01:00:00.000000000 +0100
+++ util-linux-2.12-3-gq/mount/sock.h	2005-03-21 08:59:34.000000000 +0100
@@ -0,0 +1,62 @@
+#ifndef _SOCK_H
+#define _SOCK_H
+
+static inline u_short _get_port(struct sockaddr *sin)
+{
+	u_short port;
+
+	if (sin->sa_family == AF_INET)
+		port = ((struct sockaddr_in *)sin)->sin_port;
+	else if (sin->sa_family == AF_INET6)
+		port = ((struct sockaddr_in6 *)sin)->sin6_port;
+	else
+		port = 0;
+	return htons(port);
+}
+
+static inline void _set_port(struct sockaddr *sin, u_short port)
+{
+	if (sin->sa_family == AF_INET)
+		((struct sockaddr_in *)sin)->sin_port = htons(port);
+	else if (sin->sa_family == AF_INET6)
+		((struct sockaddr_in6 *)sin)->sin6_port = htons(port);
+}
+
+static inline void * _get_addr(struct sockaddr *sin)
+{
+	void * addr;
+
+	if (sin->sa_family == AF_INET)
+		addr = (void *)&(((struct sockaddr_in *)sin)->sin_addr);
+	else if (sin->sa_family == AF_INET6)
+		addr = (void *)&(((struct sockaddr_in6 *)sin)->sin6_addr);
+	else
+		addr = NULL;
+	return addr;
+}
+
+static inline size_t _get_addrlen(struct sockaddr *sin)
+{
+	size_t addrlen;
+
+	if (sin->sa_family == AF_INET)
+		addrlen = sizeof(struct sockaddr_in);
+	else if (sin->sa_family == AF_INET6)
+		addrlen = sizeof(struct sockaddr_in6);
+	else
+		addrlen = sizeof(struct sockaddr_storage);
+	return addrlen;
+}
+
+static inline struct netconfig * _getnetconfig(struct sockaddr *saddr, u_int proto)
+{
+	struct netconfig *nconf = NULL;
+
+	if (saddr->sa_family == AF_INET)
+		nconf = getnetconfigent(proto == IPPROTO_TCP ? "tcp" : "udp");
+	else if (saddr->sa_family == AF_INET6)
+		nconf = getnetconfigent(proto == IPPROTO_TCP ? "tcp6" : "udp6");
+	return nconf;
+}
+
+#endif /* _SOCK_H */
