All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFS: initialize default port in kernel mount client
@ 2007-09-24 21:32 James Lentini
  2007-09-24 22:32 ` Chuck Lever
  0 siblings, 1 reply; 4+ messages in thread
From: James Lentini @ 2007-09-24 21:32 UTC (permalink / raw)
  To: nfs


If no mount server port number is specified, this change to the kernel 
mount client

http://linux-nfs.org/cgi-bin/gitweb.cgi?p=nfs-2.6.git;a=commitdiff;h=209ce98
06996537eceaf07d95def0e9300316c84

inadvertently allows the NFS server's port number to be the used as 
the mount server's port number. If the user specifies an NFS server 
port (-o port=x), the mount will fail.

The fix below sets the mount server's port to 0 if no mount server 
port is specified by the user.

Signed-off-by: James Lentini <jlentini@netapp.com>
--

 super.c |    2 ++
 1 file changed, 2 insertions(+)

Index: nfs-2.6/fs/nfs/super.c
===================================================================
--- nfs-2.6/fs/nfs/super.c
+++ nfs-2.6/fs/nfs/super.c
@@ -1006,6 +1006,8 @@ static int nfs_try_mount(struct nfs_pars
 		sin = args->nfs_server.address;
 	if (args->mount_server.port != 0)
 		sin.sin_port = htons(args->mount_server.port);
+	else
+		sin.sin_port = htons(0);
 
 	/*
 	 * Now ask the mount server to map our export path

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: [PATCH] NFS: initialize default port in kernel mount client
  2007-09-24 21:32 [PATCH] NFS: initialize default port in kernel mount client James Lentini
@ 2007-09-24 22:32 ` Chuck Lever
  2007-09-24 23:53   ` James Lentini
  0 siblings, 1 reply; 4+ messages in thread
From: Chuck Lever @ 2007-09-24 22:32 UTC (permalink / raw)
  To: James Lentini; +Cc: nfs

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

Hi James-

James Lentini wrote:
> If no mount server port number is specified, this change to the kernel 
> mount client
> 
> http://linux-nfs.org/cgi-bin/gitweb.cgi?p=nfs-2.6.git;a=commitdiff;h=209ce98
> 06996537eceaf07d95def0e9300316c84
> 
> inadvertently allows the NFS server's port number to be the used as 
> the mount server's port number. If the user specifies an NFS server 
> port (-o port=x), the mount will fail.
> 
> The fix below sets the mount server's port to 0 if no mount server 
> port is specified by the user.
> 
> Signed-off-by: James Lentini <jlentini@netapp.com>
> --
> 
>  super.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: nfs-2.6/fs/nfs/super.c
> ===================================================================
> --- nfs-2.6/fs/nfs/super.c
> +++ nfs-2.6/fs/nfs/super.c
> @@ -1006,6 +1006,8 @@ static int nfs_try_mount(struct nfs_pars
>  		sin = args->nfs_server.address;
>  	if (args->mount_server.port != 0)
>  		sin.sin_port = htons(args->mount_server.port);
> +	else
> +		sin.sin_port = htons(0);

Why not just set sin.sin_port = args->mount_server.port unconditionally?

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 290 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group
adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: [PATCH] NFS: initialize default port in kernel mount client
  2007-09-24 22:32 ` Chuck Lever
@ 2007-09-24 23:53   ` James Lentini
  2007-09-25 15:58     ` Chuck Lever
  0 siblings, 1 reply; 4+ messages in thread
From: James Lentini @ 2007-09-24 23:53 UTC (permalink / raw)
  To: Chuck Lever; +Cc: nfs



On Mon, 24 Sep 2007, Chuck Lever wrote:

