From: Chuck Lever <chuck.lever@oracle.com>
To: "Aurélien Charbon" <aurelien.charbon@ext.bull.net>
Cc: Mailing list NFSv4 <nfsv4@linux-nfs.org>,
netdev ML <netdev@vger.kernel.org>
Subject: Re: [PATCH 1/1] NFS: change the ip_map cache code to handle IPv6 addresses
Date: Thu, 23 Aug 2007 11:39:32 -0400 [thread overview]
Message-ID: <46CDAA34.1070603@oracle.com> (raw)
In-Reply-To: <46CD890C.2040502@ext.bull.net>
[-- Attachment #1: Type: text/plain, Size: 3989 bytes --]
Hi Aurélien-
Aurélien Charbon wrote:
> According to Neil's comments, I have tried to correct the mistakes of my first sending
> Thank you for these comments Neil.
>
> This is a small part of missing pieces of IPv6 support for the server.
> It deals with the ip_map caching code part.
>
> It changes the ip_map structure to be able to store INET6 addresses.
> It adds also the changes in address hashing, and mapping to test it with INET addresses.
>
> Signed-off-by: Aurelien Charbon <aurelien.charbon@ext.bull.net>
> ---
>
> fs/nfsd/export.c | 10 ++-
> fs/nfsd/nfsctl.c | 21 ++++++-
> include/linux/sunrpc/svcauth.h | 4 -
> include/net/ipv6.h | 17 +++++
> net/sunrpc/svcauth_unix.c | 121
> ++++++++++++++++++++++++++++-------------
> 5 files changed, 129 insertions(+), 44 deletions(-)
>
>
> diff -p -u -r -N linux-2.6.23-rc3/fs/nfsd/export.c
> linux-2.6.23-rc3-IPv6-ipmap-cache/fs/nfsd/export.c
> --- linux-2.6.23-rc3/fs/nfsd/export.c 2007-08-23 13:18:16.000000000 +0200
> +++ linux-2.6.23-rc3-IPv6-ipmap-cache/fs/nfsd/export.c 2007-08-23
> 13:51:08.000000000 +0200
> @@ -35,6 +35,7 @@
> #include <linux/lockd/bind.h>
> #include <linux/sunrpc/msg_prot.h>
> #include <linux/sunrpc/gss_api.h>
> +#include <net/ipv6.h>
>
> #define NFSDDBG_FACILITY NFSDDBG_EXPORT
>
> @@ -1559,6 +1560,7 @@ exp_addclient(struct nfsctl_client *ncp)
> {
> struct auth_domain *dom;
> int i, err;
> + struct in6_addr addr6;
>
> /* First, consistency check. */
> err = -EINVAL;
> @@ -1577,9 +1579,11 @@ exp_addclient(struct nfsctl_client *ncp)
> goto out_unlock;
>
> /* Insert client into hashtable. */
> - for (i = 0; i < ncp->cl_naddr; i++)
> - auth_unix_add_addr(ncp->cl_addrlist[i], dom);
> -
> + for (i = 0; i < ncp->cl_naddr; i++) {
> + /* Mapping address */
> + ipv6_addr_map(ncp->cl_addrlist[i], addr6);
> + auth_unix_add_addr(addr6, dom);
> + }
> auth_unix_forget_old(dom);
> auth_domain_put(dom);
>
> diff -p -u -r -N linux-2.6.23-rc3/fs/nfsd/nfsctl.c
> linux-2.6.23-rc3-IPv6-ipmap-cache/fs/nfsd/nfsctl.c
> --- linux-2.6.23-rc3/fs/nfsd/nfsctl.c 2007-08-23 13:18:16.000000000 +0200
> +++ linux-2.6.23-rc3-IPv6-ipmap-cache/fs/nfsd/nfsctl.c 2007-08-23
> 13:25:28.000000000 +0200
> @@ -222,7 +222,7 @@ static ssize_t write_getfs(struct file *
> struct auth_domain *clp;
> int err = 0;
> struct knfsd_fh *res;
> -
> + struct in6_addr in6;
> if (size < sizeof(*data))
> return -EINVAL;
> data = (struct nfsctl_fsparm*)buf;
> @@ -236,7 +236,14 @@ static ssize_t write_getfs(struct file *
> res = (struct knfsd_fh*)buf;
>
> exp_readlock();
> - if (!(clp = auth_unix_lookup(sin->sin_addr)))
> +
> + /* IPv6 address mapping */
> + in6.s6_addr32[0] = 0;
> + in6.s6_addr32[1] = 0;
> + in6.s6_addr32[2] = htonl(0xffff);
> + in6.s6_addr32[3] = (uint32_t)sin->sin_addr.s_addr;
> +
> + if (!(clp = auth_unix_lookup(in6)))
> err = -EPERM;
> else {
> err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen);
> @@ -253,6 +260,7 @@ static ssize_t write_getfd(struct file *
> {
> struct nfsctl_fdparm *data;
> struct sockaddr_in *sin;
> + struct in6_addr in6;
> struct auth_domain *clp;
> int err = 0;
> struct knfsd_fh fh;
> @@ -271,7 +279,14 @@ static ssize_t write_getfd(struct file *
> res = buf;
> sin = (struct sockaddr_in *)&data->gd_addr;
> exp_readlock();
> - if (!(clp = auth_unix_lookup(sin->sin_addr)))
> +
> + /* IPv6 address mapping */
> + in6.s6_addr32[0] = 0;
> + in6.s6_addr32[1] = 0;
> + in6.s6_addr32[2] = htonl(0xffff);
> + in6.s6_addr32[3] = (uint32_t)sin->sin_addr.s_addr;
The code canonicalizes IPv4 addresses in several places. Is there
already a generic function defined somewhere to do this? If not, it
might make sense to add one.
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 302 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
next prev parent reply other threads:[~2007-08-23 15:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-23 13:18 [PATCH 1/1] NFS: change the ip_map cache code to handle IPv6 addresses Aurélien Charbon
2007-08-23 15:32 ` Brian Haley
2007-09-06 11:30 ` Aurélien Charbon
2007-09-06 16:16 ` Brian Haley
2007-08-23 15:39 ` Chuck Lever [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-08-09 7:22 Aurélien Charbon
2007-08-09 12:16 ` Chuck Lever
2007-08-09 15:08 ` Aurélien Charbon
2007-08-09 15:14 ` Chuck Lever
2007-08-10 1:11 ` Neil Brown
2007-08-10 1:06 ` Neil Brown
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=46CDAA34.1070603@oracle.com \
--to=chuck.lever@oracle.com \
--cc=aurelien.charbon@ext.bull.net \
--cc=netdev@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
/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;
as well as URLs for NNTP newsgroup(s).