All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Kirch <okir@suse.de>
To: nfs@lists.sourceforge.net
Subject: [PATCH 20/22] [sunrpc] Register all RPC programs with portmapper by default
Date: Sat, 5 Aug 2006 15:06:49 +0200	[thread overview]
Message-ID: <20060805130649.GA8118@suse.de> (raw)

From: Olaf Kirch <okir@suse.de>
Subject: [sunrpc] Register all RPC programs with portmapper by default

  The NFSACL patches introduced support for multiple RPC services
  listening on the same transport. However, only the first of these
  services was registered with portmapper. This was perfectly fine
  for nfsacl, as you traditionally do not want these to show up in a
  portmapper listing.

  The patch below changes the default behavior to always register
  all services listening on a given transport, but retains the
  old behavior for nfsacl services.

Signed-off-by: Olaf Kirch <okir@suse.de>

 fs/nfsd/nfs2acl.c          |    1 +
 fs/nfsd/nfs3acl.c          |    1 +
 include/linux/sunrpc/svc.h |    3 +++
 net/sunrpc/svc.c           |   37 +++++++++++++++++++++++--------------
 4 files changed, 28 insertions(+), 14 deletions(-)

Index: build/fs/nfsd/nfs2acl.c
===================================================================
--- build.orig/fs/nfsd/nfs2acl.c
+++ build/fs/nfsd/nfs2acl.c
@@ -333,4 +333,5 @@ struct svc_version	nfsd_acl_version2 = {
 		.vs_proc	= nfsd_acl_procedures2,
 		.vs_dispatch	= nfsd_dispatch,
 		.vs_xdrsize	= NFS3_SVC_XDRSIZE,
+		.vs_hidden	= 1,
 };
Index: build/fs/nfsd/nfs3acl.c
===================================================================
--- build.orig/fs/nfsd/nfs3acl.c
+++ build/fs/nfsd/nfs3acl.c
@@ -263,5 +263,6 @@ struct svc_version	nfsd_acl_version3 = {
 		.vs_proc	= nfsd_acl_procedures3,
 		.vs_dispatch	= nfsd_dispatch,
 		.vs_xdrsize	= NFS3_SVC_XDRSIZE,
+		.vs_hidden	= 1,
 };
 
Index: build/include/linux/sunrpc/svc.h
===================================================================
--- build.orig/include/linux/sunrpc/svc.h
+++ build/include/linux/sunrpc/svc.h
@@ -280,6 +280,9 @@ struct svc_version {
 	struct svc_procedure *	vs_proc;	/* per-procedure info */
 	u32			vs_xdrsize;	/* xdrsize needed for this version */
 
+	unsigned int		vs_hidden : 1;	/* Don't register with portmapper.
+						 * Only used for nfsacl so far. */
+
 	/* Override dispatch function (e.g. when caching replies).
 	 * A return value of 0 means drop the request. 
 	 * vs_dispatch == NULL means use default dispatcher.
Index: build/net/sunrpc/svc.c
===================================================================
--- build.orig/net/sunrpc/svc.c
+++ build/net/sunrpc/svc.c
@@ -215,23 +215,32 @@ svc_register(struct svc_serv *serv, int 
 	unsigned long		flags;
 	int			i, error = 0, dummy;
 
-	progp = serv->sv_program;
-
-	dprintk("RPC: svc_register(%s, %s, %d)\n",
-		progp->pg_name, proto == IPPROTO_UDP? "udp" : "tcp", port);
-
 	if (!port)
 		clear_thread_flag(TIF_SIGPENDING);
 
-	for (i = 0; i < progp->pg_nvers; i++) {
-		if (progp->pg_vers[i] == NULL)
-			continue;
-		error = rpc_register(progp->pg_prog, i, proto, port, &dummy);
-		if (error < 0)
-			break;
-		if (port && !dummy) {
-			error = -EACCES;
-			break;
+	for (progp = serv->sv_program; progp; progp = progp->pg_next) {
+		for (i = 0; i < progp->pg_nvers; i++) {
+			if (progp->pg_vers[i] == NULL)
+				continue;
+
+			dprintk("RPC: svc_register(%s, %s, %d, %d)%s\n",
+					progp->pg_name,
+					proto == IPPROTO_UDP?  "udp" : "tcp",
+					port,
+					i,
+					progp->pg_vers[i]->vs_hidden?
+						" (but not telling portmap)" : "");
+
+			if (progp->pg_vers[i]->vs_hidden)
+				continue;
+
+			error = rpc_register(progp->pg_prog, i, proto, port, &dummy);
+			if (error < 0)
+				break;
+			if (port && !dummy) {
+				error = -EACCES;
+				break;
+			}
 		}
 	}
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

                 reply	other threads:[~2006-08-05 13:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060805130649.GA8118@suse.de \
    --to=okir@suse.de \
    --cc=nfs@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.