> Hi James-
> 
> James Lentini wrote:
> > If no mount server port number is specified, this change to the kernel mount
> > client
> > 
> > http://linux-nfs.org/cgi-bin/gitweb.cgi?p=nfs-2.6.git;a=commitdiff;h=209ce98
> > 06996537eceaf07d95def0e9300316c84
> > 
> > inadvertently allows the NFS server's port number to be the used as the
> > mount server's port number. If the user specifies an NFS server port (-o
> > port=x), the mount will fail.
> > 
> > The fix below sets the mount server's port to 0 if no mount server port is
> > specified by the user.
> > 
> > Signed-off-by: James Lentini <jlentini@netapp.com>
> > --
> > 
> >  super.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > Index: nfs-2.6/fs/nfs/super.c
> > ===================================================================
> > --- nfs-2.6/fs/nfs/super.c
> > +++ nfs-2.6/fs/nfs/super.c
> > @@ -1006,6 +1006,8 @@ static int nfs_try_mount(struct nfs_pars
> >  		sin = args->nfs_server.address;
> >  	if (args->mount_server.port != 0)
> >  		sin.sin_port = htons(args->mount_server.port);
> > +	else
> > +		sin.sin_port = htons(0);
> 
> Why not just set sin.sin_port = args->mount_server.port unconditionally?

Good observation. Something like this perhaps?

Signed-off-by: James Lentini <jlentini@netapp.com>

Index: nfs-2.6/fs/nfs/super.c
===================================================================
--- nfs-2.6/fs/nfs/super.c
+++ nfs-2.6/fs/nfs/super.c
@@ -1004,8 +1004,10 @@ static int nfs_try_mount(struct nfs_pars
 		sin = args->mount_server.address;
 	else
 		sin = args->nfs_server.address;
-	if (args->mount_server.port != 0)
-		sin.sin_port = htons(args->mount_server.port);
+	/* 
+ 	 * autobind will be used if mount_server.port == 0
+ 	 */
+	sin.sin_port = htons(args->mount_server.port);
 
 	/*
 	 * Now ask the mount server to map our export path

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: [PATCH] NFS: initialize default port in kernel mount client
  2007-09-24 23:53   ` James Lentini
@ 2007-09-25 15:58     ` Chuck Lever
  0 siblings, 0 replies; 4+ messages in thread
From: Chuck Lever @ 2007-09-25 15:58 UTC (permalink / raw)
  To: James Lentini; +Cc: nfs

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

James Lentini wrote:
> 
> On Mon, 24 Sep 2007, Chuck Lever wrote:
> 
>> Hi James-
>>
>> James Lentini wrote:
>>> If no mount server port number is specified, this change to the kernel mount
>>> client
>>>
>>> http://linux-nfs.org/cgi-bin/gitweb.cgi?p=nfs-2.6.git;a=commitdiff;h=209ce98
>>> 06996537eceaf07d95def0e9300316c84
>>>
>>> inadvertently allows the NFS server's port number to be the used as the
>>> mount server's port number. If the user specifies an NFS server port (-o
>>> port=x), the mount will fail.
>>>
>>> The fix below sets the mount server's port to 0 if no mount server port is
>>> specified by the user.
>>>
>>> Signed-off-by: James Lentini <jlentini@netapp.com>
>>> --
>>>
>>>  super.c |    2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> Index: nfs-2.6/fs/nfs/super.c
>>> ===================================================================
>>> --- nfs-2.6/fs/nfs/super.c
>>> +++ nfs-2.6/fs/nfs/super.c
>>> @@ -1006,6 +1006,8 @@ static int nfs_try_mount(struct nfs_pars
>>>  		sin = args->nfs_server.address;
>>>  	if (args->mount_server.port != 0)
>>>  		sin.sin_port = htons(args->mount_server.port);
>>> +	else
>>> +		sin.sin_port = htons(0);
>> Why not just set sin.sin_port = args->mount_server.port unconditionally?
> 
> Good observation. Something like this perhaps?
> 
> Signed-off-by: James Lentini <jlentini@netapp.com>
> 
> Index: nfs-2.6/fs/nfs/super.c
> ===================================================================
> --- nfs-2.6/fs/nfs/super.c
> +++ nfs-2.6/fs/nfs/super.c
> @@ -1004,8 +1004,10 @@ static int nfs_try_mount(struct nfs_pars
>  		sin = args->mount_server.address;
>  	else
>  		sin = args->nfs_server.address;
> -	if (args->mount_server.port != 0)
> -		sin.sin_port = htons(args->mount_server.port);
> +	/* 
> + 	 * autobind will be used if mount_server.port == 0
> + 	 */
> +	sin.sin_port = htons(args->mount_server.port);
>  
>  	/*
>  	 * Now ask the mount server to map our export path

That's the idea, but I don't think the comment is needed.

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 290 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group
adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

end of thread, other threads:[~2007-09-25 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-24 21:32 [PATCH] NFS: initialize default port in kernel mount client James Lentini
2007-09-24 22:32 ` Chuck Lever
2007-09-24 23:53   ` James Lentini
2007-09-25 15:58     ` Chuck Lever

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.