linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Fwd: [Fwd: [Fwd: Re: 2.6.13-mm2]]]
@ 2005-09-22 19:43 Chuck Lever
  2005-09-22 21:57 ` Trond Myklebust
  0 siblings, 1 reply; 3+ messages in thread
From: Chuck Lever @ 2005-09-22 19:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 84 bytes --]

attached please find the original message containing the pmap reserved 
port patch.

[-- Attachment #2: [Fwd: [Fwd: Re: 2.6.13-mm2]] --]
[-- Type: message/rfc822, Size: 9355 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 251 bytes --]

andrew-

please replace the one-liner that adds "xprt->resvport = 0;" to 
net/sunrpc/clnt.c with the attached patch.

i haven't heard confirmation from dominik on this, but trond and i 
suspect this is a reasonable replacement for the original patch.

[-- Attachment #2.1.2: supplemental2.diff --]
[-- Type: text/x-patch, Size: 2491 bytes --]

[SUNRPC] rpcbind requires a privileged port to set portmap data

An earlier patch caused rpcbind to use an unprivileged port for both SET
and GET requests.  SET requests require a privileged port.

Test plan:
Start up the Linux NFS service.

Signed-off-by: Chuck Lever <cel@netapp.com>
---

 net/sunrpc/rpcb_clnt.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
@@ -60,7 +60,7 @@ static inline void rpcb_wake_rpcbind_wai
 	rpc_wake_up(&xprt->bindwait);
 }
 
-static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, int proto, int version)
+static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr, int proto, int version, int privileged)
 {
 	struct rpc_create_args args = {
 		.protocol	= proto,
@@ -70,10 +70,12 @@ static struct rpc_clnt *rpcb_create(char
 		.program	= &rpcb_program,
 		.version	= version,
 		.authflavor	= RPC_AUTH_NULL,
-		.behavior	= (RPC_CLNT_ONESHOT|RPC_CLNT_NOPING|RPC_CLNT_NONPRIVPORT),
+		.behavior	= (RPC_CLNT_ONESHOT|RPC_CLNT_NOPING),
 	};
 
 	((struct sockaddr_in *)srvaddr)->sin_port = htons(RPC_BIND_PORT);
+	if (!privileged)
+		args.behavior |= RPC_CLNT_NONPRIVPORT;
 	return rpc_create(&args);
 }
 
@@ -114,7 +116,7 @@ int rpcb_register(u32 prog, u32 vers, in
 	sin.sin_family = AF_INET;
 	sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 	rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
-					IPPROTO_UDP, 2);
+					IPPROTO_UDP, 2, 1);
 	if (IS_ERR(rpcb_clnt))
 		return PTR_ERR(rpcb_clnt);
 
@@ -158,7 +160,7 @@ int rpcb_getport_external(struct sockadd
 			NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
 
 	sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr));
-	rpcb_clnt = rpcb_create(hostname, (struct sockaddr *)sin, prot, 2);
+	rpcb_clnt = rpcb_create(hostname, (struct sockaddr *)sin, prot, 2, 0);
 	if (IS_ERR(rpcb_clnt))
 		return PTR_ERR(rpcb_clnt);
 
@@ -237,7 +239,7 @@ void rpcb_getport(struct rpc_task *task,
 	rpc_peeraddr(clnt, (void *) &addr, sizeof(addr));
 	rpc_peeraddr2str(clnt, RPC_DISPLAY_ADDR, map->r_addr, sizeof(map->r_addr));
 
-	rpcb_clnt = rpcb_create(clnt->cl_server, &addr, protocol, bind_version);
+	rpcb_clnt = rpcb_create(clnt->cl_server, &addr, protocol, bind_version, 0);
 	if (IS_ERR(rpcb_clnt)) {
 		rpc_exit(task, PTR_ERR(rpcb_clnt));
 		dprintk("RPC: %5u rpcb_getport rpcb_create failed, error %ld\n",

[-- Attachment #2.1.3: [Fwd: Re: 2.6.13-mm2] --]
[-- Type: message/rfc822, Size: 4947 bytes --]

[-- Attachment #2.1.3.1.1: Type: text/plain, Size: 34 bytes --]

Looks like one of your patches...

[-- Attachment #2.1.3.1.2: Vidaresendt melding - Re: 2.6.13-mm2 --]
[-- Type: message/rfc822, Size: 3441 bytes --]

From: Andrew Morton <akpm@osdl.org>
To: Dominik Karall <dominik.karall@gmx.net>
Cc: linux-kernel@vger.kernel.org, Trond Myklebust <trond.myklebust@fys.uio.no>, Neil Brown <neilb@cse.unsw.edu.au>
Subject: Re: 2.6.13-mm2
Date: Sat, 10 Sep 2005 15:12:25 -0700
Message-ID: <20050910151225.612e3f7b.akpm@osdl.org>

Dominik Karall <dominik.karall@gmx.net> wrote:
>
> On Thursday 08 September 2005 14:30, Andrew Morton wrote:
>  > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.13/2.6.13
>  >-mm2/
> 
>  I have problems using NFS with 2.6.13-mm2, it failes to start, but works with 
>  2.6.13-ck1 (so pure 2.6.13 should work too, as there are no nfs related 
>  changes in -ck, I think).
>  Following messages appear in /var/log/messages:
> 
>  Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
>  rpc.statd[15041]: Version 1.0.7 Starting
>  NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
>  NFSD: recovery directory /var/lib/nfs/v4recovery doesn't exist
>  NFSD: starting 90-second grace period
>  portmap[15048]: connect from 127.0.0.1 to set(nfs): request from unprivileged 
>  port
>  nfsd[15046]: nfssvc: Permission denied
> 
> 
>  with 2.6.13-ck1:
> 
>  Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
>  rpc.statd[16126]: Version 1.0.7 Starting
>  NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
>  NFSD: starting 90-second grace period

OK.  We don't have many nfsd patches at all in 2.6.13-mm2.  But there are
quite a few sunrpc changes.  Plus I have a few random nfs patches which
should be merged up or dropped.

In short: dunno.  Relevant people cc'ed ;)

[-- Attachment #2.1.4: cel.vcf --]
[-- Type: text/x-vcard, Size: 439 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Charles
org:Network Appliance, Incorporated;Linux NFS Client Development
adr:535 West William Street, Suite 3100;;Center for Information Technology Integration;Ann Arbor;MI;48103-4943;USA
email;internet:cel@citi.umich.edu
title:Member of Technical Staff
tel;work:+1 734 763 4415
tel;fax:+1 734 763 4434
tel;home:+1 734 668 1089
x-mozilla-html:FALSE
url:http://www.monkey.org/~cel/
version:2.1
end:vcard


[-- Attachment #3: cel.vcf --]
[-- Type: text/x-vcard, Size: 439 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Charles
org:Network Appliance, Incorporated;Linux NFS Client Development
adr:535 West William Street, Suite 3100;;Center for Information Technology Integration;Ann Arbor;MI;48103-4943;USA
email;internet:cel@citi.umich.edu
title:Member of Technical Staff
tel;work:+1 734 763 4415
tel;fax:+1 734 763 4434
tel;home:+1 734 668 1089
x-mozilla-html:FALSE
url:http://www.monkey.org/~cel/
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Fwd: [Fwd: [Fwd: Re: 2.6.13-mm2]]]
  2005-09-22 19:43 [Fwd: [Fwd: [Fwd: Re: 2.6.13-mm2]]] Chuck Lever
@ 2005-09-22 21:57 ` Trond Myklebust
  2005-09-23  1:24   ` Chuck Lever
  0 siblings, 1 reply; 3+ messages in thread
From: Trond Myklebust @ 2005-09-22 21:57 UTC (permalink / raw)
  To: cel; +Cc: Andrew Morton, linux-kernel

to den 22.09.2005 Klokka 15:43 (-0400) skreiv Chuck Lever:
> attached please find the original message containing the pmap reserved 
> port patch.

There's just one problem: it won't apply to my tree. Looks like this is
relative to something you haven't merged yet.

Cheers,
  Trond

> e-postmelding vedlegg ([Fwd: [Fwd: Re: 2.6.13-mm2]])
> to den 22.09.2005 Klokka 15:43 (-0400) skreiv Chuck Lever:
> > andrew-
> > 
> > please replace the one-liner that adds "xprt->resvport = 0;" to 
> > net/sunrpc/clnt.c with the attached patch.
> > 
> > i haven't heard confirmation from dominik on this, but trond and i 
> > suspect this is a reasonable replacement for the original patch.
> > e-postmelding vedlegg ([Fwd: Re: 2.6.13-mm2])
> > to den 22.09.2005 Klokka 15:43 (-0400) skreiv Chuck Lever:
> > > Looks like one of your patches...
> > > e-postmelding vedlegg, "Vidaresendt melding - Re: 2.6.13-mm2"
> > > to den 22.09.2005 Klokka 15:43 (-0400) skreiv Chuck Lever:
> > > > Dominik Karall <dominik.karall@gmx.net> wrote:
> > > > >
> > > > > On Thursday 08 September 2005 14:30, Andrew Morton wrote:
> > > > >  > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.13/2.6.13
> > > > >  >-mm2/
> > > > > 
> > > > >  I have problems using NFS with 2.6.13-mm2, it failes to start, but works with 
> > > > >  2.6.13-ck1 (so pure 2.6.13 should work too, as there are no nfs related 
> > > > >  changes in -ck, I think).
> > > > >  Following messages appear in /var/log/messages:
> > > > > 
> > > > >  Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
> > > > >  rpc.statd[15041]: Version 1.0.7 Starting
> > > > >  NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
> > > > >  NFSD: recovery directory /var/lib/nfs/v4recovery doesn't exist
> > > > >  NFSD: starting 90-second grace period
> > > > >  portmap[15048]: connect from 127.0.0.1 to set(nfs): request from unprivileged 
> > > > >  port
> > > > >  nfsd[15046]: nfssvc: Permission denied
> > > > > 
> > > > > 
> > > > >  with 2.6.13-ck1:
> > > > > 
> > > > >  Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
> > > > >  rpc.statd[16126]: Version 1.0.7 Starting
> > > > >  NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
> > > > >  NFSD: starting 90-second grace period
> > > > 
> > > > OK.  We don't have many nfsd patches at all in 2.6.13-mm2.  But there are
> > > > quite a few sunrpc changes.  Plus I have a few random nfs patches which
> > > > should be merged up or dropped.
> > > > 
> > > > In short: dunno.  Relevant people cc'ed ;)


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Fwd: [Fwd: [Fwd: Re: 2.6.13-mm2]]]
  2005-09-22 21:57 ` Trond Myklebust
@ 2005-09-23  1:24   ` Chuck Lever
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Lever @ 2005-09-23  1:24 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Andrew Morton, linux-kernel

On Thu, 22 Sep 2005, Trond Myklebust wrote:

> to den 22.09.2005 Klokka 15:43 (-0400) skreiv Chuck Lever:
> > attached please find the original message containing the pmap reserved
> > port patch.
>
> There's just one problem: it won't apply to my tree. Looks like this is
> relative to something you haven't merged yet.

oops, you're right.  try this one.



[SUNRPC] portmapper doesn't need a reserved port

The in-kernel portmapper does not require a reserved port for making bind
queries.

Test-plan:
Tens of runs of the Connectathon locking suite with TCP and UDP against
several other NFS server implementations using NFSv3, not NFSv4 (which
doesn't require rpcbind).

Signed-off-by: Chuck Lever <cel@netapp.com>
---

 net/sunrpc/pmap_clnt.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/sunrpc/pmap_clnt.c b/net/sunrpc/pmap_clnt.c
--- a/net/sunrpc/pmap_clnt.c
+++ b/net/sunrpc/pmap_clnt.c
@@ -26,7 +26,7 @@
 #define PMAP_GETPORT		3

 static struct rpc_procinfo	pmap_procedures[];
-static struct rpc_clnt *	pmap_create(char *, struct sockaddr_in *, int);
+static struct rpc_clnt *	pmap_create(char *, struct sockaddr_in *, int, int);
 static void			pmap_getport_done(struct rpc_task *);
 static struct rpc_program	pmap_program;
 static DEFINE_SPINLOCK(pmap_lock);
@@ -65,7 +65,7 @@ rpc_getport(struct rpc_task *task, struc
 	map->pm_binding = 1;
 	spin_unlock(&pmap_lock);

-	pmap_clnt = pmap_create(clnt->cl_server, sap, map->pm_prot);
+	pmap_clnt = pmap_create(clnt->cl_server, sap, map->pm_prot, 0);
 	if (IS_ERR(pmap_clnt)) {
 		task->tk_status = PTR_ERR(pmap_clnt);
 		goto bailout;
@@ -112,7 +112,7 @@ rpc_getport_external(struct sockaddr_in
 			NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);

 	sprintf(hostname, "%u.%u.%u.%u", NIPQUAD(sin->sin_addr.s_addr));
-	pmap_clnt = pmap_create(hostname, sin, prot);
+	pmap_clnt = pmap_create(hostname, sin, prot, 0);
 	if (IS_ERR(pmap_clnt))
 		return PTR_ERR(pmap_clnt);

@@ -171,7 +171,7 @@ rpc_register(u32 prog, u32 vers, int pro

 	sin.sin_family = AF_INET;
 	sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-	pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP);
+	pmap_clnt = pmap_create("localhost", &sin, IPPROTO_UDP, 1);
 	if (IS_ERR(pmap_clnt)) {
 		error = PTR_ERR(pmap_clnt);
 		dprintk("RPC: couldn't create pmap client. Error = %d\n", error);
@@ -198,7 +198,7 @@ rpc_register(u32 prog, u32 vers, int pro
 }

 static struct rpc_clnt *
-pmap_create(char *hostname, struct sockaddr_in *srvaddr, int proto)
+pmap_create(char *hostname, struct sockaddr_in *srvaddr, int proto, int privileged)
 {
 	struct rpc_xprt	*xprt;
 	struct rpc_clnt	*clnt;
@@ -208,6 +208,8 @@ pmap_create(char *hostname, struct socka
 	if (IS_ERR(xprt))
 		return (struct rpc_clnt *)xprt;
 	xprt->addr.sin_port = htons(RPC_PMAP_PORT);
+	if (!privileged)
+		xprt->resvport = 0;

 	/* printk("pmap: create clnt\n"); */
 	clnt = rpc_new_client(xprt, hostname,

	- Chuck Lever
--
corporate:	<cel at netapp dot com>
personal:	<chucklever at bigfoot dot com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-09-23  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-22 19:43 [Fwd: [Fwd: [Fwd: Re: 2.6.13-mm2]]] Chuck Lever
2005-09-22 21:57 ` Trond Myklebust
2005-09-23  1:24   ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).