Linux NFS development
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@suse.de>, nfs@lists.sourceforge.net
Subject: Re: Use of delayed request information in nlmsvc_lookup_host
Date: Thu, 15 Nov 2007 13:02:23 -0500	[thread overview]
Message-ID: <473C89AF.8020707@oracle.com> (raw)
In-Reply-To: <1195148262.7673.11.camel@heimdal.trondhjem.org>

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

Trond Myklebust wrote:
> On Thu, 2007-11-15 at 12:23 -0500, Chuck Lever wrote:
>> Trond Myklebust wrote:
>>> On Thu, 2007-11-15 at 08:55 -0500, Chuck Lever wrote:
>>>
>>>> What do you think of changing the rq_daddr field to be a sockaddr_storage?
>>> Why? You've already got rq_addr.
>> OK, here's what I've ended up with.  I think this is what you and Neil 
>> have been suggesting.  Comments?
>>
>> /*
>>   * Find an NLM client handle in the cache. If there is none, create it.
>>   *
>>   * Manufacture a specific source address in case we're using multiple
>>   * IP addresses on a single NIC.  NB: the family of the address in
>>   * rq_daddr is guaranteed to be the same as the family of rq_addr.
>>   */
>> struct nlm_host *
>> nlmsvc_lookup_host(struct svc_rqst *rqstp,
>> 			const char *hostname, unsigned int hostname_len)
>> {
>> 	struct sockaddr_in6 source = {
>> 		.sin6_family	= AF_INET6,
>> 	};
>>
>> 	switch(svc_addr(rqstp)->sa_family) {
>> 	case AF_INET: {
>> 		struct sockaddr_in *sin = (struct sockaddr_in *)&source;
>> 		sin->sin_family = AF_INET;
>> 		sin->sin_addr.s_addr = rqstp->rq_daddr.addr.s_addr;
>> 		break;
>> 	}
>> 	case AF_INET6:
>> 		ipv6_addr_copy(&source.sin6_addr,
>>                                 &rqstp->rq_daddr.addr6);
>> 		break;
>> 	}
>>
>> 	return nlm_lookup_host(1, svc_addr_in(rqstp),
>> 			       rqstp->rq_prot, rqstp->rq_vers,
>> 			       hostname, hostname_len,
>> 			       (struct sockaddr *)&source);
>> }
> 
> That works for me. Technically, I suppose we should really pass a
> source_len to nlm_lookup_host() if only to ensure that the comparisons
> don't overrun memory, however in practice I doubt this is a problem. We
> always know that the kernel allocates enough space.

My IPv6-aware version of nlm_cmp_addr takes a pair of sockaddr *'s; no 
lengths are needed for the comparison of either AF_INET or AF_INET6 
addresses.

In fact, in most cases, it appears that the address length is unneeded 
for us.  Both INET families use fixed-size addresses.

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 259 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
version:2.1
end:vcard


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

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

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

  reply	other threads:[~2007-11-15 18:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-14 18:23 Use of delayed request information in nlmsvc_lookup_host Chuck Lever
2007-11-14 18:43 ` Trond Myklebust
2007-11-14 19:00   ` Chuck Lever
2007-11-14 19:32     ` J. Bruce Fields
2007-11-14 19:41     ` Trond Myklebust
2007-11-14 19:50       ` Trond Myklebust
2007-11-14 19:54       ` Chuck Lever
2007-11-15  1:41         ` Neil Brown
2007-11-15 13:55           ` Chuck Lever
2007-11-15 15:54             ` Trond Myklebust
2007-11-15 16:26               ` Chuck Lever
2007-11-15 17:00                 ` Chuck Lever
2007-11-15 17:23               ` Chuck Lever
2007-11-15 17:37                 ` Trond Myklebust
2007-11-15 18:02                   ` Chuck Lever [this message]
2007-11-15 16:00             ` Frank van Maarseveen

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=473C89AF.8020707@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=neilb@suse.de \
    --cc=nfs@lists.sourceforge.net \
    --cc=trond.myklebust@fys.uio.no \
    /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