* [PATCH 10/25] NFS: Change cb_recallargs to pass "struct sockaddr *" instead of sockaddr_in
From: Chuck Lever @ 2007-11-13 18:31 UTC (permalink / raw)
To: nfs; +Cc: netdev
Change the addr field in the cb_recallargs struct to a "struct sockaddr *"
to support IPv6 addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/callback.h | 2 +-
fs/nfs/callback_proc.c | 2 +-
fs/nfs/callback_xdr.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index ec0ffd9..bb25d21 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -53,7 +53,7 @@ struct cb_getattrres {
};
struct cb_recallargs {
- struct sockaddr_in *addr;
+ struct sockaddr *addr;
struct nfs_fh fh;
nfs4_stateid stateid;
uint32_t truncate;
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 2a1b14f..00082cf 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -68,7 +68,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
__be32 res;
res = htonl(NFS4ERR_BADHANDLE);
- clp = nfs_find_client(args->addr, 4);
+ clp = nfs_find_client((struct sockaddr_in *)args->addr, 4);
if (clp == NULL)
goto out;
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 3eda1bc..c63eb72 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -188,7 +188,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr,
__be32 *p;
__be32 status;
- args->addr = svc_addr_in(rqstp);
+ args->addr = svc_addr(rqstp);
status = decode_stateid(xdr, &args->stateid);
if (unlikely(status != 0))
goto out;
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 11/25] NFS: Make nfs_alloc_client() take (sockaddr, len) instead of sockaddr_in
From: Chuck Lever @ 2007-11-13 18:31 UTC (permalink / raw)
To: nfs; +Cc: netdev
To support non-IPv4 addresses, adjust the arguments and callers of
nfs_alloc_client() to pass in a "struct sockaddr *" and length instead of
a "struct sockaddr_in *".
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/client.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 53bf8ab..c1ee3d3 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -100,7 +100,8 @@ struct rpc_program nfsacl_program = {
* bother putting them in a slab cache...
*/
static struct nfs_client *nfs_alloc_client(const char *hostname,
- const struct sockaddr_in *addr,
+ const struct sockaddr *addr,
+ size_t addrlen,
unsigned int nfsversion)
{
struct nfs_client *clp;
@@ -117,7 +118,7 @@ static struct nfs_client *nfs_alloc_client(const char *hostname,
atomic_set(&clp->cl_count, 1);
clp->cl_cons_state = NFS_CS_INITING;
- clp->cl_addrlen = sizeof(*addr); /* for now */
+ clp->cl_addrlen = addrlen;
memcpy(&clp->cl_addr, addr, clp->cl_addrlen);
if (hostname) {
@@ -285,7 +286,9 @@ static struct nfs_client *nfs_get_client(const char *hostname,
spin_unlock(&nfs_client_lock);
- new = nfs_alloc_client(hostname, addr, nfsversion);
+ new = nfs_alloc_client(hostname,
+ (const struct sockaddr *)addr,
+ sizeof(*addr), nfsversion);
} while (new);
return ERR_PTR(-ENOMEM);
^ permalink raw reply related
* [PATCH] powerpc: Fix fs_enet module build
From: Jochen Friedrich @ 2007-11-13 18:32 UTC (permalink / raw)
To: linuxppc-embedded@ozlabs.org; +Cc: Jeff Garzik, netdev, linux-kernel, akpm
If fs_enet is build as module, on PPC_CPM_NEW_BINDING platforms
mii-fec/mii-bitbang should be build as module, as well. On other
platforms, mii-fec/mii-bitbang must be included into the main module.
Otherwise some symbols remain undefined. Additionally, fs_enet uses
libphy, so add a select PHYLIB.
Building modules, stage 2.
MODPOST 5 modules
ERROR: "fs_scc_ops" [drivers/net/fs_enet/fs_enet.ko] undefined!
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
Signed-off-by: Jochen Friedrich <jochen@scram.de>
---
This patch replaces powerpc-fs_enet-select-phylib-as-the-driver-needs-it.patch
from -mm.
drivers/net/fs_enet/Kconfig | 11 ++++++++++-
drivers/net/fs_enet/Makefile | 15 ++++++++++++---
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/drivers/net/fs_enet/Kconfig b/drivers/net/fs_enet/Kconfig
index 2765e49..562ea68 100644
--- a/drivers/net/fs_enet/Kconfig
+++ b/drivers/net/fs_enet/Kconfig
@@ -2,6 +2,7 @@ config FS_ENET
tristate "Freescale Ethernet Driver"
depends on CPM1 || CPM2
select MII
+ select PHYLIB
config FS_ENET_HAS_SCC
bool "Chip has an SCC usable for ethernet"
@@ -11,11 +12,19 @@ config FS_ENET_HAS_SCC
config FS_ENET_HAS_FCC
bool "Chip has an FCC usable for ethernet"
depends on FS_ENET && CPM2
- select MDIO_BITBANG
default y
config FS_ENET_HAS_FEC
bool "Chip has an FEC usable for ethernet"
depends on FS_ENET && CPM1
+ select FS_ENET_MDIO_FEC
default y
+config FS_ENET_MDIO_FEC
+ tristate "MDIO driver for FEC"
+ depends on FS_ENET && CPM1
+
+config FS_ENET_MDIO_FCC
+ tristate "MDIO driver for FCC"
+ depends on FS_ENET && CPM2
+ select MDIO_BITBANG
diff --git a/drivers/net/fs_enet/Makefile b/drivers/net/fs_enet/Makefile
index 02d4dc1..1ffbe07 100644
--- a/drivers/net/fs_enet/Makefile
+++ b/drivers/net/fs_enet/Makefile
@@ -4,7 +4,16 @@
obj-$(CONFIG_FS_ENET) += fs_enet.o
-obj-$(CONFIG_8xx) += mac-fec.o mac-scc.o mii-fec.o
-obj-$(CONFIG_CPM2) += mac-fcc.o mii-bitbang.o
+fs_enet-$(CONFIG_FS_ENET_HAS_SCC) += mac-scc.o
+fs_enet-$(CONFIG_FS_ENET_HAS_FEC) += mac-fec.o
+fs_enet-$(CONFIG_FS_ENET_HAS_FCC) += mac-fcc.o
-fs_enet-objs := fs_enet-main.o
+ifeq ($(CONFIG_PPC_CPM_NEW_BINDING),y)
+obj-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o
+obj-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o
+else
+fs_enet-$(CONFIG_FS_ENET_MDIO_FEC) += mii-fec.o
+fs_enet-$(CONFIG_FS_ENET_MDIO_FCC) += mii-bitbang.o
+endif
+
+fs_enet-objs := fs_enet-main.o $(fs_enet-m)
--
1.5.3.5
^ permalink raw reply related
* [PATCH 13/25] NFS: Distinguish IPv6 addresses in __nfs_find_client
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Add support for the AF_INET6 family of IP addresses in __nfs_find_client.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/client.c | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 8eff0b2..67a5a53 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -34,6 +34,8 @@
#include <linux/nfs_idmap.h>
#include <linux/vfs.h>
#include <linux/inet.h>
+#include <linux/in6.h>
+#include <net/ipv6.h>
#include <linux/nfs_xdr.h>
#include <asm/system.h>
@@ -213,11 +215,10 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr *addr,
unsigned int nfsversion,
int match_port)
{
- struct sockaddr_in *ap = (struct sockaddr_in *)addr;
struct nfs_client *clp;
list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
- struct sockaddr_in *clap = (struct sockaddr_in *)&clp->cl_addr;
+ struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr;
/* Don't match clients that failed to initialise properly */
if (clp->cl_cons_state < 0)
@@ -227,14 +228,33 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr *addr,
if (clp->rpc_ops->version != nfsversion)
continue;
- if (((struct sockaddr *)clap)->sa_family != addr->sa_family)
+ if (clap->sa_family != addr->sa_family)
continue;
- if (clap->sin_addr.s_addr != ap->sin_addr.s_addr)
+ switch (addr->sa_family) {
+ case AF_INET: {
+ struct sockaddr_in *sap = (struct sockaddr_in *)clap;
+ struct sockaddr_in *ap = (struct sockaddr_in *)addr;
+ if (sap->sin_addr.s_addr != ap->sin_addr.s_addr)
+ continue;
+ if (!match_port || sap->sin_port == ap->sin_port)
+ goto found;
continue;
-
- if (!match_port || clap->sin_port == ap->sin_port)
- goto found;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6 *sap = (struct sockaddr_in6 *)clap;
+ struct sockaddr_in6 *ap = (struct sockaddr_in6 *)addr;
+ if (!ipv6_addr_equal(&sap->sin6_addr, &ap->sin6_addr))
+ continue;
+ if (!match_port || sap->sin6_port == ap->sin6_port)
+ goto found;
+ continue;
+ }
+ default:
+ printk(KERN_ERR "%s: address family not supported\n",
+ __FUNCTION__);
+ return NULL;
+ }
}
return NULL;
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 12/25] NFS: Change __nfs_find_client() to take "struct sockaddr *"
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Adjust the arguments and callers of __nfs_find_client() to pass a "struct
sockaddr *" instead of a "struct sockaddr_in *" so that non-IPv4 addresses
can be passed into __nfs_find_client().
A subsequent patch adds support for IPv6 addresses to __nfs_find_client().
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/client.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index c1ee3d3..8eff0b2 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -209,10 +209,11 @@ void nfs_put_client(struct nfs_client *clp)
* Find a client by address
* - caller must hold nfs_client_lock
*/
-static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr,
+static struct nfs_client *__nfs_find_client(const struct sockaddr *addr,
unsigned int nfsversion,
int match_port)
{
+ struct sockaddr_in *ap = (struct sockaddr_in *)addr;
struct nfs_client *clp;
list_for_each_entry(clp, &nfs_client_list, cl_share_link) {
@@ -226,10 +227,13 @@ static struct nfs_client *__nfs_find_client(const struct sockaddr_in *addr,
if (clp->rpc_ops->version != nfsversion)
continue;
- if (clap->sin_addr.s_addr != addr->sin_addr.s_addr)
+ if (((struct sockaddr *)clap)->sa_family != addr->sa_family)
continue;
- if (!match_port || clap->sin_port == addr->sin_port)
+ if (clap->sin_addr.s_addr != ap->sin_addr.s_addr)
+ continue;
+
+ if (!match_port || clap->sin_port == ap->sin_port)
goto found;
}
@@ -250,7 +254,7 @@ struct nfs_client *nfs_find_client(const struct sockaddr_in *addr,
struct nfs_client *clp;
spin_lock(&nfs_client_lock);
- clp = __nfs_find_client(addr, nfsversion, 0);
+ clp = __nfs_find_client((struct sockaddr *)addr, nfsversion, 0);
spin_unlock(&nfs_client_lock);
if (clp != NULL && clp->cl_cons_state != NFS_CS_READY) {
nfs_put_client(clp);
@@ -278,7 +282,7 @@ static struct nfs_client *nfs_get_client(const char *hostname,
do {
spin_lock(&nfs_client_lock);
- clp = __nfs_find_client(addr, nfsversion, 1);
+ clp = __nfs_find_client((struct sockaddr *)addr, nfsversion, 1);
if (clp)
goto found_client;
if (new)
^ permalink raw reply related
* [PATCH 15/25] NFS: Change nfs_get_client() to take (sockaddr *, len)
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Adjust arguments and callers of nfs_get_client() to pass a
"struct sockaddr *" and length instead of "struct sockaddr_in *" to support
non-IPv4 addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/client.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 7b45ed0..f03a742 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -288,21 +288,21 @@ struct nfs_client *nfs_find_client(const struct sockaddr *addr,
* - creates a new record if one doesn't yet exist
*/
static struct nfs_client *nfs_get_client(const char *hostname,
- const struct sockaddr_in *addr,
+ const struct sockaddr *addr,
+ size_t addrlen,
unsigned int nfsversion)
{
struct nfs_client *clp, *new = NULL;
int error;
- dprintk("--> nfs_get_client(%s,"NIPQUAD_FMT":%d,%u)\n",
- hostname ?: "", NIPQUAD(addr->sin_addr),
- addr->sin_port, nfsversion);
+ dprintk("--> nfs_get_client(%s,v%u)\n",
+ hostname ?: "", nfsversion);
/* see if the client already exists */
do {
spin_lock(&nfs_client_lock);
- clp = __nfs_find_client((struct sockaddr *)addr, nfsversion, 1);
+ clp = __nfs_find_client(addr, nfsversion, 1);
if (clp)
goto found_client;
if (new)
@@ -310,9 +310,7 @@ static struct nfs_client *nfs_get_client(const char *hostname,
spin_unlock(&nfs_client_lock);
- new = nfs_alloc_client(hostname,
- (const struct sockaddr *)addr,
- sizeof(*addr), nfsversion);
+ new = nfs_alloc_client(hostname, addr, addrlen, nfsversion);
} while (new);
return ERR_PTR(-ENOMEM);
@@ -588,7 +586,9 @@ static int nfs_init_server(struct nfs_server *server,
/* Allocate or find a client reference we can use */
clp = nfs_get_client(data->nfs_server.hostname,
- &data->nfs_server.address, nfsvers);
+ (struct sockaddr *)&data->nfs_server.address,
+ sizeof(data->nfs_server.address),
+ nfsvers);
if (IS_ERR(clp)) {
dprintk("<-- nfs_init_server() = error %ld\n", PTR_ERR(clp));
return PTR_ERR(clp);
@@ -925,7 +925,8 @@ static int nfs4_set_client(struct nfs_server *server,
dprintk("--> nfs4_set_client()\n");
/* Allocate or find a client reference we can use */
- clp = nfs_get_client(hostname, addr, 4);
+ clp = nfs_get_client(hostname, (struct sockaddr *)addr,
+ sizeof(*addr), 4);
if (IS_ERR(clp)) {
error = PTR_ERR(clp);
goto error;
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 14/25] NFS: Change nfs_find_client() to take "struct sockaddr *"
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Adjust arguments and callers of nfs_find_client() to pass a
"struct sockaddr *" instead of "struct sockaddr_in *" to support non-IPv4
addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/callback.c | 3 +--
fs/nfs/callback_proc.c | 4 ++--
fs/nfs/client.c | 4 ++--
fs/nfs/internal.h | 2 +-
4 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index bbf67f1..9b6bbf1 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -164,12 +164,11 @@ void nfs_callback_down(void)
static int nfs_callback_authenticate(struct svc_rqst *rqstp)
{
- struct sockaddr_in *addr = svc_addr_in(rqstp);
struct nfs_client *clp;
char buf[RPC_MAX_ADDRBUFLEN];
/* Don't talk to strangers */
- clp = nfs_find_client(addr, 4);
+ clp = nfs_find_client(svc_addr(rqstp), 4);
if (clp == NULL)
return SVC_DROP;
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 00082cf..019d939 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -25,7 +25,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *
res->bitmap[0] = res->bitmap[1] = 0;
res->status = htonl(NFS4ERR_BADHANDLE);
- clp = nfs_find_client((struct sockaddr_in *)args->addr, 4);
+ clp = nfs_find_client(args->addr, 4);
if (clp == NULL)
goto out;
@@ -68,7 +68,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
__be32 res;
res = htonl(NFS4ERR_BADHANDLE);
- clp = nfs_find_client((struct sockaddr_in *)args->addr, 4);
+ clp = nfs_find_client(args->addr, 4);
if (clp == NULL)
goto out;
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 67a5a53..7b45ed0 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -268,13 +268,13 @@ found:
* Find a client by IP address and protocol version
* - returns NULL if no such client
*/
-struct nfs_client *nfs_find_client(const struct sockaddr_in *addr,
+struct nfs_client *nfs_find_client(const struct sockaddr *addr,
unsigned int nfsversion)
{
struct nfs_client *clp;
spin_lock(&nfs_client_lock);
- clp = __nfs_find_client((struct sockaddr *)addr, nfsversion, 0);
+ clp = __nfs_find_client(addr, nfsversion, 0);
spin_unlock(&nfs_client_lock);
if (clp != NULL && clp->cl_cons_state != NFS_CS_READY) {
nfs_put_client(clp);
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 3d5e587..ef40539 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -64,7 +64,7 @@ extern struct rpc_program nfs_program;
extern void nfs_put_client(struct nfs_client *);
extern struct nfs_client *nfs_find_client(
- const struct sockaddr_in *,
+ const struct sockaddr *,
unsigned int);
extern struct nfs_server *nfs_create_server(
const struct nfs_parsed_mount_data *,
^ permalink raw reply related
* [PATCH 16/25] NFS: Adjust nfs_clone_mount structure to store "struct sockaddr *"
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Change the addr field in the nfs_clone_mount structure to store a "struct
sockaddr *" to support non-IPv4 addresses in the NFS client.
Note this is mostly a cosmetic change, and does not actually allow
referrals using IPv6 addresses. The existing referral code assumes that
the server returns a string that represents an IPv4 address. This code
needs to support hostnames and IPv6 addresses as well as IPv4 addresses,
thus it will need to be restructured in order to handle DNS resolution in
user space.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/client.c | 3 ++-
fs/nfs/internal.h | 2 +-
fs/nfs/nfs4namespace.c | 11 ++++++-----
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index f03a742..5e53892 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1072,7 +1072,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
/* Get a client representation.
* Note: NFSv4 always uses TCP, */
- error = nfs4_set_client(server, data->hostname, data->addr,
+ error = nfs4_set_client(server, data->hostname,
+ (struct sockaddr_in *)data->addr,
parent_client->cl_ipaddr,
data->authflavor,
parent_server->client->cl_xprt->prot,
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index ef40539..40f2619 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -21,7 +21,7 @@ struct nfs_clone_mount {
struct nfs_fattr *fattr;
char *hostname;
char *mnt_path;
- struct sockaddr_in *addr;
+ struct sockaddr *addr;
rpc_authflavor_t authflavor;
};
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index bd1b161..65dcbfd 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -172,7 +172,10 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
s = 0;
while (s < location->nservers) {
- struct sockaddr_in addr = {};
+ struct sockaddr_in addr = {
+ .sin_family = AF_INET,
+ .sin_port = htons(NFS_PORT),
+ };
if (location->servers[s].len <= 0 ||
valid_ipaddr4(location->servers[s].data) < 0) {
@@ -181,10 +184,8 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
}
mountdata.hostname = location->servers[s].data;
- addr.sin_addr.s_addr = in_aton(mountdata.hostname);
- addr.sin_family = AF_INET;
- addr.sin_port = htons(NFS_PORT);
- mountdata.addr = &addr;
+ addr.sin_addr.s_addr = in_aton(mountdata.hostname),
+ mountdata.addr = (struct sockaddr *)&addr;
snprintf(page, PAGE_SIZE, "%s:%s",
mountdata.hostname,
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 17/25] NFS: Change nfs4_set_client() to accept (sockaddr *, len)
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Adjust the arguments and callers of nfs4_set_client() to pass a "struct
sockaddr *" and a length instead of a "struct sockaddr_in *" to support
non-IPv4 addresses in the NFS client.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/client.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 5e53892..37b63a6 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -914,7 +914,9 @@ error:
* Set up an NFS4 client
*/
static int nfs4_set_client(struct nfs_server *server,
- const char *hostname, const struct sockaddr_in *addr,
+ const char *hostname,
+ const struct sockaddr *addr,
+ const size_t addrlen,
const char *ip_addr,
rpc_authflavor_t authflavour,
int proto, int timeo, int retrans)
@@ -925,8 +927,7 @@ static int nfs4_set_client(struct nfs_server *server,
dprintk("--> nfs4_set_client()\n");
/* Allocate or find a client reference we can use */
- clp = nfs_get_client(hostname, (struct sockaddr *)addr,
- sizeof(*addr), 4);
+ clp = nfs_get_client(hostname, addr, addrlen, 4);
if (IS_ERR(clp)) {
error = PTR_ERR(clp);
goto error;
@@ -997,7 +998,8 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
/* Get a client record */
error = nfs4_set_client(server,
data->nfs_server.hostname,
- &data->nfs_server.address,
+ (struct sockaddr *)&data->nfs_server.address,
+ sizeof(data->nfs_server.address),
data->client_address,
data->auth_flavors[0],
data->nfs_server.protocol,
@@ -1073,7 +1075,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
/* Get a client representation.
* Note: NFSv4 always uses TCP, */
error = nfs4_set_client(server, data->hostname,
- (struct sockaddr_in *)data->addr,
+ data->addr,
+ sizeof(*data->addr),
parent_client->cl_ipaddr,
data->authflavor,
parent_server->client->cl_xprt->prot,
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 18/25] NFS: Remove the NIPQUAD from nfs_try_mount
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
In the name of address family compatibility, we can't have the NIP_FMT and
NIPQUAD macros in nfs_try_mount(). Instead, we can make use of an unused
mount option to display the mount server's hostname.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/super.c | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 6258a19..262adb4 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -87,7 +87,7 @@ enum {
Opt_nfsvers,
/* Mount options that take string arguments */
- Opt_sec, Opt_proto, Opt_mountproto,
+ Opt_sec, Opt_proto, Opt_mountproto, Opt_mounthost,
Opt_addr, Opt_mountaddr, Opt_clientaddr,
/* Mount options that are ignored */
@@ -146,7 +146,7 @@ static match_table_t nfs_mount_option_tokens = {
{ Opt_mountproto, "mountproto=%s" },
{ Opt_addr, "addr=%s" },
{ Opt_clientaddr, "clientaddr=%s" },
- { Opt_userspace, "mounthost=%s" },
+ { Opt_mounthost, "mounthost=%s" },
{ Opt_mountaddr, "mountaddr=%s" },
{ Opt_err, NULL }
@@ -953,6 +953,12 @@ static int nfs_parse_mount_options(char *raw,
goto out_nomem;
mnt->client_address = string;
break;
+ case Opt_mounthost:
+ string = match_strdup(args);
+ if (string == NULL)
+ goto out_nomem;
+ mnt->mount_server.hostname = string;
+ break;
case Opt_mountaddr:
string = match_strdup(args);
if (string == NULL)
@@ -1000,6 +1006,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
{
struct sockaddr_in sin;
int status;
+ char *hostname;
if (args->mount_server.version == 0) {
if (args->flags & NFS_MOUNT_VER3)
@@ -1008,6 +1015,11 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
args->mount_server.version = NFS_MNT_VERSION;
}
+ if (args->mount_server.hostname)
+ hostname = args->mount_server.hostname;
+ else
+ hostname = args->nfs_server.hostname;
+
/*
* Construct the mount server's address.
*/
@@ -1026,7 +1038,7 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
*/
status = nfs_mount((struct sockaddr *) &sin,
sizeof(sin),
- args->nfs_server.hostname,
+ hostname,
args->nfs_server.export_path,
args->mount_server.version,
args->mount_server.protocol,
@@ -1034,8 +1046,8 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
if (status == 0)
return 0;
- dfprintk(MOUNT, "NFS: unable to mount server " NIPQUAD_FMT
- ", error %d\n", NIPQUAD(sin.sin_addr.s_addr), status);
+ dfprintk(MOUNT, "NFS: unable to mount server %s, error %d",
+ hostname, status);
return status;
}
@@ -1407,6 +1419,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
out:
kfree(data.nfs_server.hostname);
+ kfree(data.mount_server.hostname);
return error;
out_err_nosb:
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 19/25] NFS: Make setting a port number agostic
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
We'll need to set the port number of an AF_INET or AF_INET6 address in
several places in fs/nfs/super.c, so introduce a helper that can manage
this for us. We put this helper to immediate use.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfs/super.c | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 262adb4..7dc56ce 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -45,6 +45,7 @@
#include <linux/nfs_idmap.h>
#include <linux/vfs.h>
#include <linux/inet.h>
+#include <linux/in6.h>
#include <linux/nfs_xdr.h>
#include <linux/magic.h>
#include <linux/parser.h>
@@ -574,6 +575,28 @@ static void nfs_umount_begin(struct vfsmount *vfsmnt, int flags)
}
/*
+ * Set the port number in an address. Be agnostic about the address family.
+ */
+static int nfs_set_address_port(struct sockaddr *sap, unsigned short port)
+{
+ switch (sap->sa_family) {
+ case AF_INET: {
+ struct sockaddr_in *ap = (struct sockaddr_in *)sap;
+ ap->sin_port = htons(port);
+ return 0;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
+ ap->sin6_port = htons(port);
+ return 0;
+ }
+ default:
+ dfprintk(MOUNT, "NFS: unrecognized address family\n");
+ return -EAFNOSUPPORT;
+ }
+}
+
+/*
* Sanity-check a server address provided by the mount command
*/
static int nfs_verify_server_address(struct sockaddr *addr)
@@ -691,6 +714,7 @@ static int nfs_parse_mount_options(char *raw,
struct nfs_parsed_mount_data *mnt)
{
char *p, *string;
+ unsigned short port = 0;
if (!raw) {
dfprintk(MOUNT, "NFS: mount options string was NULL.\n");
@@ -793,7 +817,7 @@ static int nfs_parse_mount_options(char *raw,
return 0;
if (option < 0 || option > 65535)
return 0;
- mnt->nfs_server.address.sin_port = htons(option);
+ port = option;
break;
case Opt_rsize:
if (match_int(args, &mnt->rsize))
@@ -978,6 +1002,10 @@ static int nfs_parse_mount_options(char *raw,
}
}
+ if (nfs_set_address_port((struct sockaddr *)
+ &mnt->nfs_server.address, port))
+ return 0;
+
return 1;
out_nomem:
@@ -1030,7 +1058,9 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
/*
* autobind will be used if mount_server.port == 0
*/
- sin.sin_port = htons(args->mount_server.port);
+ if (nfs_set_address_port((struct sockaddr *)&sin,
+ args->mount_server.port))
+ return -EAFNOSUPPORT;
/*
* Now ask the mount server to map our export path
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 03/25] NFS: Increase size of cl_ipaddr field to hold IPv6 addresses
From: Chuck Lever @ 2007-11-13 18:31 UTC (permalink / raw)
To: nfs; +Cc: netdev
The nfs_client's cl_ipaddr field needs to be larger to hold strings that
represent IPv6 addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
include/linux/nfs_fs_sb.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 8a3061c..f2a0f20 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -63,7 +63,7 @@ struct nfs_client {
/* Our own IP address, as a null-terminated string.
* This is used to generate the clientid, and the callback address.
*/
- char cl_ipaddr[16];
+ char cl_ipaddr[64];
unsigned char cl_id_uniquifier;
#endif
};
^ permalink raw reply related
* [PATCH 20/25] NFS: Set default port for NFSv4, with support for AF_INET6
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Move more address family dependencies to a helper function.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfs/super.c | 40 ++++++++++++++++++++++++++++++++--------
1 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 7dc56ce..1831394 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1573,6 +1573,31 @@ static void nfs4_fill_super(struct super_block *sb)
}
/*
+ * If the user didn't specify a port, set the port number to
+ * the NFS version 4 default port.
+ */
+static int nfs4_default_port(struct sockaddr *sap)
+{
+ switch (sap->sa_family) {
+ case AF_INET: {
+ struct sockaddr_in *ap = (struct sockaddr_in *)sap;
+ if (ap->sin_port == 0)
+ ap->sin_port = htons(NFS_PORT);
+ return 0;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6 *ap = (struct sockaddr_in6 *)sap;
+ if (ap->sin6_port == 0)
+ ap->sin6_port = htons(NFS_PORT);
+ return 0;
+ }
+ default:
+ dfprintk(MOUNT, "NFS: unrecognized address family\n");
+ return -EAFNOSUPPORT;
+ }
+}
+
+/*
* Validate NFSv4 mount options
*/
static int nfs4_validate_mount_data(void *options,
@@ -1580,6 +1605,7 @@ static int nfs4_validate_mount_data(void *options,
const char *dev_name)
{
struct nfs4_mount_data *data = (struct nfs4_mount_data *)options;
+ struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
char *c;
if (data == NULL)
@@ -1604,10 +1630,9 @@ static int nfs4_validate_mount_data(void *options,
data->host_addr,
sizeof(args->nfs_server.address)))
return -EFAULT;
- if (args->nfs_server.address.sin_port == 0)
- args->nfs_server.address.sin_port = htons(NFS_PORT);
- if (!nfs_verify_server_address((struct sockaddr *)
- &args->nfs_server.address))
+ if (nfs4_default_port(sap))
+ goto out_no_address;
+ if (!nfs_verify_server_address(sap))
goto out_no_address;
switch (data->auth_flavourlen) {
@@ -1663,10 +1688,9 @@ static int nfs4_validate_mount_data(void *options,
if (nfs_parse_mount_options((char *)options, args) == 0)
return -EINVAL;
- if (args->nfs_server.address.sin_port == 0)
- args->nfs_server.address.sin_port = htons(NFS_PORT);
- if (!nfs_verify_server_address((struct sockaddr *)
- &args->nfs_server.address))
+ if (nfs4_default_port(sap))
+ return -EINVAL;
+ if (!nfs_verify_server_address(sap))
return -EINVAL;
switch (args->auth_flavor_len) {
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 21/25] NFS: Refactor mount option address parsing into separate function
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Some mount options pass in a string IP address. Let's parse these strings
in a separate function since this is done for at least two different mount
options.
This allows us to support IPv6 string addresses more easily in a subsequent
patch
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/super.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 1831394..c09c045 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -614,6 +614,16 @@ static int nfs_verify_server_address(struct sockaddr *addr)
}
/*
+ * Parse string addresses passed in via a mount option.
+ */
+static void nfs_parse_server_address(char *value,
+ struct sockaddr_in *addr)
+{
+ addr->sin_family = AF_INET;
+ addr->sin_addr.s_addr = in_aton(value);
+}
+
+/*
* Parse the value of the 'sec=' option.
*/
static int nfs_parse_security_flavors(char *value,
@@ -966,9 +976,8 @@ static int nfs_parse_mount_options(char *raw,
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
- mnt->nfs_server.address.sin_family = AF_INET;
- mnt->nfs_server.address.sin_addr.s_addr =
- in_aton(string);
+ nfs_parse_server_address(string,
+ &mnt->nfs_server.address);
kfree(string);
break;
case Opt_clientaddr:
@@ -987,9 +996,8 @@ static int nfs_parse_mount_options(char *raw,
string = match_strdup(args);
if (string == NULL)
goto out_nomem;
- mnt->mount_server.address.sin_family = AF_INET;
- mnt->mount_server.address.sin_addr.s_addr =
- in_aton(string);
+ nfs_parse_server_address(string,
+ &mnt->mount_server.address);
kfree(string);
break;
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 22/25] NFS: Support non-IPv4 addresses in nfs_parsed_mount_data
From: Chuck Lever @ 2007-11-13 18:32 UTC (permalink / raw)
To: nfs; +Cc: netdev
Replace the nfs_server and mount_server address fields in the
nfs_parsed_mount_data structure with a "struct sockaddr_storage" and a
length, instead of a "struct sockaddr_in".
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/client.c | 11 +++++-----
fs/nfs/internal.h | 6 ++++--
fs/nfs/super.c | 56 +++++++++++++++++++++++++++++++++--------------------
3 files changed, 44 insertions(+), 29 deletions(-)
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 37b63a6..3ee0f0d 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -573,6 +573,7 @@ error:
static int nfs_init_server(struct nfs_server *server,
const struct nfs_parsed_mount_data *data)
{
+ struct sockaddr *sap = (struct sockaddr *)&data->nfs_server.address;
struct nfs_client *clp;
unsigned int nfsvers = 2;
int error;
@@ -585,10 +586,8 @@ static int nfs_init_server(struct nfs_server *server,
#endif
/* Allocate or find a client reference we can use */
- clp = nfs_get_client(data->nfs_server.hostname,
- (struct sockaddr *)&data->nfs_server.address,
- sizeof(data->nfs_server.address),
- nfsvers);
+ clp = nfs_get_client(data->nfs_server.hostname, sap,
+ data->nfs_server.addrlen, nfsvers);
if (IS_ERR(clp)) {
dprintk("<-- nfs_init_server() = error %ld\n", PTR_ERR(clp));
return PTR_ERR(clp);
@@ -985,6 +984,7 @@ static int nfs4_init_server(struct nfs_server *server,
struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
struct nfs_fh *mntfh)
{
+ struct sockaddr *sap = (struct sockaddr *)&data->nfs_server.address;
struct nfs_fattr fattr;
struct nfs_server *server;
int error;
@@ -998,8 +998,7 @@ struct nfs_server *nfs4_create_server(const struct nfs_parsed_mount_data *data,
/* Get a client record */
error = nfs4_set_client(server,
data->nfs_server.hostname,
- (struct sockaddr *)&data->nfs_server.address,
- sizeof(data->nfs_server.address),
+ sap, data->nfs_server.addrlen,
data->client_address,
data->auth_flavors[0],
data->nfs_server.protocol,
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 40f2619..f8ccba9 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -44,7 +44,8 @@ struct nfs_parsed_mount_data {
char *client_address;
struct {
- struct sockaddr_in address;
+ struct sockaddr_storage address;
+ size_t addrlen;
char *hostname;
unsigned int version;
unsigned short port;
@@ -52,7 +53,8 @@ struct nfs_parsed_mount_data {
} mount_server;
struct {
- struct sockaddr_in address;
+ struct sockaddr_storage address;
+ size_t addrlen;
char *hostname;
char *export_path;
int protocol;
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c09c045..3ea4a4f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -599,8 +599,10 @@ static int nfs_set_address_port(struct sockaddr *sap, unsigned short port)
/*
* Sanity-check a server address provided by the mount command
*/
-static int nfs_verify_server_address(struct sockaddr *addr)
+static int nfs_verify_server_address(struct sockaddr_storage *ssp)
{
+ struct sockaddr *addr = (struct sockaddr *)ssp;
+
switch (addr->sa_family) {
case AF_INET: {
struct sockaddr_in *sa = (struct sockaddr_in *) addr;
@@ -617,10 +619,14 @@ static int nfs_verify_server_address(struct sockaddr *addr)
* Parse string addresses passed in via a mount option.
*/
static void nfs_parse_server_address(char *value,
- struct sockaddr_in *addr)
+ struct sockaddr_storage *ssp,
+ size_t *len)
{
- addr->sin_family = AF_INET;
- addr->sin_addr.s_addr = in_aton(value);
+ struct sockaddr_in *ap = (struct sockaddr_in *)ssp;
+
+ ap->sin_family = AF_INET;
+ ap->sin_addr.s_addr = in_aton(value);
+ *len = sizeof(*ap);
}
/*
@@ -977,7 +983,8 @@ static int nfs_parse_mount_options(char *raw,
if (string == NULL)
goto out_nomem;
nfs_parse_server_address(string,
- &mnt->nfs_server.address);
+ &mnt->nfs_server.address,
+ &mnt->nfs_server.addrlen);
kfree(string);
break;
case Opt_clientaddr:
@@ -997,7 +1004,8 @@ static int nfs_parse_mount_options(char *raw,
if (string == NULL)
goto out_nomem;
nfs_parse_server_address(string,
- &mnt->mount_server.address);
+ &mnt->mount_server.address,
+ &mnt->mount_server.addrlen);
kfree(string);
break;
@@ -1059,10 +1067,11 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
/*
* Construct the mount server's address.
*/
- if (args->mount_server.address.sin_addr.s_addr != INADDR_ANY)
- sin = args->mount_server.address;
+ if (args->mount_server.addrlen != 0)
+ memcpy(&sin, &args->mount_server.address, sizeof(sin));
else
- sin = args->nfs_server.address;
+ memcpy(&sin, &args->nfs_server.address, sizeof(sin));
+
/*
* autobind will be used if mount_server.port == 0
*/
@@ -1158,9 +1167,6 @@ static int nfs_validate_mount_data(void *options,
memset(mntfh->data + mntfh->size, 0,
sizeof(mntfh->data) - mntfh->size);
- if (!nfs_verify_server_address((struct sockaddr *) &data->addr))
- goto out_no_address;
-
/*
* Translate to nfs_parsed_mount_data, which nfs_fill_super
* can deal with.
@@ -1175,7 +1181,13 @@ static int nfs_validate_mount_data(void *options,
args->acregmax = data->acregmax;
args->acdirmin = data->acdirmin;
args->acdirmax = data->acdirmax;
- args->nfs_server.address = data->addr;
+
+ memcpy(&args->nfs_server.address, &data->addr,
+ sizeof(data->addr));
+ args->nfs_server.addrlen = sizeof(data->addr);
+ if (!nfs_verify_server_address(&args->nfs_server.address))
+ goto out_no_address;
+
if (!(data->flags & NFS_MOUNT_TCP))
args->nfs_server.protocol = XPRT_TRANSPORT_UDP;
/* N.B. caller will free nfs_server.hostname in all cases */
@@ -1193,8 +1205,7 @@ static int nfs_validate_mount_data(void *options,
if (nfs_parse_mount_options((char *)options, args) == 0)
return -EINVAL;
- if (!nfs_verify_server_address((struct sockaddr *)
- &args->nfs_server.address))
+ if (!nfs_verify_server_address(&args->nfs_server.address))
goto out_no_address;
c = strchr(dev_name, ':');
@@ -1612,6 +1623,7 @@ static int nfs4_validate_mount_data(void *options,
struct nfs_parsed_mount_data *args,
const char *dev_name)
{
+ struct sockaddr_in *ap;
struct nfs4_mount_data *data = (struct nfs4_mount_data *)options;
struct sockaddr *sap = (struct sockaddr *)&args->nfs_server.address;
char *c;
@@ -1632,15 +1644,17 @@ static int nfs4_validate_mount_data(void *options,
switch (data->version) {
case 1:
- if (data->host_addrlen != sizeof(args->nfs_server.address))
+ ap = (struct sockaddr_in *)&args->nfs_server.address;
+ if (data->host_addrlen > sizeof(args->nfs_server.address))
+ goto out_no_address;
+ if (data->host_addrlen == 0)
goto out_no_address;
- if (copy_from_user(&args->nfs_server.address,
- data->host_addr,
- sizeof(args->nfs_server.address)))
+ if (copy_from_user(ap, data->host_addr, data->host_addrlen))
return -EFAULT;
+ args->nfs_server.addrlen = data->host_addrlen;
if (nfs4_default_port(sap))
goto out_no_address;
- if (!nfs_verify_server_address(sap))
+ if (!nfs_verify_server_address(&args->nfs_server.address))
goto out_no_address;
switch (data->auth_flavourlen) {
@@ -1698,7 +1712,7 @@ static int nfs4_validate_mount_data(void *options,
if (nfs4_default_port(sap))
return -EINVAL;
- if (!nfs_verify_server_address(sap))
+ if (!nfs_verify_server_address(&args->nfs_server.address))
return -EINVAL;
switch (args->auth_flavor_len) {
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 23/25] NFS: Add AF_INET6 support to nfs_try_mount()
From: Chuck Lever @ 2007-11-13 18:33 UTC (permalink / raw)
To: nfs; +Cc: netdev
Update nfs_try_mount() to support AF_INET6 family addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfs/super.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 3ea4a4f..2abef88 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1048,7 +1048,7 @@ out_unknown:
static int nfs_try_mount(struct nfs_parsed_mount_data *args,
struct nfs_fh *root_fh)
{
- struct sockaddr_in sin;
+ struct sockaddr *sap = (struct sockaddr *)&args->mount_server.address;
int status;
char *hostname;
@@ -1067,24 +1067,25 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
/*
* Construct the mount server's address.
*/
- if (args->mount_server.addrlen != 0)
- memcpy(&sin, &args->mount_server.address, sizeof(sin));
- else
- memcpy(&sin, &args->nfs_server.address, sizeof(sin));
+ if (args->mount_server.addrlen == 0) {
+ memcpy(&args->mount_server.address,
+ &args->nfs_server.address,
+ args->nfs_server.addrlen);
+ args->mount_server.addrlen = args->nfs_server.addrlen;
+ }
/*
* autobind will be used if mount_server.port == 0
*/
- if (nfs_set_address_port((struct sockaddr *)&sin,
- args->mount_server.port))
+ if (nfs_set_address_port(sap, args->mount_server.port))
return -EAFNOSUPPORT;
/*
* Now ask the mount server to map our export path
* to a file handle.
*/
- status = nfs_mount((struct sockaddr *) &sin,
- sizeof(sin),
+ status = nfs_mount(sap,
+ args->mount_server.addrlen,
hostname,
args->nfs_server.export_path,
args->mount_server.version,
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 24/25] NFS: Parse IPv6 addresses in nfs_parse_server_address
From: Chuck Lever @ 2007-11-13 18:33 UTC (permalink / raw)
To: nfs; +Cc: netdev
Add the ability to parse IPv6 addresses passed in via the 'addr=' and
'mountaddr=' mount options.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/super.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 2abef88..c066016 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -622,11 +622,25 @@ static void nfs_parse_server_address(char *value,
struct sockaddr_storage *ssp,
size_t *len)
{
- struct sockaddr_in *ap = (struct sockaddr_in *)ssp;
-
- ap->sin_family = AF_INET;
- ap->sin_addr.s_addr = in_aton(value);
- *len = sizeof(*ap);
+ if (strchr(value, ':') == NULL) {
+ struct sockaddr_in *ap = (struct sockaddr_in *)ssp;
+ u8 buf[4];
+
+ if (in4_pton(value, -1, buf, '\0', NULL)) {
+ ap->sin_family = AF_INET;
+ memcpy(&ap->sin_addr.s_addr, buf, sizeof(buf));
+ *len = sizeof(*ap);
+ }
+ } else {
+ struct sockaddr_in6 *ap = (struct sockaddr_in6 *)ssp;
+ u8 buf[16];
+
+ if (in6_pton(value, -1, buf, '\0', NULL)) {
+ ap->sin6_family = AF_INET6;
+ memcpy(&ap->sin6_addr.in6_u, buf, sizeof(buf));
+ *len = sizeof(*ap);
+ }
+ }
}
/*
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* [PATCH 25/25] NFS: Verify IPv6 addresses properly
From: Chuck Lever @ 2007-11-13 18:33 UTC (permalink / raw)
To: nfs; +Cc: netdev
Add support to nfs_verify_server_address for recognizing AF_INET6 addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/nfs/super.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index c066016..f0af79b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -46,6 +46,7 @@
#include <linux/vfs.h>
#include <linux/inet.h>
#include <linux/in6.h>
+#include <net/ipv6.h>
#include <linux/nfs_xdr.h>
#include <linux/magic.h>
#include <linux/parser.h>
@@ -601,14 +602,14 @@ static int nfs_set_address_port(struct sockaddr *sap, unsigned short port)
*/
static int nfs_verify_server_address(struct sockaddr_storage *ssp)
{
- struct sockaddr *addr = (struct sockaddr *)ssp;
-
- switch (addr->sa_family) {
+ switch (ssp->ss_family) {
case AF_INET: {
- struct sockaddr_in *sa = (struct sockaddr_in *) addr;
- if (sa->sin_addr.s_addr != INADDR_ANY)
- return 1;
- break;
+ struct sockaddr_in *sa = (struct sockaddr_in *)ssp;
+ return sa->sin_addr.s_addr != INADDR_ANY;
+ }
+ case AF_INET6: {
+ struct in6_addr *sa = &((struct sockaddr_in6 *)ssp)->sin6_addr;
+ return !ipv6_addr_any(sa);
}
}
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply related
* Re: [BUG] New Kernel Bugs
From: Adrian Bunk @ 2007-11-13 18:36 UTC (permalink / raw)
To: Mark Lord
Cc: Ingo Molnar, Andrew Morton, David Miller, protasnb, linux-kernel,
netdev, alsa-devel, linux-ide, linux-pcmcia, linux-input,
bugme-daemon
In-Reply-To: <4739EA83.5040006@rtr.ca>
On Tue, Nov 13, 2007 at 01:18:43PM -0500, Mark Lord wrote:
> Adrian Bunk wrote:
>> On Tue, Nov 13, 2007 at 12:50:08PM -0500, Mark Lord wrote:
>>> Ingo Molnar wrote:
>>>> for example git-bisect was godsent. I remember that years ago bisection
>>>> of a bug was a very laborous task so that it was only used as a final,
>>>> last-ditch approach for really nasty bugs. Today we can autonomouly
>>>> bisect build bugs via a simple shell command around "git-bisect run",
>>>> without any human interaction! This freed up testing resources
>>> ..
>>>
>>> It's only a godsend for the few people who happen to be kernel developers
>>
>> It's also godsend for users who want a regression they observe fixed.
>>
>> If you can tell which patch broke it you often turned a very hard to debug
>> problem into a relatively easy fixable problem.
> ..
>
> Oh yes, definitely. When that use happens to be a kernel dev + git user,
> it saves the *fool who broke it* a hell of a lot of time, because they can
> slough it off onto the poor bloke who notices it.
"fool who broke it" are hard works. Bugs are part of software
development, so you'd have to name everyone who develops software
a fool.
But the main point is that often you don't know who broke it until you
know which commit broke it.
> Mind you, no arguing that this is effective when that poor bloke
> has a day free to download the git-tree and build/reboot a dozen times.
I did bisecting myself, and I know that it costs time and work.
But the first point is the above one that it makes otherwise nearly
undebuggable problems debuggable and fixable.
Another point is that it shifts the work from the few experienced
developers to the many users. Users (and voluntary testers) we have
many, but developer time for debugging bug reports is a quite scarce
resource.
And why "poor bloke"? Bisecting takes time, but that's not different
from e.g. writing code or cleaning up code or going through bug reports.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply
* Re: [BUG] New Kernel Bugs
From: Matthew Wilcox @ 2007-11-13 18:39 UTC (permalink / raw)
To: Mark Lord
Cc: Ingo Molnar, alsa-devel, netdev, linux-pcmcia, linux-kernel,
protasnb, linux-ide, bugme-daemon, linux-input, Andrew Morton,
David Miller
In-Reply-To: <4739E3D0.10201@rtr.ca>
On Tue, Nov 13, 2007 at 12:50:08PM -0500, Mark Lord wrote:
> It's a 540MByte download over a slow link for everyone else.
Where do you get this number from?
$ du -sh .git/objects/pack/
249M .git/objects/pack/
$ du -sh .git/objects/
253M .git/objects/
ie about half what you claim.
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply
* Re: [BUG] New Kernel Bugs
From: Mark Lord @ 2007-11-13 18:43 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Ingo Molnar, alsa-devel, netdev, linux-pcmcia, linux-kernel,
protasnb, linux-ide, bugme-daemon, linux-input, Andrew Morton,
David Miller
In-Reply-To: <20071113183925.GF17785@parisc-linux.org>
Matthew Wilcox wrote:
> On Tue, Nov 13, 2007 at 12:50:08PM -0500, Mark Lord wrote:
>> It's a 540MByte download over a slow link for everyone else.
>
> Where do you get this number from?
> $ du -sh .git/objects/pack/
> 249M .git/objects/pack/
> $ du -sh .git/objects/
> 253M .git/objects/
>
> ie about half what you claim.
..
No, it's from earlier in this very thread:
Adrian Bunk wrote:
> The small instruction below is enough for everyone who is able to
> build his own kernel to do a git bisect.
..
> <-- snip -->
>
>
> # install git
>
> # clone Linus' tree:
> git clone \
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
..
mkdir t
cd t
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
(wait half an hour)
/usr/bin/du -s linux-2.6
522732 linux-2.6
^ permalink raw reply
* Re: [BUG] New Kernel Bugs
From: Mark Lord @ 2007-11-13 18:47 UTC (permalink / raw)
To: Adrian Bunk
Cc: Ingo Molnar, Andrew Morton, David Miller, protasnb, linux-kernel,
netdev, alsa-devel, linux-ide, linux-pcmcia, linux-input,
bugme-daemon
In-Reply-To: <20071113183605.GG4250@stusta.de>
Adrian Bunk wrote:
...
> I did bisecting myself, and I know that it costs time and work.
>
> But the first point is the above one that it makes otherwise nearly
> undebuggable problems debuggable and fixable.
..
Definitely useful, no question.
But the problem is now that kernel devs are addicted to it,
many won't even consider resolving a problem any other way.
That's not "maintaining" (or supporting) one's code.
And when a "maintainer" is too busy to find/fix their own bugs,
that could be a sign that they've bitten off too big of a chunk
of the kernel, and it's time for them to distribute code maintainership.
Cheers
^ permalink raw reply
* Re: [BUG] New Kernel Bugs
From: Matthew Wilcox @ 2007-11-13 18:49 UTC (permalink / raw)
To: Mark Lord
Cc: Ingo Molnar, alsa-devel, netdev, linux-pcmcia, linux-kernel,
protasnb, linux-ide, bugme-daemon, linux-input, Andrew Morton,
David Miller
In-Reply-To: <4739F069.6050102@rtr.ca>
On Tue, Nov 13, 2007 at 01:43:53PM -0500, Mark Lord wrote:
> Matthew Wilcox wrote:
> >ie about half what you claim.
> ..
>
> No, it's from earlier in this very thread:
>
> Adrian Bunk wrote:
> >git clone \
> >git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> ..
>
> mkdir t
> cd t
> git clone
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> (wait half an hour)
> /usr/bin/du -s linux-2.6
> 522732 linux-2.6
You're assuming that everything in linux-2.6 was downloaded; that's
not true. Everything in linux-2.6/.git was downloaded; but then you do a
checkout which happens to approximately double the size of the linux-2.6
directory. If you do git-clone -n, you'll get a closer estimate to the
size of the download.
I suppose git-clone should grow a -v option that it could pass to rsync
to let us find out how many bytes are actually transferred, but i'm
happy to go with 250MB as a close estimate to the amount of data to xfer.
When you compare it to the 60MB tarballs that are published, it's really
not that bad.
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply
* Re: [BUG] New Kernel Bugs
From: Mark Lord @ 2007-11-13 18:54 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Ingo Molnar, alsa-devel, netdev, linux-pcmcia, linux-kernel,
protasnb, linux-ide, bugme-daemon, linux-input, Andrew Morton,
David Miller
In-Reply-To: <20071113184902.GG17785@parisc-linux.org>
Matthew Wilcox wrote:
> On Tue, Nov 13, 2007 at 01:43:53PM -0500, Mark Lord wrote:
>
>> mkdir t
>> cd t
>> git clone
>> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
>> (wait half an hour)
>> /usr/bin/du -s linux-2.6
>> 522732 linux-2.6
>
> You're assuming that everything in linux-2.6 was downloaded; that's
> not true. Everything in linux-2.6/.git was downloaded; but then you do a
> checkout which happens to approximately double the size of the linux-2.6
> directory.
..
Ah, I wondered why it took only half an hour to download.
..
> When you compare it to the 60MB tarballs that are published, it's really
> not that bad.
..
The tarballs I download are only 45MB.
Cheers
^ permalink raw reply
* Re: [BUG] New Kernel Bugs
From: Theodore Tso @ 2007-11-13 18:55 UTC (permalink / raw)
To: Larry Finger
Cc: Benoit Boissinot, Mark Lord, Ingo Molnar, Andrew Morton,
David Miller, protasnb, linux-kernel, netdev, alsa-devel,
linux-ide, linux-pcmcia, linux-input, bugme-daemon
In-Reply-To: <4739DFF8.3090702@lwfinger.net>
On Tue, Nov 13, 2007 at 11:33:44AM -0600, Larry Finger wrote:
> I'm very encouraged to read of your expanded testing efforts. As a
> bcm43xx developer, Ubuntu has been our problem distro, mostly
> because your standard kernels have debugging turned off for bcm43xx.
> When a Ubuntu user reports a problem and we ask for the relevant
> output from dmesg, they have no information. I ask two things of all
> distros: (1) Turn on debugging - we don't spam the logs that badly,
> and (2) forward any bugs found by your testing to the maintainer,
> and/or the bcm43xx mailing list.
Heh. I hadn't enabled CONFIG_BCM43XX_DEBUG myself, but I just changed
it for my next kernel build. This is a slightly different issue,
which is that sometimes _DEBUG options shouldn't be turned on by
default (because they really trash performance and bloat log size),
and sometimes they are painless to turn on and don't cost much.
If that is the case, I'd suggest removing the option and just making
it compiled in by default with a run-time option to enable it.
- Ted
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox