From: Brian Haley <brian.haley@hp.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 2/2] NFS: handle IPv6 addresses in nfs ctl
Date: Fri, 12 Oct 2007 12:07:53 -0400 [thread overview]
Message-ID: <470F9BD9.5090903@hp.com> (raw)
In-Reply-To: <470F3AF9.4050705@ext.bull.net>
Hi Aurelien,
Comments in-line.
Aurélien Charbon wrote:
> Here is a second missing part of the IPv6 support in NFS server code
> concerning knfd syscall interface.
> - struct sockaddr_in *sin;
> + struct sockaddr_in6 *sin, sin6_storage;
Nit, should call this sin6 now.
> @@ -228,9 +228,20 @@ static ssize_t write_getfs(struct file *
> return -EINVAL;
> data = (struct nfsctl_fsparm*)buf;
> err = -EPROTONOSUPPORT;
> - if (data->gd_addr.sa_family != AF_INET)
> + sin = &sin6_storage;
This should be moved in the AF_INET case.
> + switch (data->gd_addr.sa_family) {
> + case AF_INET6:
> + sin = (struct sockaddr_in6 *)&data->gd_addr;
> + in6 = sin->sin6_addr;
in6 is a structure, not a pointer. If you want it do this you have to
use ipv6_addr_copy().
> + case AF_INET:
> + /* Map v4 address into v6 structure */
> + ipv6_addr_v4map(((struct sockaddr_in
> *)&data->gd_addr)->sin_addr, in6);
ipv6_addr_set(...)
> @@ -257,7 +265,7 @@ static ssize_t write_getfs(struct file *
> static ssize_t write_getfd(struct file *file, char *buf, size_t size)
> {
> struct nfsctl_fdparm *data;
> - struct sockaddr_in *sin;
> + struct sockaddr_in6 *sin, sin6_storage;
Nit, sin -> sin6.
> @@ -268,18 +276,29 @@ static ssize_t write_getfd(struct file *
> return -EINVAL;
> data = (struct nfsctl_fdparm*)buf;
> err = -EPROTONOSUPPORT;
> - if (data->gd_addr.sa_family != AF_INET)
> + if (data->gd_addr.sa_family != AF_INET &&
> + data->gd_addr.sa_family != AF_INET6)
> goto out;
> err = -EINVAL;
> if (data->gd_version < 2 || data->gd_version > NFSSVC_MAXVERS)
> goto out;
>
> res = buf;
> - sin = (struct sockaddr_in *)&data->gd_addr;
> + sin = &sin6_storage;
Move in AF_INET case.
> - /* IPv6 address mapping */
> - ipv6_addr_v4map(sin->sin_addr, in6);
> + switch (data->gd_addr.sa_family) {
> + case AF_INET:
> + /* IPv6 address mapping */
> + ipv6_addr_v4map(((struct sockaddr_in
> *)&data->gd_addr)->sin_addr, in6);
Use ipv6_set_addr(...)
> + break;
> + case AF_INET6:
> + sin = (struct sockaddr_in6 *)&data->gd_addr;
> + in6 = sin->sin6_addr;
Must use ipv6_addr_copy() here too.
-Brian
next prev parent reply other threads:[~2007-10-12 16:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-12 9:14 [PATCH 2/2] NFS: handle IPv6 addresses in nfs ctl Aurélien Charbon
2007-10-12 16:07 ` Brian Haley [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-10-22 11:27 Aurélien Charbon
2007-10-24 19:22 ` Brian Haley
2007-10-29 19:16 ` Brian Haley
2007-10-30 4:35 ` Neil Brown
2007-11-05 15:17 ` Aurélien Charbon
2007-10-30 17:06 Aurélien Charbon
2007-10-30 19:08 ` Brian Haley
2007-10-31 9:06 ` Aurélien Charbon
2007-10-31 16:20 ` J. Bruce Fields
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=470F9BD9.5090903@hp.com \
--to=brian.haley@hp.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).