Adding SOCK_PMAP_REG and SOCK_PERM flags
SOCK_PERM flag has been introduced to avoid callback connections to be registered in rpcbind
SOCK_PMAP_REG replaces the pmap_register flag.

Signed-off-by: Aurelien Charbon <aurelien.charbon@ext.bull.net>

 fs/nfs/inode.c                 |    5 -----
 include/linux/sunrpc/svcsock.h |    7 +++++++
 net/sunrpc/clnt.c              |    5 +++++
 net/sunrpc/rpcb_clnt.c         |    4 +---
 net/sunrpc/sched.c             |    1 +
 net/sunrpc/svcsock.c           |   10 +++++-----
 6 files changed, 19 insertions(+), 13 deletions(-)
--------
diff -Nru linux-2.6.11-08/fs/nfs/inode.c linux-2.6.11-09/fs/nfs/inode.c
--- linux-2.6.11-08/fs/nfs/inode.c	2005-04-04 15:20:13.000000000 +0200
+++ linux-2.6.11-09/fs/nfs/inode.c	2005-04-08 15:24:34.000000000 +0200
@@ -2190,11 +2190,6 @@
 		s = ERR_PTR(-EFAULT);
 		goto out_free;
 	}
-	if (server->addr->sa_family != AF_INET) {
-		printk("NFS: mount program didn't pass remote IPv4 address!\n");
-		s = ERR_PTR(-EINVAL);
-		goto out_free;
-	}
 
 	s = sget(fs_type, nfs4_compare_super, nfs_set_super, server);
 
diff -Nru linux-2.6.11-08/include/linux/sunrpc/svcsock.h linux-2.6.11-09/include/linux/sunrpc/svcsock.h
--- linux-2.6.11-08/include/linux/sunrpc/svcsock.h	2005-04-08 09:03:01.000000000 +0200
+++ linux-2.6.11-09/include/linux/sunrpc/svcsock.h	2005-05-09 07:49:06.000000000 +0200
@@ -53,6 +53,13 @@
 };
 
 /*
+ * SOCK_PERM flag has been introduced to avoid callback connections to be registered in rpcbind
+ * SOCK_PMAP_REG replaces the pmap_register flag of previous versions
+ */
+#define SOCK_PMAP_REG	0x1
+#define SOCK_PERM	0x2
+
+/*
  * Function prototypes.
  */
 int		svc_makesock(struct svc_serv *, int, unsigned short);
diff -Nru linux-2.6.11-08/net/sunrpc/clnt.c linux-2.6.11-09/net/sunrpc/clnt.c
--- linux-2.6.11-08/net/sunrpc/clnt.c	2005-04-19 09:15:35.000000000 +0200
+++ linux-2.6.11-09/net/sunrpc/clnt.c	2005-05-26 15:29:28.000000000 +0200
@@ -811,6 +811,11 @@
 		task->tk_action = call_bind;
 		rpc_delay(task, 3*HZ);
 		break;
+	case -ENOSYS:
+	  task->tk_action = call_bind;
+	  task->tk_xprt->bind_idx++;
+	  break;
+	  
 	default:
 		rpc_exit(task, -EIO);
 	}
diff -Nru linux-2.6.11-08/net/sunrpc/rpcb_clnt.c linux-2.6.11-09/net/sunrpc/rpcb_clnt.c
--- linux-2.6.11-08/net/sunrpc/rpcb_clnt.c	2005-04-05 11:24:23.000000000 +0200
+++ linux-2.6.11-09/net/sunrpc/rpcb_clnt.c	2005-05-25 08:01:12.000000000 +0200
@@ -33,8 +33,6 @@
 #define RPCB_GETADDR		3
 #define RPCB_GETVERSADDR	9
 
-#define RPC_RPCB_VERSION	3
-
 static struct rpc_procinfo	rpcb_procedures[];
 static struct rpc_clnt *	rpcb_create(char *, struct sockaddr *, int, int);
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -80,7 +78,7 @@
 {
 	struct rpc_create_args args = {
 		.protocol	= proto,
-		.address	= (struct sockaddr *)srvaddr,
+		.address	= srvaddr,
 		.addrsize	= sizeof(struct sockaddr_in),
 		.servername	= hostname,
 		.program	= &rpcb_program,
diff -Nru linux-2.6.11-08/net/sunrpc/sched.c linux-2.6.11-09/net/sunrpc/sched.c
--- linux-2.6.11-08/net/sunrpc/sched.c	2005-05-25 08:11:10.000000000 +0200
+++ linux-2.6.11-09/net/sunrpc/sched.c	2005-05-25 08:12:23.000000000 +0200
@@ -747,6 +747,7 @@
 
 	task->tk_priority = RPC_PRIORITY_NORMAL;
 	task->tk_cookie = (unsigned long)current;
+	task->tk_xprt->bind_idx = 0;
 	/* Initialize workqueue for async tasks */
 	task->tk_workqueue = rpciod_workqueue;
 	if (!RPC_IS_ASYNC(task))
diff -Nru linux-2.6.11-08/net/sunrpc/svcsock.c linux-2.6.11-09/net/sunrpc/svcsock.c
--- linux-2.6.11-08/net/sunrpc/svcsock.c	2005-04-08 09:04:11.000000000 +0200
+++ linux-2.6.11-09/net/sunrpc/svcsock.c	2005-04-19 09:43:21.000000000 +0200
@@ -64,7 +64,7 @@
 
 
 static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *,
-					 int *errp, int pmap_reg);
+					 int *errp, int flags);
 static void		svc_udp_data_ready(struct sock *, int);
 static int		svc_udp_recvfrom(struct svc_rqst *);
 static int		svc_udp_sendto(struct svc_rqst *);
@@ -1372,7 +1372,7 @@
  */
 static struct svc_sock *
 svc_setup_socket(struct svc_serv *serv, struct socket *sock,
-					int *errp, int pmap_register)
+					int *errp, int flags)
 {
 	struct svc_sock	*svsk;
 	struct sock	*inet;
@@ -1387,7 +1387,7 @@
 	inet = sock->sk;
 
 	/* Register socket with portmapper */
-	if (*errp >= 0 && pmap_register)
+	if (*errp >= 0 && (flags & SOCK_PMAP_REG))
 		*errp = svc_register(serv, inet->sk_protocol,
 				     ntohs(inet_sk(inet)->sport));
 
@@ -1416,7 +1416,7 @@
 		svc_tcp_init(svsk);
 
 	spin_lock_bh(&serv->sv_lock);
-	if (!pmap_register) {
+	if (!(flags & SOCK_PERM)) {
 		set_bit(SK_TEMP, &svsk->sk_flags);
 		list_add(&svsk->sk_list, &serv->sv_tempsocks);
 		serv->sv_tmpcnt++;
@@ -1475,7 +1475,7 @@
 			goto bummer;
 	}
 
-	if ((svsk = svc_setup_socket(serv, sock, &error, pmap_reg)) != NULL)
+	if ((svsk = svc_setup_socket(serv, sock, &error, pmap_reg | SOCK_PERM)) != NULL)
 		return 0;
 
 bummer:

