[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <470F9BD9.5090903@hp.com>
Date: Fri, 12 Oct 2007 12:07:53 -0400
From: Brian Haley <brian.haley@...com>
To: Aurélien Charbon <aurelien.charbon@....bull.net>
Cc: Mailing list NFSv4 <nfsv4@...ux-nfs.org>,
netdev ML <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/2] NFS: handle IPv6 addresses in nfs ctl
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
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists