Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Tom Tucker <tom@opengridcomputing.com>, linux-nfs@vger.kernel.org
Subject: Re: [RFC,PATCH] svc: Modify svc_xprt_create to take a sockaddr
Date: Mon, 21 Jan 2008 13:35:57 -0500	[thread overview]
Message-ID: <20080121183557.GK17468@fieldses.org> (raw)
In-Reply-To: <9ECEB764-A93C-4DF2-BB6E-273C33C02B6E@oracle.com>

On Mon, Jan 21, 2008 at 12:47:08PM -0500, Chuck Lever wrote:
> Hi Tom-
>
> On Jan 21, 2008, at 12:11 PM, Tom Tucker wrote:
>> Modify the svc_create_xprt function to take a sockaddr instead of just
>> a port. This approach allows a single transport class,
>> "tcp" for example, to support both IPv4 and IPv6 connections since
>> this information is now provided in the sockaddr when the endpoint
>> is created.  This also allows RPC servers to create listening  
>> endpoints
>> on a specific interface.
>
> I assume this goes along with the server-side rpcb_register_v3 patches I 
> proposed last week?
>
>> Also modify the svc_xprt_find function to search based on sockaddr so
>> interface specific endpoints can be searched for.
>>
>> Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
>> ---
>>
>>  fs/lockd/svc.c                  |   16 +++--
>>  fs/nfs/callback.c               |    8 ++
>>  fs/nfsd/nfsctl.c                |  135 ++++++++++++++++++++++++++++ 
>> +----------
>>  fs/nfsd/nfssvc.c                |   11 +++
>>  include/linux/sunrpc/svc_xprt.h |    4 +
>>  net/sunrpc/svc_xprt.c           |   96 ++++++++++++++++++++++------
>>  6 files changed, 206 insertions(+), 64 deletions(-)
>>
>> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
>> index 0822646..89e40fb 100644
>> --- a/fs/lockd/svc.c
>> +++ b/fs/lockd/svc.c
>> @@ -229,19 +229,27 @@ static int make_socks(struct svc_serv *serv, int 
>> proto)
>>  	static int warned;
>>  	struct svc_xprt *xprt;
>>  	int err = 0;
>> +	struct sockaddr_in sin = {
>> +		.sin_family = AF_INET,
>> +		.sin_addr = { INADDR_ANY }
>> +	};
>>
>>  	if (proto == IPPROTO_UDP || nlm_udpport) {
>> -		xprt = svc_find_xprt(serv, "udp", 0, 0);
>> +		sin.sin_port = htons(nlm_udpport);
>> +		xprt = svc_find_xprt(serv, "udp", NULL);
>>  		if (!xprt)
>> -			err = svc_create_xprt(serv, "udp", nlm_udpport,
>> +			err = svc_create_xprt(serv, "udp",
>> +					      (struct sockaddr *)&sin,
>>  					      SVC_SOCK_DEFAULTS);
>>  		else
>>  			svc_xprt_put(xprt);
>>  	}
>>  	if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) {
>> -		xprt = svc_find_xprt(serv, "tcp", 0, 0);
>> +		sin.sin_port = htons(nlm_tcpport);
>> +		xprt = svc_find_xprt(serv, "tcp", NULL);
>>  		if (!xprt)
>> -			err = svc_create_xprt(serv, "tcp", nlm_tcpport,
>> +			err = svc_create_xprt(serv, "tcp",
>> +					      (struct sockaddr *)&sin,
>>  					      SVC_SOCK_DEFAULTS);
>>  		else
>>  			svc_xprt_put(xprt);
>
> This is sort of a generic question.
>
> The server-side interface appears to be using strings to identify  
> transports ("tcp"), but the client-side is still using numbers  
> (XPRT_TRANSPORT_TCP).  There are one or two sticky issues to fix before 
> the client-side can use strings, but...
>
> Should the server-side use netids instead of arbitrary strings?  I guess 
> that would be a little awkward because you'd need to use "udp6" for UDP 
> on IPv6, and so on.
>
> In any event, should we use macros for these instead of open-coded  
> strings?

If you're proposing something like

	#define TCP "tcp"

I think that's unnecessary obfuscation.

--b.

  parent reply	other threads:[~2008-01-21 18:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 17:11 [RFC,PATCH] svc: Modify svc_xprt_create to take a sockaddr Tom Tucker
     [not found] ` <20080121171105.29028.61809.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2008-01-21 17:47   ` Chuck Lever
2008-01-21 17:59     ` Trond Myklebust
     [not found]       ` <1200938366.25562.14.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-21 18:22         ` Tom Tucker
2008-01-21 18:30         ` Chuck Lever
2008-01-21 19:24           ` Trond Myklebust
     [not found]             ` <1200943495.25562.52.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-21 20:48               ` Tom Tucker
     [not found]                 ` <1200948494.11003.71.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2008-01-21 22:42                   ` Trond Myklebust
     [not found]                     ` <1200955371.27963.28.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-22 17:52                       ` Chuck Lever
2008-01-21 18:21     ` Tom Tucker
2008-01-21 18:35     ` J. Bruce Fields [this message]
2008-01-21 19:15       ` Tom Tucker

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=20080121183557.GK17468@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tom@opengridcomputing.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox