From: Michael Groshans <mikegroshans@gmail.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH] pnfsd-lexp: Export correct ipv6 address for local exports
Date: Tue, 31 May 2011 14:20:29 -0400 [thread overview]
Message-ID: <4DE5316D.1030906@gmail.com> (raw)
From: Michael Groshans <groshans@umich.edu>
A sockaddr is not big enough to hold most ipv6 addresses. Changed to use
sockaddr_storage to hold the ipv6 address used for local exports.
Signed-off by: Michael Groshans <groshans@umich.edu>
---
fs/nfsd/pnfsd.h | 2 +-
fs/nfsd/pnfsd_lexp.c | 6 +++---
include/linux/sunrpc/svc_xprt.h | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/nfsd/pnfsd.h b/fs/nfsd/pnfsd.h
index c11d93d..56adc53 100644
--- a/fs/nfsd/pnfsd.h
+++ b/fs/nfsd/pnfsd.h
@@ -135,7 +135,7 @@ void pnfs_set_device_notify(clientid_t *, unsigned int types);
void pnfs_clear_device_notify(struct nfs4_client *);
#if defined(CONFIG_PNFSD_LOCAL_EXPORT)
-extern struct sockaddr pnfsd_lexp_addr;
+extern struct sockaddr_storage pnfsd_lexp_addr;
extern size_t pnfs_lexp_addr_len;
extern void pnfsd_lexp_init(struct inode *);
diff --git a/fs/nfsd/pnfsd_lexp.c b/fs/nfsd/pnfsd_lexp.c
index e9382da..86614b1 100644
--- a/fs/nfsd/pnfsd_lexp.c
+++ b/fs/nfsd/pnfsd_lexp.c
@@ -27,7 +27,7 @@
#define NFSDDBG_FACILITY NFSDDBG_PNFS
-struct sockaddr pnfsd_lexp_addr;
+struct sockaddr_storage pnfsd_lexp_addr;
size_t pnfs_lexp_addr_len;
static wait_queue_head_t lo_recall_wq;
@@ -87,7 +87,7 @@ pnfsd_lexp_get_device_info(struct super_block *sb,
goto out;
}
- /* count the number of comma-delimited DS IPs */
+ /* format local address */
fdev.fl_device_length = 1;
fdev.fl_device_list = fl_devices;
@@ -100,7 +100,7 @@ pnfsd_lexp_get_device_info(struct super_block *sb,
if (err < 0)
goto out;
daddr.r_addr.len = err;
- switch (pnfsd_lexp_addr.sa_family) {
+ switch (pnfsd_lexp_addr.ss_family) {
case AF_INET:
daddr.r_netid.data = "tcp";
daddr.r_netid.len = 3;
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 52cd57501..eff2127 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -208,13 +208,13 @@ static inline char *__svc_print_addr(const struct sockaddr *addr,
/*
* Print a network address in a universal format (see rfc1833 and nfsv4.1)
*/
-static inline int __svc_print_netaddr(struct sockaddr *addr,
+static inline int __svc_print_netaddr(struct sockaddr_storage *addr,
struct xdr_netobj *na)
{
u16 port;
ssize_t len;
- switch (addr->sa_family) {
+ switch (addr->ss_family) {
case AF_INET: {
struct sockaddr_in *sin = (struct sockaddr_in *)addr;
port = ntohs(sin->sin_port);
@@ -235,7 +235,7 @@ static inline int __svc_print_netaddr(struct sockaddr *addr,
}
default:
snprintf(na->data, na->len, "unknown address type: %d",
- addr->sa_family);
+ addr->ss_family);
len = -EINVAL;
break;
}
--
1.7.3.4
reply other threads:[~2011-05-31 18:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4DE5316D.1030906@gmail.com \
--to=mikegroshans@gmail.com \
--cc=linux-nfs@vger.kernel.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).