* [PATCH 0/8] Support rpcbind v4 in kernel's RPC server
@ 2008-08-13 22:39 Chuck Lever
[not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
0 siblings, 1 reply; 22+ messages in thread
From: Chuck Lever @ 2008-08-13 22:39 UTC (permalink / raw)
To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs
Hi Bruce, Trond-
First set of patches for 2.6.28. I hope I've addressed all review comments
on these.
And btw, I posted the V6ONLY patch on netdev; received no objections.
---
Chuck Lever (8):
SUNRPC: Add kernel build option to disable server-side use of rpcbind v3/v4
SUNRPC: Use new rpcb_v4_register() interface in svc_register()
SUNRPC: Refactor svc_register()
SUNRPC: Split portmap unregister API into separate function
SUNRPC: Use proper INADDR_ANY when setting up RPC services on IPv6
SUNRPC: Set V6ONLY socket option for RPC listener sockets
SUNRPC: Add address family field to svc_serv data structure
NFS: nfs_parsed_mount_options can use unsigned int
fs/Kconfig | 22 +++++
fs/lockd/svc.c | 2
fs/nfs/callback.c | 3 -
fs/nfs/internal.h | 8 +-
fs/nfsd/nfssvc.c | 3 -
include/linux/sunrpc/svc.h | 15 ++-
net/sunrpc/svc.c | 197 ++++++++++++++++++++++++++++++++++++++------
net/sunrpc/svc_xprt.c | 37 +++++++-
net/sunrpc/svcsock.c | 13 +++
9 files changed, 252 insertions(+), 48 deletions(-)
--
Chuck Lever
^ permalink raw reply [flat|nested] 22+ messages in thread[parent not found: <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>]
* [PATCH 1/8] NFS: nfs_parsed_mount_options can use unsigned int [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> @ 2008-08-13 22:39 ` Chuck Lever [not found] ` <20080813223937.13068.47032.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-13 22:39 ` [PATCH 2/8] SUNRPC: Add address family field to svc_serv data structure Chuck Lever ` (6 subsequent siblings) 7 siblings, 1 reply; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:39 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs Eliminate mixed sign comparisons in nfs_compare_remount_options(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/nfs/internal.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 24241fc..275a692 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -32,11 +32,11 @@ struct nfs_clone_mount { */ struct nfs_parsed_mount_data { int flags; - int rsize, wsize; - int timeo, retrans; - int acregmin, acregmax, + unsigned int rsize, wsize; + unsigned int timeo, retrans; + unsigned int acregmin, acregmax, acdirmin, acdirmax; - int namlen; + unsigned int namlen; unsigned int bsize; unsigned int auth_flavor_len; rpc_authflavor_t auth_flavors[1]; ^ permalink raw reply related [flat|nested] 22+ messages in thread
[parent not found: <20080813223937.13068.47032.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>]
* Re: [PATCH 1/8] NFS: nfs_parsed_mount_options can use unsigned int [not found] ` <20080813223937.13068.47032.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> @ 2008-09-23 19:42 ` Trond Myklebust 0 siblings, 0 replies; 22+ messages in thread From: Trond Myklebust @ 2008-09-23 19:42 UTC (permalink / raw) To: Chuck Lever; +Cc: bfields, linux-nfs On Wed, 2008-08-13 at 18:39 -0400, Chuck Lever wrote: > Eliminate mixed sign comparisons in nfs_compare_remount_options(). > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> We really don't care about the sign, since we're always going to be comparing for equality in nfs_compare_remount_options(). Cheers Trond > --- > > fs/nfs/internal.h | 8 ++++---- > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h > index 24241fc..275a692 100644 > --- a/fs/nfs/internal.h > +++ b/fs/nfs/internal.h > @@ -32,11 +32,11 @@ struct nfs_clone_mount { > */ > struct nfs_parsed_mount_data { > int flags; > - int rsize, wsize; > - int timeo, retrans; > - int acregmin, acregmax, > + unsigned int rsize, wsize; > + unsigned int timeo, retrans; > + unsigned int acregmin, acregmax, > acdirmin, acdirmax; > - int namlen; > + unsigned int namlen; > unsigned int bsize; > unsigned int auth_flavor_len; > rpc_authflavor_t auth_flavors[1]; > -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@netapp.com www.netapp.com ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 2/8] SUNRPC: Add address family field to svc_serv data structure [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-13 22:39 ` [PATCH 1/8] NFS: nfs_parsed_mount_options can use unsigned int Chuck Lever @ 2008-08-13 22:39 ` Chuck Lever 2008-08-13 22:39 ` [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets Chuck Lever ` (5 subsequent siblings) 7 siblings, 0 replies; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:39 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs Introduce and initialize an address family field in the svc_serv structure. This field will determine what address family to use for the service's listener sockets and which address family is advertised via the local rpcbind daemon. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/lockd/svc.c | 2 +- fs/nfs/callback.c | 3 ++- fs/nfsd/nfssvc.c | 3 ++- include/linux/sunrpc/svc.h | 11 +++++++---- net/sunrpc/svc.c | 12 +++++++----- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c index 5bd9bf0..1553fec 100644 --- a/fs/lockd/svc.c +++ b/fs/lockd/svc.c @@ -266,7 +266,7 @@ lockd_up(int proto) /* Maybe add a 'family' option when IPv6 is supported ?? */ "lockd_up: no pid, %d users??\n", nlmsvc_users); error = -ENOMEM; - serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, NULL); + serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, AF_INET, NULL); if (!serv) { printk(KERN_WARNING "lockd_up: create service failed\n"); goto out; diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index f447f4b..6a09760 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -105,7 +105,8 @@ int nfs_callback_up(void) mutex_lock(&nfs_callback_mutex); if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) goto out; - serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, NULL); + serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, + AF_INET, NULL); ret = -ENOMEM; if (!serv) goto out_err; diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 80292ff..4eed938 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -229,7 +229,8 @@ int nfsd_create_serv(void) atomic_set(&nfsd_busy, 0); nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize, - nfsd_last_thread, nfsd, THIS_MODULE); + AF_INET, nfsd_last_thread, + nfsd, THIS_MODULE); if (nfsd_serv == NULL) err = -ENOMEM; diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index dc69068..a794d4a 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -66,6 +66,7 @@ struct svc_serv { struct list_head sv_tempsocks; /* all temporary sockets */ int sv_tmpcnt; /* count of temporary sockets */ struct timer_list sv_temptimer; /* timer for aging temporary sockets */ + sa_family_t sv_family; /* listener's address family */ char * sv_name; /* service name */ @@ -381,14 +382,16 @@ struct svc_procedure { /* * Function prototypes. */ -struct svc_serv * svc_create(struct svc_program *, unsigned int, - void (*shutdown)(struct svc_serv*)); +struct svc_serv *svc_create(struct svc_program *, unsigned int, + const sa_family_t, + void (*shutdown)(struct svc_serv *)); struct svc_rqst *svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool); void svc_exit_thread(struct svc_rqst *); struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, - void (*shutdown)(struct svc_serv*), svc_thread_fn, - struct module *); + const sa_family_t, + void (*shutdown)(struct svc_serv *), + svc_thread_fn, struct module *); int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); void svc_destroy(struct svc_serv *); int svc_process(struct svc_rqst *); diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 5a32cb7..2a6649f 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -357,7 +357,7 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu) */ static struct svc_serv * __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, - void (*shutdown)(struct svc_serv *serv)) + const sa_family_t family, void (*shutdown)(struct svc_serv *serv)) { struct svc_serv *serv; unsigned int vers; @@ -366,6 +366,7 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL))) return NULL; + serv->sv_family = family; serv->sv_name = prog->pg_name; serv->sv_program = prog; serv->sv_nrthreads = 1; @@ -425,21 +426,22 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, struct svc_serv * svc_create(struct svc_program *prog, unsigned int bufsize, - void (*shutdown)(struct svc_serv *serv)) + const sa_family_t family, void (*shutdown)(struct svc_serv *serv)) { - return __svc_create(prog, bufsize, /*npools*/1, shutdown); + return __svc_create(prog, bufsize, /*npools*/1, family, shutdown); } EXPORT_SYMBOL(svc_create); struct svc_serv * svc_create_pooled(struct svc_program *prog, unsigned int bufsize, - void (*shutdown)(struct svc_serv *serv), + const sa_family_t family, + void (*shutdown)(struct svc_serv *serv), svc_thread_fn func, struct module *mod) { struct svc_serv *serv; unsigned int npools = svc_pool_map_get(); - serv = __svc_create(prog, bufsize, npools, shutdown); + serv = __svc_create(prog, bufsize, npools, family, shutdown); if (serv != NULL) { serv->sv_function = func; ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-13 22:39 ` [PATCH 1/8] NFS: nfs_parsed_mount_options can use unsigned int Chuck Lever 2008-08-13 22:39 ` [PATCH 2/8] SUNRPC: Add address family field to svc_serv data structure Chuck Lever @ 2008-08-13 22:39 ` Chuck Lever [not found] ` <20080813223953.13068.97829.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-13 22:40 ` [PATCH 4/8] SUNRPC: Use proper INADDR_ANY when setting up RPC services on IPv6 Chuck Lever ` (4 subsequent siblings) 7 siblings, 1 reply; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:39 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs My plan is to use an AF_INET listener on systems that support only IPv4, and an AF_INET6 listener on systems that can support IPv6. Incoming IPv4 packets will be posted to an AF_INET6 listener with a mapped IPv4 address. Max Matveev <makc@sgi.com> says: Creating a single listener can be dangerous - if net.ipv6.bindv6only is enabled then it's possible to create another listener in v4 namespace on the same port and steal the traffic from the "unifed" listener. You need to disable V6ONLY explicitly via a sockopt to stop that. Set appropriate socket option on RPC server listener sockets to prevent this. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/svcsock.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 3e65719..f91377c 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -1114,6 +1114,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, struct svc_sock *svsk; struct sock *inet; int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); + int val; dprintk("svc: svc_setup_socket %p\n", sock); if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { @@ -1146,6 +1147,18 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, else svc_tcp_init(svsk, serv); + /* + * We start one listener per sv_serv. We want AF_INET + * requests to be automatically shunted to our AF_INET6 + * listener using a mapped IPv4 address. Make sure + * no-one starts an equivalent IPv4 listener, which + * would steal our incoming connections. + */ + val = 0; + if (serv->sv_family == AF_INET6) + kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, + (char *)&val, sizeof(val)); + dprintk("svc: svc_setup_socket created %p (inet %p)\n", svsk, svsk->sk_sk); ^ permalink raw reply related [flat|nested] 22+ messages in thread
[parent not found: <20080813223953.13068.97829.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>]
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets [not found] ` <20080813223953.13068.97829.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> @ 2008-08-14 20:05 ` J. Bruce Fields 2008-08-14 20:34 ` Chuck Lever 0 siblings, 1 reply; 22+ messages in thread From: J. Bruce Fields @ 2008-08-14 20:05 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, trond.myklebust, linux-nfs On Wed, Aug 13, 2008 at 06:39:54PM -0400, Chuck Lever wrote: > My plan is to use an AF_INET listener on systems that support only IPv4, > and an AF_INET6 listener on systems that can support IPv6. Incoming > IPv4 packets will be posted to an AF_INET6 listener with a mapped IPv4 > address. How will the nfs server choose whether to use AF_INET or AF_INET6? Will we need some new user interface? --b. > > Max Matveev <makc@sgi.com> says: > Creating a single listener can be dangerous - if net.ipv6.bindv6only > is enabled then it's possible to create another listener in v4 > namespace on the same port and steal the traffic from the "unifed" > listener. You need to disable V6ONLY explicitly via a sockopt to stop > that. > > Set appropriate socket option on RPC server listener sockets to prevent > this. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > > net/sunrpc/svcsock.c | 13 +++++++++++++ > 1 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c > index 3e65719..f91377c 100644 > --- a/net/sunrpc/svcsock.c > +++ b/net/sunrpc/svcsock.c > @@ -1114,6 +1114,7 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, > struct svc_sock *svsk; > struct sock *inet; > int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); > + int val; > > dprintk("svc: svc_setup_socket %p\n", sock); > if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { > @@ -1146,6 +1147,18 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv, > else > svc_tcp_init(svsk, serv); > > + /* > + * We start one listener per sv_serv. We want AF_INET > + * requests to be automatically shunted to our AF_INET6 > + * listener using a mapped IPv4 address. Make sure > + * no-one starts an equivalent IPv4 listener, which > + * would steal our incoming connections. > + */ > + val = 0; > + if (serv->sv_family == AF_INET6) > + kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, > + (char *)&val, sizeof(val)); > + > dprintk("svc: svc_setup_socket created %p (inet %p)\n", > svsk, svsk->sk_sk); > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-14 20:05 ` J. Bruce Fields @ 2008-08-14 20:34 ` Chuck Lever 2008-08-14 20:38 ` J. Bruce Fields 0 siblings, 1 reply; 22+ messages in thread From: Chuck Lever @ 2008-08-14 20:34 UTC (permalink / raw) To: J. Bruce Fields; +Cc: trond.myklebust, trond.myklebust, linux-nfs On Aug 14, 2008, at 4:05 PM, J. Bruce Fields wrote: > On Wed, Aug 13, 2008 at 06:39:54PM -0400, Chuck Lever wrote: >> My plan is to use an AF_INET listener on systems that support only >> IPv4, >> and an AF_INET6 listener on systems that can support IPv6. Incoming >> IPv4 packets will be posted to an AF_INET6 listener with a mapped >> IPv4 >> address. > > How will the nfs server choose whether to use AF_INET or AF_INET6? > Will > we need some new user interface? [PATCH 2/8] changes svc_create() to take an additional argument which specifies the listener's address family. This value is stored in svc_serv. >> Max Matveev <makc@sgi.com> says: >> Creating a single listener can be dangerous - if net.ipv6.bindv6only >> is enabled then it's possible to create another listener in v4 >> namespace on the same port and steal the traffic from the "unifed" >> listener. You need to disable V6ONLY explicitly via a sockopt to >> stop >> that. >> >> Set appropriate socket option on RPC server listener sockets to >> prevent >> this. >> >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >> --- >> >> net/sunrpc/svcsock.c | 13 +++++++++++++ >> 1 files changed, 13 insertions(+), 0 deletions(-) >> >> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c >> index 3e65719..f91377c 100644 >> --- a/net/sunrpc/svcsock.c >> +++ b/net/sunrpc/svcsock.c >> @@ -1114,6 +1114,7 @@ static struct svc_sock >> *svc_setup_socket(struct svc_serv *serv, >> struct svc_sock *svsk; >> struct sock *inet; >> int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); >> + int val; >> >> dprintk("svc: svc_setup_socket %p\n", sock); >> if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { >> @@ -1146,6 +1147,18 @@ static struct svc_sock >> *svc_setup_socket(struct svc_serv *serv, >> else >> svc_tcp_init(svsk, serv); >> >> + /* >> + * We start one listener per sv_serv. We want AF_INET >> + * requests to be automatically shunted to our AF_INET6 >> + * listener using a mapped IPv4 address. Make sure >> + * no-one starts an equivalent IPv4 listener, which >> + * would steal our incoming connections. >> + */ >> + val = 0; >> + if (serv->sv_family == AF_INET6) >> + kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, >> + (char *)&val, sizeof(val)); >> + >> dprintk("svc: svc_setup_socket created %p (inet %p)\n", >> svsk, svsk->sk_sk); >> >> -- Chuck Lever chuck[dot]lever[at]oracle[dot]com ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-14 20:34 ` Chuck Lever @ 2008-08-14 20:38 ` J. Bruce Fields 2008-08-14 20:45 ` Chuck Lever 0 siblings, 1 reply; 22+ messages in thread From: J. Bruce Fields @ 2008-08-14 20:38 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, trond.myklebust, linux-nfs On Thu, Aug 14, 2008 at 04:34:14PM -0400, Chuck Lever wrote: > On Aug 14, 2008, at 4:05 PM, J. Bruce Fields wrote: >> On Wed, Aug 13, 2008 at 06:39:54PM -0400, Chuck Lever wrote: >>> My plan is to use an AF_INET listener on systems that support only >>> IPv4, >>> and an AF_INET6 listener on systems that can support IPv6. Incoming >>> IPv4 packets will be posted to an AF_INET6 listener with a mapped >>> IPv4 >>> address. >> >> How will the nfs server choose whether to use AF_INET or AF_INET6? >> Will >> we need some new user interface? > > [PATCH 2/8] changes svc_create() to take an additional argument which > specifies the listener's address family. This value is stored in > svc_serv. Right, but I'm asking about the nfsd server, not the rpc server, and the user interface, not the in-kernel interface: so suppose I'm a server administrator, and want my nfs server to listen for ipv6 connections. Will there be some switch I'll need to flip? --b. > >>> Max Matveev <makc@sgi.com> says: >>> Creating a single listener can be dangerous - if net.ipv6.bindv6only >>> is enabled then it's possible to create another listener in v4 >>> namespace on the same port and steal the traffic from the "unifed" >>> listener. You need to disable V6ONLY explicitly via a sockopt to >>> stop >>> that. >>> >>> Set appropriate socket option on RPC server listener sockets to >>> prevent >>> this. >>> >>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>> --- >>> >>> net/sunrpc/svcsock.c | 13 +++++++++++++ >>> 1 files changed, 13 insertions(+), 0 deletions(-) >>> >>> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c >>> index 3e65719..f91377c 100644 >>> --- a/net/sunrpc/svcsock.c >>> +++ b/net/sunrpc/svcsock.c >>> @@ -1114,6 +1114,7 @@ static struct svc_sock >>> *svc_setup_socket(struct svc_serv *serv, >>> struct svc_sock *svsk; >>> struct sock *inet; >>> int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); >>> + int val; >>> >>> dprintk("svc: svc_setup_socket %p\n", sock); >>> if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { >>> @@ -1146,6 +1147,18 @@ static struct svc_sock >>> *svc_setup_socket(struct svc_serv *serv, >>> else >>> svc_tcp_init(svsk, serv); >>> >>> + /* >>> + * We start one listener per sv_serv. We want AF_INET >>> + * requests to be automatically shunted to our AF_INET6 >>> + * listener using a mapped IPv4 address. Make sure >>> + * no-one starts an equivalent IPv4 listener, which >>> + * would steal our incoming connections. >>> + */ >>> + val = 0; >>> + if (serv->sv_family == AF_INET6) >>> + kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, >>> + (char *)&val, sizeof(val)); >>> + >>> dprintk("svc: svc_setup_socket created %p (inet %p)\n", >>> svsk, svsk->sk_sk); >>> >>> > > -- > Chuck Lever > chuck[dot]lever[at]oracle[dot]com > > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-14 20:38 ` J. Bruce Fields @ 2008-08-14 20:45 ` Chuck Lever 2008-08-20 19:31 ` J. Bruce Fields 0 siblings, 1 reply; 22+ messages in thread From: Chuck Lever @ 2008-08-14 20:45 UTC (permalink / raw) To: J. Bruce Fields; +Cc: trond.myklebust, trond.myklebust, linux-nfs On Aug 14, 2008, at 4:38 PM, J. Bruce Fields wrote: > On Thu, Aug 14, 2008 at 04:34:14PM -0400, Chuck Lever wrote: >> On Aug 14, 2008, at 4:05 PM, J. Bruce Fields wrote: >>> On Wed, Aug 13, 2008 at 06:39:54PM -0400, Chuck Lever wrote: >>>> My plan is to use an AF_INET listener on systems that support only >>>> IPv4, >>>> and an AF_INET6 listener on systems that can support IPv6. Incoming >>>> IPv4 packets will be posted to an AF_INET6 listener with a mapped >>>> IPv4 >>>> address. >>> >>> How will the nfs server choose whether to use AF_INET or AF_INET6? >>> Will >>> we need some new user interface? >> >> [PATCH 2/8] changes svc_create() to take an additional argument which >> specifies the listener's address family. This value is stored in >> svc_serv. > > Right, but I'm asking about the nfsd server, not the rpc server, and > the > user interface, not the in-kernel interface: Ah. That wasn't clear before. > so suppose I'm a server > administrator, and want my nfs server to listen for ipv6 connections. > Will there be some switch I'll need to flip? I don't know how that UI will be designed. So far, I've focused only on the pieces needed for client side IPv6 support. I figured the Bull team had something figured out for the server, and didn't think any more about it. >>>> Max Matveev <makc@sgi.com> says: >>>> Creating a single listener can be dangerous - if >>>> net.ipv6.bindv6only >>>> is enabled then it's possible to create another listener in v4 >>>> namespace on the same port and steal the traffic from the "unifed" >>>> listener. You need to disable V6ONLY explicitly via a sockopt to >>>> stop >>>> that. >>>> >>>> Set appropriate socket option on RPC server listener sockets to >>>> prevent >>>> this. >>>> >>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>>> --- >>>> >>>> net/sunrpc/svcsock.c | 13 +++++++++++++ >>>> 1 files changed, 13 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c >>>> index 3e65719..f91377c 100644 >>>> --- a/net/sunrpc/svcsock.c >>>> +++ b/net/sunrpc/svcsock.c >>>> @@ -1114,6 +1114,7 @@ static struct svc_sock >>>> *svc_setup_socket(struct svc_serv *serv, >>>> struct svc_sock *svsk; >>>> struct sock *inet; >>>> int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); >>>> + int val; >>>> >>>> dprintk("svc: svc_setup_socket %p\n", sock); >>>> if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { >>>> @@ -1146,6 +1147,18 @@ static struct svc_sock >>>> *svc_setup_socket(struct svc_serv *serv, >>>> else >>>> svc_tcp_init(svsk, serv); >>>> >>>> + /* >>>> + * We start one listener per sv_serv. We want AF_INET >>>> + * requests to be automatically shunted to our AF_INET6 >>>> + * listener using a mapped IPv4 address. Make sure >>>> + * no-one starts an equivalent IPv4 listener, which >>>> + * would steal our incoming connections. >>>> + */ >>>> + val = 0; >>>> + if (serv->sv_family == AF_INET6) >>>> + kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, >>>> + (char *)&val, sizeof(val)); >>>> + >>>> dprintk("svc: svc_setup_socket created %p (inet %p)\n", >>>> svsk, svsk->sk_sk); >>>> >>>> >> >> -- >> Chuck Lever >> chuck[dot]lever[at]oracle[dot]com >> >> >> -- Chuck Lever chuck[dot]lever[at]oracle[dot]com ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-14 20:45 ` Chuck Lever @ 2008-08-20 19:31 ` J. Bruce Fields 2008-08-21 12:11 ` Le Rouzic 0 siblings, 1 reply; 22+ messages in thread From: J. Bruce Fields @ 2008-08-20 19:31 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, trond.myklebust, linux-nfs On Thu, Aug 14, 2008 at 04:45:31PM -0400, Chuck Lever wrote: > On Aug 14, 2008, at 4:38 PM, J. Bruce Fields wrote: >> On Thu, Aug 14, 2008 at 04:34:14PM -0400, Chuck Lever wrote: >>> On Aug 14, 2008, at 4:05 PM, J. Bruce Fields wrote: >>>> On Wed, Aug 13, 2008 at 06:39:54PM -0400, Chuck Lever wrote: >>>>> My plan is to use an AF_INET listener on systems that support only >>>>> IPv4, >>>>> and an AF_INET6 listener on systems that can support IPv6. Incoming >>>>> IPv4 packets will be posted to an AF_INET6 listener with a mapped >>>>> IPv4 >>>>> address. >>>> >>>> How will the nfs server choose whether to use AF_INET or AF_INET6? >>>> Will >>>> we need some new user interface? >>> >>> [PATCH 2/8] changes svc_create() to take an additional argument which >>> specifies the listener's address family. This value is stored in >>> svc_serv. >> >> Right, but I'm asking about the nfsd server, not the rpc server, and >> the >> user interface, not the in-kernel interface: > > Ah. That wasn't clear before. > >> so suppose I'm a server >> administrator, and want my nfs server to listen for ipv6 connections. >> Will there be some switch I'll need to flip? > > I don't know how that UI will be designed. So far, I've focused only on > the pieces needed for client side IPv6 support. I figured the Bull team > had something figured out for the server, and didn't think any more about > it. I've forgotten who was working on that; Aurelien Charbon? --b. > >>>>> Max Matveev <makc@sgi.com> says: >>>>> Creating a single listener can be dangerous - if >>>>> net.ipv6.bindv6only >>>>> is enabled then it's possible to create another listener in v4 >>>>> namespace on the same port and steal the traffic from the "unifed" >>>>> listener. You need to disable V6ONLY explicitly via a sockopt to >>>>> stop >>>>> that. >>>>> >>>>> Set appropriate socket option on RPC server listener sockets to >>>>> prevent >>>>> this. >>>>> >>>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>>>> --- >>>>> >>>>> net/sunrpc/svcsock.c | 13 +++++++++++++ >>>>> 1 files changed, 13 insertions(+), 0 deletions(-) >>>>> >>>>> diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c >>>>> index 3e65719..f91377c 100644 >>>>> --- a/net/sunrpc/svcsock.c >>>>> +++ b/net/sunrpc/svcsock.c >>>>> @@ -1114,6 +1114,7 @@ static struct svc_sock >>>>> *svc_setup_socket(struct svc_serv *serv, >>>>> struct svc_sock *svsk; >>>>> struct sock *inet; >>>>> int pmap_register = !(flags & SVC_SOCK_ANONYMOUS); >>>>> + int val; >>>>> >>>>> dprintk("svc: svc_setup_socket %p\n", sock); >>>>> if (!(svsk = kzalloc(sizeof(*svsk), GFP_KERNEL))) { >>>>> @@ -1146,6 +1147,18 @@ static struct svc_sock >>>>> *svc_setup_socket(struct svc_serv *serv, >>>>> else >>>>> svc_tcp_init(svsk, serv); >>>>> >>>>> + /* >>>>> + * We start one listener per sv_serv. We want AF_INET >>>>> + * requests to be automatically shunted to our AF_INET6 >>>>> + * listener using a mapped IPv4 address. Make sure >>>>> + * no-one starts an equivalent IPv4 listener, which >>>>> + * would steal our incoming connections. >>>>> + */ >>>>> + val = 0; >>>>> + if (serv->sv_family == AF_INET6) >>>>> + kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, >>>>> + (char *)&val, sizeof(val)); >>>>> + >>>>> dprintk("svc: svc_setup_socket created %p (inet %p)\n", >>>>> svsk, svsk->sk_sk); >>>>> >>>>> >>> >>> -- >>> Chuck Lever >>> chuck[dot]lever[at]oracle[dot]com >>> >>> >>> > > -- > Chuck Lever > chuck[dot]lever[at]oracle[dot]com > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-20 19:31 ` J. Bruce Fields @ 2008-08-21 12:11 ` Le Rouzic 2008-08-21 14:41 ` J. Bruce Fields 0 siblings, 1 reply; 22+ messages in thread From: Le Rouzic @ 2008-08-21 12:11 UTC (permalink / raw) To: J. Bruce Fields, Chuck Lever Cc: trond.myklebust, trond.myklebust, linux-nfs, Frank S Filz J. Bruce Fields a =E9crit : >On Thu, Aug 14, 2008 at 04:45:31PM -0400, Chuck Lever wrote: > =20 > >>On Aug 14, 2008, at 4:38 PM, J. Bruce Fields wrote: >> =20 >> >>>On Thu, Aug 14, 2008 at 04:34:14PM -0400, Chuck Lever wrote: >>> =20 >>> >>>>On Aug 14, 2008, at 4:05 PM, J. Bruce Fields wrote: >>>> =20 >>>> >>>>>On Wed, Aug 13, 2008 at 06:39:54PM -0400, Chuck Lever wrote: >>>>> =20 >>>>> >>>>>>My plan is to use an AF_INET listener on systems that support onl= y >>>>>>IPv4, >>>>>>and an AF_INET6 listener on systems that can support IPv6. Incomi= ng >>>>>>IPv4 packets will be posted to an AF_INET6 listener with a mapped >>>>>>IPv4 >>>>>>address. >>>>>> =20 >>>>>> >>>>>How will the nfs server choose whether to use AF_INET or AF_INET6? >>>>>Will >>>>>we need some new user interface? >>>>> =20 >>>>> >>>>[PATCH 2/8] changes svc_create() to take an additional argument whi= ch >>>>specifies the listener's address family. This value is stored in >>>>svc_serv. >>>> =20 >>>> >>>Right, but I'm asking about the nfsd server, not the rpc server, and= =20 >>>the >>>user interface, not the in-kernel interface: >>> =20 >>> >>Ah. That wasn't clear before. >> >> =20 >> >>>so suppose I'm a server >>>administrator, and want my nfs server to listen for ipv6 connections= =2E >>>Will there be some switch I'll need to flip? >>> =20 >>> >>I don't know how that UI will be designed. So far, I've focused only= on=20 >>the pieces needed for client side IPv6 support. I figured the Bull t= eam=20 >>had something figured out for the server, and didn't think any more a= bout=20 >>it. >> =20 >> > >I've forgotten who was working on that; Aurelien Charbon? > =20 > Hi, Sorry for not answering before, I am back from vacation. Aurelien is no longer directly working on that even he can answer any=20 questions. It is me now who tess NFSV4 IPV6 with the patches Aurelien delivered=20 to Bruce a few months ago. But since Chuck has delivered several new patches which affect the NFS server side about the way nfsd can listen for ipv6 connections. To have NFSV4 IPV6 working with those changes, what it would be nice=20 to have a complete list on what are the changes. Is there now a complete release for which we can test those latest=20 changes? If not which one will be? Are there any other changes still planned? Best Regards >--b. > > =20 > >>>>>>Max Matveev <makc@sgi.com> says: >>>>>>Creating a single listener can be dangerous - if =20 >>>>>>net.ipv6.bindv6only >>>>>>is enabled then it's possible to create another listener in v4 >>>>>>namespace on the same port and steal the traffic from the "unifed= " >>>>>>listener. You need to disable V6ONLY explicitly via a sockopt to >>>>>>stop >>>>>>that. >>>>>> >>>>>>Set appropriate socket option on RPC server listener sockets to >>>>>>prevent >>>>>>this. >>>>>> >>>>>>Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>>>>>--- >>>>>> >>>>>>net/sunrpc/svcsock.c | 13 +++++++++++++ >>>>>>1 files changed, 13 insertions(+), 0 deletions(-) >>>>>> >>>>>>diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c >>>>>>index 3e65719..f91377c 100644 >>>>>>--- a/net/sunrpc/svcsock.c >>>>>>+++ b/net/sunrpc/svcsock.c >>>>>>@@ -1114,6 +1114,7 @@ static struct svc_sock >>>>>>*svc_setup_socket(struct svc_serv *serv, >>>>>> struct svc_sock *svsk; >>>>>> struct sock *inet; >>>>>> int pmap_register =3D !(flags & SVC_SOCK_ANONYMOUS); >>>>>>+ int val; >>>>>> >>>>>> dprintk("svc: svc_setup_socket %p\n", sock); >>>>>> if (!(svsk =3D kzalloc(sizeof(*svsk), GFP_KERNEL))) { >>>>>>@@ -1146,6 +1147,18 @@ static struct svc_sock >>>>>>*svc_setup_socket(struct svc_serv *serv, >>>>>> else >>>>>> svc_tcp_init(svsk, serv); >>>>>> >>>>>>+ /* >>>>>>+ * We start one listener per sv_serv. We want AF_INET >>>>>>+ * requests to be automatically shunted to our AF_INET6 >>>>>>+ * listener using a mapped IPv4 address. Make sure >>>>>>+ * no-one starts an equivalent IPv4 listener, which >>>>>>+ * would steal our incoming connections. >>>>>>+ */ >>>>>>+ val =3D 0; >>>>>>+ if (serv->sv_family =3D=3D AF_INET6) >>>>>>+ kernel_setsockopt(sock, SOL_IPV6, IPV6_V6ONLY, >>>>>>+ (char *)&val, sizeof(val)); >>>>>>+ >>>>>> dprintk("svc: svc_setup_socket created %p (inet %p)\n", >>>>>> svsk, svsk->sk_sk); >>>>>> >>>>>> >>>>>> =20 >>>>>> >>>>-- >>>>Chuck Lever >>>>chuck[dot]lever[at]oracle[dot]com >>>> >>>> >>>> >>>> =20 >>>> >>-- >>Chuck Lever >>chuck[dot]lever[at]oracle[dot]com >> >> >> >>-- >>To unsubscribe from this list: send the line "unsubscribe linux-nfs" = in >>the body of a message to majordomo@vger.kernel.org >>More majordomo info at http://vger.kernel.org/majordomo-info.html >> =20 >> >-- >To unsubscribe from this list: send the line "unsubscribe linux-nfs" i= n >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html > > > =20 > --=20 ----------------------------------------------------------------- Company : Bull, Architect of an Open World TM (www.bull.com) Name : Aime Le Rouzic=20 Mail : Bull - BP 208 - 38432 Echirolles Cedex - France E-Mail : aime.le-rouzic@bull.net Phone : 33 (4) 76.29.75.51 =46ax : 33 (4) 76.29.75.18 -----------------------------------------------------------------=20 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-21 12:11 ` Le Rouzic @ 2008-08-21 14:41 ` J. Bruce Fields 2008-08-21 15:32 ` Le Rouzic 0 siblings, 1 reply; 22+ messages in thread From: J. Bruce Fields @ 2008-08-21 14:41 UTC (permalink / raw) To: Le Rouzic Cc: Chuck Lever, trond.myklebust, trond.myklebust, linux-nfs, Frank S Filz > J. Bruce Fields a =C3=A9crit : >>>> so suppose I'm a server >>>> administrator, and want my nfs server to listen for ipv6 connectio= ns. >>>> Will there be some switch I'll need to flip? >> On Thu, Aug 14, 2008 at 04:45:31PM -0400, Chuck Lever wrote: >>> I don't know how that UI will be designed. So far, I've focused on= ly=20 >>> on the pieces needed for client side IPv6 support. I figured the=20 >>> Bull team had something figured out for the server, and didn't thin= k=20 >>> any more about it. >> >> I've forgotten who was working on that; Aurelien Charbon? On Thu, Aug 21, 2008 at 02:11:49PM +0200, Le Rouzic wrote: > Sorry for not answering before, I am back from vacation. Aurelien is > no longer directly working on that even he can answer any questions. > It is me now who tess NFSV4 IPV6 with the patches Aurelien delivered > to Bruce a few months ago. But since Chuck has delivered several new > patches which affect the NFS server side about the way nfsd can liste= n > for ipv6 connections. I merged the last patch I can remember from Aurelien (f15364bd "IPv6 support for NFS server export caches"). Are there some others floating around that I should look at? > To have NFSV4 IPV6 working with those changes, what it would be nice > to have a complete list on what are the changes. Is there now a > complete release for which we can test those latest changes? If not > which one will be? Are there any other changes still planned? I was hoping you or Chuck would know; I don't know of anyone else working on nfs over ipv6. --b. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-21 14:41 ` J. Bruce Fields @ 2008-08-21 15:32 ` Le Rouzic 2008-08-21 16:20 ` Chuck Lever 0 siblings, 1 reply; 22+ messages in thread From: Le Rouzic @ 2008-08-21 15:32 UTC (permalink / raw) To: J. Bruce Fields Cc: Chuck Lever, trond.myklebust, trond.myklebust, linux-nfs, Frank S Filz J. Bruce Fields a =C3=A9crit : >>J. Bruce Fields a =C3=A9crit : >> =20 >> >>>>>so suppose I'm a server >>>>>administrator, and want my nfs server to listen for ipv6 connectio= ns. >>>>>Will there be some switch I'll need to flip? >>>>> =20 >>>>> > > =20 > >>>On Thu, Aug 14, 2008 at 04:45:31PM -0400, Chuck Lever wrote: >>> =20 >>> >>>>I don't know how that UI will be designed. So far, I've focused on= ly=20 >>>>on the pieces needed for client side IPv6 support. I figured the=20 >>>>Bull team had something figured out for the server, and didn't thin= k=20 >>>>any more about it. >>>> =20 >>>> >>>I've forgotten who was working on that; Aurelien Charbon? >>> =20 >>> > >On Thu, Aug 21, 2008 at 02:11:49PM +0200, Le Rouzic wrote: > =20 > >>Sorry for not answering before, I am back from vacation. Aurelien is >>no longer directly working on that even he can answer any questions. >>It is me now who tess NFSV4 IPV6 with the patches Aurelien delivered >>to Bruce a few months ago. But since Chuck has delivered several new >>patches which affect the NFS server side about the way nfsd can liste= n >>for ipv6 connections. >> =20 >> > >I merged the last patch I can remember from Aurelien (f15364bd "IPv6 >support for NFS server export caches"). Are there some others floatin= g >around that I should look at? > > =20 > >> To have NFSV4 IPV6 working with those changes, what it would be nice >> to have a complete list on what are the changes. Is there now a >> complete release for which we can test those latest changes? If not >> which one will be? Are there any other changes still planned? >> =20 >> > >I was hoping you or Chuck would know; I don't know of anyone else >working on nfs over ipv6. > =20 > Hi, About changes I was talking about changes introduced for IPv6 RPC=20 services via rpcbind at least thoses published on the 19th on this mailing list can be=20 considered like the last ones. Cheers >--b. >-- >To unsubscribe from this list: send the line "unsubscribe linux-nfs" i= n >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html > > > =20 > --=20 ----------------------------------------------------------------- Company : Bull, Architect of an Open World TM (www.bull.com) Name : Aime Le Rouzic=20 Mail : Bull - BP 208 - 38432 Echirolles Cedex - France E-Mail : aime.le-rouzic@bull.net Phone : 33 (4) 76.29.75.51 =46ax : 33 (4) 76.29.75.18 -----------------------------------------------------------------=20 ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets 2008-08-21 15:32 ` Le Rouzic @ 2008-08-21 16:20 ` Chuck Lever [not found] ` <76bd70e30808210920y3db1b07cyccbe40e1b4582c12-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 22+ messages in thread From: Chuck Lever @ 2008-08-21 16:20 UTC (permalink / raw) To: aime.le-rouzic Cc: J. Bruce Fields, trond.myklebust, trond.myklebust, linux-nfs, Frank S Filz On Thu, Aug 21, 2008 at 11:32 AM, Le Rouzic <aime.le-rouzic@bull.net> w= rote: > J. Bruce Fields a =E9crit : > >>> J. Bruce Fields a =E9crit : >>> >>>>>> >>>>>> so suppose I'm a server >>>>>> administrator, and want my nfs server to listen for ipv6 connect= ions. >>>>>> Will there be some switch I'll need to flip? >>>>>> >> >> >>>> >>>> On Thu, Aug 14, 2008 at 04:45:31PM -0400, Chuck Lever wrote: >>>> >>>>> >>>>> I don't know how that UI will be designed. So far, I've focused = only >>>>> on the pieces needed for client side IPv6 support. I figured the= Bull team >>>>> had something figured out for the server, and didn't think any mo= re about >>>>> it. >>>>> >>>> >>>> I've forgotten who was working on that; Aurelien Charbon? >>>> >> >> On Thu, Aug 21, 2008 at 02:11:49PM +0200, Le Rouzic wrote: >> >>> >>> Sorry for not answering before, I am back from vacation. Aurelien = is >>> no longer directly working on that even he can answer any question= s. >>> It is me now who tess NFSV4 IPV6 with the patches Aurelien delivere= d >>> to Bruce a few months ago. But since Chuck has delivered several n= ew >>> patches which affect the NFS server side about the way nfsd can lis= ten >>> for ipv6 connections. >>> >> >> I merged the last patch I can remember from Aurelien (f15364bd "IPv6 >> support for NFS server export caches"). Are there some others float= ing >> around that I should look at? >> >> >>> >>> To have NFSV4 IPV6 working with those changes, what it would be nic= e >>> to have a complete list on what are the changes. Is there now a >>> complete release for which we can test those latest changes? If no= t >>> which one will be? Are there any other changes still planned? >>> >> >> I was hoping you or Chuck would know; I don't know of anyone else >> working on nfs over ipv6. >> > > Hi, > About changes I was talking about changes introduced for IPv6 RPC ser= vices > via rpcbind > at least thoses published on the 19th on this mailing list can be con= sidered > like the last ones. My complete IPv6 patch set is available here: http://git.linux-nfs.org/?p=3Dcel/cel-2.6.git;a=3Dsummary The tags that start "cel-ipv6-..." contain the IPv6-related patches. I see the latest one is still two weeks old, so I should update it with what I sent to Bruce recently. --=20 Chuck Lever ^ permalink raw reply [flat|nested] 22+ messages in thread
[parent not found: <76bd70e30808210920y3db1b07cyccbe40e1b4582c12-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets [not found] ` <76bd70e30808210920y3db1b07cyccbe40e1b4582c12-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2008-08-21 21:26 ` J. Bruce Fields 0 siblings, 0 replies; 22+ messages in thread From: J. Bruce Fields @ 2008-08-21 21:26 UTC (permalink / raw) To: chucklever Cc: aime.le-rouzic, trond.myklebust, trond.myklebust, linux-nfs, Frank S Filz On Thu, Aug 21, 2008 at 12:20:53PM -0400, Chuck Lever wrote: > My complete IPv6 patch set is available here: > > http://git.linux-nfs.org/?p=cel/cel-2.6.git;a=summary > > The tags that start "cel-ipv6-..." contain the IPv6-related patches. > I see the latest one is still two weeks old, so I should update it > with what I sent to Bruce recently. OK. Well, I can't currently volunteer to write and test the last bits of server-side ipv6 functionality, so somebody else needs to or it won't happen. --b. ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 4/8] SUNRPC: Use proper INADDR_ANY when setting up RPC services on IPv6 [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (2 preceding siblings ...) 2008-08-13 22:39 ` [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets Chuck Lever @ 2008-08-13 22:40 ` Chuck Lever 2008-08-13 22:40 ` [PATCH 5/8] SUNRPC: Split portmap unregister API into separate function Chuck Lever ` (3 subsequent siblings) 7 siblings, 0 replies; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:40 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs Choose the correct family for the ANY address when initializing RPC services. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/svc_xprt.c | 37 ++++++++++++++++++++++++++++++------- 1 files changed, 30 insertions(+), 7 deletions(-) diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index e46c825..96eda5f 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -159,16 +159,41 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt, } EXPORT_SYMBOL_GPL(svc_xprt_init); -int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, - int flags) +static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl, + struct svc_serv *serv, + unsigned short port, int flags) { - struct svc_xprt_class *xcl; struct sockaddr_in sin = { .sin_family = AF_INET, .sin_addr.s_addr = htonl(INADDR_ANY), .sin_port = htons(port), }; - dprintk("svc: creating transport %s[%d]\n", xprt_name, port); + struct sockaddr_in6 sin6 = { + .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_ANY_INIT, + .sin6_port = htons(port), + }; + + switch (serv->sv_family) { + case AF_INET: + return xcl->xcl_ops->xpo_create(serv, + (struct sockaddr *)&sin, + sizeof(sin), flags); + case AF_INET6: + return xcl->xcl_ops->xpo_create(serv, + (struct sockaddr *)&sin6, + sizeof(sin6), flags); + } + + return ERR_PTR(-EAFNOSUPPORT); +} + +int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, + int flags) +{ + struct svc_xprt_class *xcl; + + dprintk("svc: creating transport %s[%u]\n", xprt_name, port); spin_lock(&svc_xprt_class_lock); list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) { struct svc_xprt *newxprt; @@ -180,9 +205,7 @@ int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port, goto err; spin_unlock(&svc_xprt_class_lock); - newxprt = xcl->xcl_ops-> - xpo_create(serv, (struct sockaddr *)&sin, sizeof(sin), - flags); + newxprt = __svc_xpo_create(xcl, serv, port, flags); if (IS_ERR(newxprt)) { module_put(xcl->xcl_owner); return PTR_ERR(newxprt); ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5/8] SUNRPC: Split portmap unregister API into separate function [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (3 preceding siblings ...) 2008-08-13 22:40 ` [PATCH 4/8] SUNRPC: Use proper INADDR_ANY when setting up RPC services on IPv6 Chuck Lever @ 2008-08-13 22:40 ` Chuck Lever 2008-08-13 22:40 ` [PATCH 6/8] SUNRPC: Refactor svc_register() Chuck Lever ` (2 subsequent siblings) 7 siblings, 0 replies; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:40 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs Create a separate server-level interface for unregistering RPC services. The mechanics of, and the API for, registering and unregistering RPC services will diverge further as support for IPv6 is added. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/svc.c | 76 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 63 insertions(+), 13 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 2a6649f..58a8012 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -28,6 +28,8 @@ #define RPCDBG_FACILITY RPCDBG_SVCDSP +static void svc_unregister(const struct svc_serv *serv); + #define svc_serv_is_pooled(serv) ((serv)->sv_function) /* @@ -417,9 +419,8 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, spin_lock_init(&pool->sp_lock); } - /* Remove any stale portmap registrations */ - svc_register(serv, 0, 0); + svc_unregister(serv); return serv; } @@ -488,8 +489,7 @@ svc_destroy(struct svc_serv *serv) if (svc_serv_is_pooled(serv)) svc_pool_map_put(); - /* Unregister service with the portmapper */ - svc_register(serv, 0, 0); + svc_unregister(serv); kfree(serv->sv_pools); kfree(serv); } @@ -729,12 +729,10 @@ int svc_register(struct svc_serv *serv, int proto, unsigned short port) { struct svc_program *progp; - unsigned long flags; unsigned int i; int error = 0, dummy; - if (!port) - clear_thread_flag(TIF_SIGPENDING); + BUG_ON(proto == 0 && port == 0); for (progp = serv->sv_program; progp; progp = progp->pg_next) { for (i = 0; i < progp->pg_nvers; i++) { @@ -755,20 +753,72 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port) error = rpcb_register(progp->pg_prog, i, proto, port, &dummy); if (error < 0) break; - if (port && !dummy) { + if (!dummy) { error = -EACCES; break; } } } - if (!port) { - spin_lock_irqsave(¤t->sighand->siglock, flags); - recalc_sigpending(); - spin_unlock_irqrestore(¤t->sighand->siglock, flags); + return error; +} + +/* + * The local rpcbind daemon listens on either only IPv6 or only + * IPv4. The kernel can't tell how it's configured. + * + * However, AF_INET addresses are mapped to AF_INET6 in IPv6-only + * configurations, so even an unregistration request on AF_INET + * will get to a local rpcbind daemon listening only on AF_INET6. + * + * So we always unregister via AF_INET (the loopback address is + * fairly unambiguous anyway). + * + * At this point we don't need rpcbind version 4 for unregistration: + * A v2 UNSET request will clear all transports (netids), addresses, + * and address families for [program, version]. + * + * This should allow automatic support for both an all-IPv4 and + * an all-IPv6 configuration. + */ +static void __svc_unregister(struct svc_program *progp, u32 version) +{ + int error, boolean; + + error = rpcb_register(progp->pg_prog, version, 0, 0, &boolean); + dprintk("svc: svc_unregister(%sv%u), error %d, %s\n", + progp->pg_name, version, error, + (boolean ? "succeeded" : "failed")); +} + +/* + * All transport protocols and ports for this service are removed from + * the local rpcbind database if the service is not hidden. The result + * of unregistration is reported via dprintk for those who want + * verification of the result, but is otherwise not important. + */ +static void svc_unregister(const struct svc_serv *serv) +{ + struct svc_program *progp; + unsigned long flags; + + clear_thread_flag(TIF_SIGPENDING); + + for (progp = serv->sv_program; progp; progp = progp->pg_next) { + unsigned int i; + for (i = 0; i < progp->pg_nvers; i++) { + if (progp->pg_vers[i] == NULL) + continue; + if (progp->pg_vers[i]->vs_hidden) + continue; + + __svc_unregister(progp, i); + } } - return error; + spin_lock_irqsave(¤t->sighand->siglock, flags); + recalc_sigpending(); + spin_unlock_irqrestore(¤t->sighand->siglock, flags); } /* ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 6/8] SUNRPC: Refactor svc_register() [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (4 preceding siblings ...) 2008-08-13 22:40 ` [PATCH 5/8] SUNRPC: Split portmap unregister API into separate function Chuck Lever @ 2008-08-13 22:40 ` Chuck Lever [not found] ` <20080813224016.13068.29786.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-13 22:40 ` [PATCH 7/8] SUNRPC: Use new rpcb_v4_register() interface in svc_register() Chuck Lever 2008-08-13 22:40 ` [PATCH 8/8] SUNRPC: Add kernel build option to disable server-side use of rpcbind v3/v4 Chuck Lever 7 siblings, 1 reply; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:40 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs Clean up: refactor the rpcb_register() call out of svc_register(). The next patch will choose the correct registration subroutine to use based on whether IPv6 support is desired for RPC services. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- include/linux/sunrpc/svc.h | 4 +++- net/sunrpc/svc.c | 40 +++++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index a794d4a..2a41d29 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -395,7 +395,9 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); void svc_destroy(struct svc_serv *); int svc_process(struct svc_rqst *); -int svc_register(struct svc_serv *, int, unsigned short); +int svc_register(const struct svc_serv *, const unsigned short, + const unsigned short); + void svc_wake_up(struct svc_serv *); void svc_reserve(struct svc_rqst *rqstp, int space); struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 58a8012..aa334c2 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -720,17 +720,32 @@ svc_exit_thread(struct svc_rqst *rqstp) } EXPORT_SYMBOL(svc_exit_thread); -/* - * Register an RPC service with the local portmapper. - * To unregister a service, call this routine with - * proto and port == 0. +static int __svc_register(const u32 program, const u32 version, + sa_family_t family, + const unsigned short protocol, + const unsigned short port) +{ + int error, result; + + error = rpcb_register(program, version, protocol, port, &result); + if (!result) + error = -EACCES; + return error; +} + +/** + * svc_register - register an RPC service with the local portmapper + * @serv: svc_serv struct for the service to register + * @proto: transport protocol number to advertise + * @port: port to advertise + * */ -int -svc_register(struct svc_serv *serv, int proto, unsigned short port) +int svc_register(const struct svc_serv *serv, const unsigned short proto, + const unsigned short port) { struct svc_program *progp; unsigned int i; - int error = 0, dummy; + int error = 0; BUG_ON(proto == 0 && port == 0); @@ -739,8 +754,9 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port) if (progp->pg_vers[i] == NULL) continue; - dprintk("svc: svc_register(%s, %s, %d, %d)%s\n", + dprintk("svc: svc_register(%s, %u, %s, %u, %d)%s\n", progp->pg_name, + serv->sv_family, proto == IPPROTO_UDP? "udp" : "tcp", port, i, @@ -750,13 +766,11 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port) if (progp->pg_vers[i]->vs_hidden) continue; - error = rpcb_register(progp->pg_prog, i, proto, port, &dummy); + error = __svc_register(progp->pg_prog, i, + serv->sv_family, proto, + port); if (error < 0) break; - if (!dummy) { - error = -EACCES; - break; - } } } ^ permalink raw reply related [flat|nested] 22+ messages in thread
[parent not found: <20080813224016.13068.29786.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>]
* Re: [PATCH 6/8] SUNRPC: Refactor svc_register() [not found] ` <20080813224016.13068.29786.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> @ 2008-08-14 20:36 ` J. Bruce Fields 2008-08-14 21:11 ` Chuck Lever 0 siblings, 1 reply; 22+ messages in thread From: J. Bruce Fields @ 2008-08-14 20:36 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, trond.myklebust, linux-nfs On Wed, Aug 13, 2008 at 06:40:17PM -0400, Chuck Lever wrote: > Clean up: refactor the rpcb_register() call out of svc_register(). > > The next patch will choose the correct registration subroutine to use > based on whether IPv6 support is desired for RPC services. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > > include/linux/sunrpc/svc.h | 4 +++- > net/sunrpc/svc.c | 40 +++++++++++++++++++++++++++------------- > 2 files changed, 30 insertions(+), 14 deletions(-) > > diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h > index a794d4a..2a41d29 100644 > --- a/include/linux/sunrpc/svc.h > +++ b/include/linux/sunrpc/svc.h > @@ -395,7 +395,9 @@ struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, > int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); > void svc_destroy(struct svc_serv *); > int svc_process(struct svc_rqst *); > -int svc_register(struct svc_serv *, int, unsigned short); > +int svc_register(const struct svc_serv *, const unsigned short, > + const unsigned short); > + > void svc_wake_up(struct svc_serv *); > void svc_reserve(struct svc_rqst *rqstp, int space); > struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); > diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c > index 58a8012..aa334c2 100644 > --- a/net/sunrpc/svc.c > +++ b/net/sunrpc/svc.c > @@ -720,17 +720,32 @@ svc_exit_thread(struct svc_rqst *rqstp) > } > EXPORT_SYMBOL(svc_exit_thread); > > -/* > - * Register an RPC service with the local portmapper. > - * To unregister a service, call this routine with > - * proto and port == 0. > +static int __svc_register(const u32 program, const u32 version, > + sa_family_t family, > + const unsigned short protocol, > + const unsigned short port) > +{ > + int error, result; > + > + error = rpcb_register(program, version, protocol, port, &result); > + if (!result) > + error = -EACCES; > + return error; Isn't "result" 0 whenever error is nonzero? In that case the above is really equivalent to rpcb_register(program, version, protocol, port, &result); return result ? 0 : -EACCES; Is that what's intended? I don't believe it's the behavior of the original code. I understand why they're there, but the separate "result" and "error" returns are kinda confusing. If the distinction's not needed then I wonder whether it should just be buried as deep in rpcb_register() as possible so we don't have to think about it. --b. > +} > + > +/** > + * svc_register - register an RPC service with the local portmapper > + * @serv: svc_serv struct for the service to register > + * @proto: transport protocol number to advertise > + * @port: port to advertise > + * > */ > -int > -svc_register(struct svc_serv *serv, int proto, unsigned short port) > +int svc_register(const struct svc_serv *serv, const unsigned short proto, > + const unsigned short port) > { > struct svc_program *progp; > unsigned int i; > - int error = 0, dummy; > + int error = 0; > > BUG_ON(proto == 0 && port == 0); > > @@ -739,8 +754,9 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port) > if (progp->pg_vers[i] == NULL) > continue; > > - dprintk("svc: svc_register(%s, %s, %d, %d)%s\n", > + dprintk("svc: svc_register(%s, %u, %s, %u, %d)%s\n", > progp->pg_name, > + serv->sv_family, > proto == IPPROTO_UDP? "udp" : "tcp", > port, > i, > @@ -750,13 +766,11 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port) > if (progp->pg_vers[i]->vs_hidden) > continue; > > - error = rpcb_register(progp->pg_prog, i, proto, port, &dummy); > + error = __svc_register(progp->pg_prog, i, > + serv->sv_family, proto, > + port); > if (error < 0) > break; > - if (!dummy) { > - error = -EACCES; > - break; > - } > } > } > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 6/8] SUNRPC: Refactor svc_register() 2008-08-14 20:36 ` J. Bruce Fields @ 2008-08-14 21:11 ` Chuck Lever 0 siblings, 0 replies; 22+ messages in thread From: Chuck Lever @ 2008-08-14 21:11 UTC (permalink / raw) To: J. Bruce Fields; +Cc: trond.myklebust, trond.myklebust, linux-nfs On Aug 14, 2008, at 4:36 PM, J. Bruce Fields wrote: > On Wed, Aug 13, 2008 at 06:40:17PM -0400, Chuck Lever wrote: >> Clean up: refactor the rpcb_register() call out of svc_register(). >> >> The next patch will choose the correct registration subroutine to use >> based on whether IPv6 support is desired for RPC services. >> >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >> --- >> >> include/linux/sunrpc/svc.h | 4 +++- >> net/sunrpc/svc.c | 40 ++++++++++++++++++++++++++ >> +------------- >> 2 files changed, 30 insertions(+), 14 deletions(-) >> >> diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h >> index a794d4a..2a41d29 100644 >> --- a/include/linux/sunrpc/svc.h >> +++ b/include/linux/sunrpc/svc.h >> @@ -395,7 +395,9 @@ struct svc_serv * svc_create_pooled(struct >> svc_program *, unsigned int, >> int svc_set_num_threads(struct svc_serv *, struct svc_pool *, >> int); >> void svc_destroy(struct svc_serv *); >> int svc_process(struct svc_rqst *); >> -int svc_register(struct svc_serv *, int, unsigned short); >> +int svc_register(const struct svc_serv *, const unsigned short, >> + const unsigned short); >> + >> void svc_wake_up(struct svc_serv *); >> void svc_reserve(struct svc_rqst *rqstp, int space); >> struct svc_pool * svc_pool_for_cpu(struct svc_serv *serv, int cpu); >> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c >> index 58a8012..aa334c2 100644 >> --- a/net/sunrpc/svc.c >> +++ b/net/sunrpc/svc.c >> @@ -720,17 +720,32 @@ svc_exit_thread(struct svc_rqst *rqstp) >> } >> EXPORT_SYMBOL(svc_exit_thread); >> >> -/* >> - * Register an RPC service with the local portmapper. >> - * To unregister a service, call this routine with >> - * proto and port == 0. >> +static int __svc_register(const u32 program, const u32 version, >> + sa_family_t family, >> + const unsigned short protocol, >> + const unsigned short port) >> +{ >> + int error, result; >> + >> + error = rpcb_register(program, version, protocol, port, &result); >> + if (!result) >> + error = -EACCES; >> + return error; > > Isn't "result" 0 whenever error is nonzero? In that case the above > is really equivalent to > > rpcb_register(program, version, protocol, port, &result); > return result ? 0 : -EACCES; > > Is that what's intended? I don't believe it's the behavior of the > original code. I'll fix it. It's a vestige of a previous implementation of rpcb_v4_register. > I understand why they're there, but the separate "result" and "error" > returns are kinda confusing. If the distinction's not needed then I > wonder whether it should just be buried as deep in rpcb_register() as > possible so we don't have to think about it. pmap_set() is the user space API for this function, and it returns a bool_t -- TRUE if the service was registered, FALSE if it failed in any way. It is probably unnecessary to expose the RPC call and RPC reply status codes separately. To fix this, I will rework the rpcb_register() and rpcb_v4_register() APIs, and the patches in this series that depend on them. >> +} >> + >> +/** >> + * svc_register - register an RPC service with the local portmapper >> + * @serv: svc_serv struct for the service to register >> + * @proto: transport protocol number to advertise >> + * @port: port to advertise >> + * >> */ >> -int >> -svc_register(struct svc_serv *serv, int proto, unsigned short port) >> +int svc_register(const struct svc_serv *serv, const unsigned short >> proto, >> + const unsigned short port) >> { >> struct svc_program *progp; >> unsigned int i; >> - int error = 0, dummy; >> + int error = 0; >> >> BUG_ON(proto == 0 && port == 0); >> >> @@ -739,8 +754,9 @@ svc_register(struct svc_serv *serv, int proto, >> unsigned short port) >> if (progp->pg_vers[i] == NULL) >> continue; >> >> - dprintk("svc: svc_register(%s, %s, %d, %d)%s\n", >> + dprintk("svc: svc_register(%s, %u, %s, %u, %d)%s\n", >> progp->pg_name, >> + serv->sv_family, >> proto == IPPROTO_UDP? "udp" : "tcp", >> port, >> i, >> @@ -750,13 +766,11 @@ svc_register(struct svc_serv *serv, int >> proto, unsigned short port) >> if (progp->pg_vers[i]->vs_hidden) >> continue; >> >> - error = rpcb_register(progp->pg_prog, i, proto, port, &dummy); >> + error = __svc_register(progp->pg_prog, i, >> + serv->sv_family, proto, >> + port); >> if (error < 0) >> break; >> - if (!dummy) { >> - error = -EACCES; >> - break; >> - } >> } >> } >> >> -- Chuck Lever chuck[dot]lever[at]oracle[dot]com ^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 7/8] SUNRPC: Use new rpcb_v4_register() interface in svc_register() [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (5 preceding siblings ...) 2008-08-13 22:40 ` [PATCH 6/8] SUNRPC: Refactor svc_register() Chuck Lever @ 2008-08-13 22:40 ` Chuck Lever 2008-08-13 22:40 ` [PATCH 8/8] SUNRPC: Add kernel build option to disable server-side use of rpcbind v3/v4 Chuck Lever 7 siblings, 0 replies; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:40 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs In order to advertise NFS-related services on IPv6 interfaces via rpcbind, the kernel RPC server implementation must use rpcb_v4_register() instead of rpcb_register(). Legacy support (register using portmapper/rpcbindv2) is still available. The new rpcbind version is not used unless enabled via a CONFIG option. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- net/sunrpc/svc.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index aa334c2..e22ef0d 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -720,6 +720,74 @@ svc_exit_thread(struct svc_rqst *rqstp) } EXPORT_SYMBOL(svc_exit_thread); +#ifdef CONFIG_SUNRPC_REGISTER_V4 +/* + * Registering kernel RPC services with rpcbind version 2 will work + * over either IPv4 or IPv6, since the Linux kernel always registers + * services for the "any" address. + * + * However, the local rpcbind daemon listens on either only AF_INET + * or AF_INET6 (never both). When it listens on AF_INET6, an rpcbind + * version 2 registration will result in registering the service at + * IN6ADDR_ANY, even if the RPC service being registered is not + * IPv6-enabled. + * + * Rpcbind version 4 allows us to be a little more specific. Kernel + * RPC services that don't yet support AF_INET6 can register + * themselves as IPv4-only with the local rpcbind daemon, even if the + * daemon is listening only on AF_INET6. + * + * And, registering IPv6-enabled kernel RPC services via AF_INET6 + * verifies that the local user space rpcbind daemon is properly + * configured to support remote AF_INET6 rpcbind requests. + * + * An AF_INET6 registration request will fail if the local rpcbind + * daemon is not set up to listen on AF_INET6. Likewise, we fail + * AF_INET6 registration requests if svc_register() is configured to + * support only rpcbind version 2. + */ +static int __svc_register(const u32 program, const u32 version, + const sa_family_t family, + const unsigned short protocol, + const unsigned short port) +{ + struct sockaddr_in sin = { + .sin_family = AF_INET, + .sin_addr.s_addr = htonl(INADDR_ANY), + .sin_port = htons(port), + }; + struct sockaddr_in6 sin6 = { + .sin6_family = AF_INET6, + .sin6_addr = IN6ADDR_ANY_INIT, + .sin6_port = htons(port), + }; + struct sockaddr *sap; + char *netid; + int error, result; + + switch (family) { + case AF_INET: + sap = (struct sockaddr *)&sin; + netid = RPCBIND_NETID_TCP; + if (protocol == IPPROTO_UDP) + netid = RPCBIND_NETID_UDP; + break; + case AF_INET6: + sap = (struct sockaddr *)&sin6; + netid = RPCBIND_NETID_TCP6; + if (protocol == IPPROTO_UDP) + netid = RPCBIND_NETID_UDP6; + break; + default: + return -EAFNOSUPPORT; + } + + error = rpcb_v4_register(program, version, sap, netid, &result); + if (!result) + error = -EACCES; + return error; +} +#else static int __svc_register(const u32 program, const u32 version, sa_family_t family, const unsigned short protocol, @@ -727,11 +795,15 @@ static int __svc_register(const u32 program, const u32 version, { int error, result; + if (family != AF_INET) + return -EAFNOSUPPORT; + error = rpcb_register(program, version, protocol, port, &result); if (!result) error = -EACCES; return error; } +#endif /** * svc_register - register an RPC service with the local portmapper @@ -739,6 +811,7 @@ static int __svc_register(const u32 program, const u32 version, * @proto: transport protocol number to advertise * @port: port to advertise * + * Service is registered for any address in serv's address family */ int svc_register(const struct svc_serv *serv, const unsigned short proto, const unsigned short port) ^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 8/8] SUNRPC: Add kernel build option to disable server-side use of rpcbind v3/v4 [not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (6 preceding siblings ...) 2008-08-13 22:40 ` [PATCH 7/8] SUNRPC: Use new rpcb_v4_register() interface in svc_register() Chuck Lever @ 2008-08-13 22:40 ` Chuck Lever 7 siblings, 0 replies; 22+ messages in thread From: Chuck Lever @ 2008-08-13 22:40 UTC (permalink / raw) To: bfields, trond.myklebust, trond.myklebust; +Cc: linux-nfs Allow distributions to use the legacy behavior until they integrate an appropriate user-space rpcbind daemon that can support IPv6 RPC services. I tried adding some logic to fall back if (un)registering with a v4 protocol request failed, but there are too many corner cases. So I just made it a compile-time switch that distributions can throw when they've replaced portmapper with rpcbind. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/Kconfig | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/fs/Kconfig b/fs/Kconfig index d387358..949e6d1 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -1765,6 +1765,28 @@ config SUNRPC_XPRT_RDMA If unsure, say N. +config SUNRPC_REGISTER_V4 + bool "Register local RPC services via rpcbind v4 (EXPERIMENTAL)" + depends on SUNRPC && EXPERIMENTAL + default n + help + Sun added support for registering RPC services at an IPv6 + address by creating two new versions of the rpcbind protocol + (RFC 1833). + + This option enables support in the kernel RPC server for + registering kernel RPC services via version 4 of the rpcbind + protocol. If you enable this option, you must run a portmapper + daemon that supports rpcbind protocol version 4. + + Serving NFS over IPv6 from knfsd (the kernel's NFS server) + requires that you enable this option and use a portmapper that + supports rpcbind version 4. + + If unsure, say N to get traditional behavior (register kernel + RPC services using only rpcbind version 2). Distributions + using the legacy Linux portmapper daemon must say N here. + config RPCSEC_GSS_KRB5 tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)" depends on SUNRPC && EXPERIMENTAL ^ permalink raw reply related [flat|nested] 22+ messages in thread
end of thread, other threads:[~2008-09-23 19:42 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-13 22:39 [PATCH 0/8] Support rpcbind v4 in kernel's RPC server Chuck Lever
[not found] ` <20080813223653.13068.9467.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-13 22:39 ` [PATCH 1/8] NFS: nfs_parsed_mount_options can use unsigned int Chuck Lever
[not found] ` <20080813223937.13068.47032.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-09-23 19:42 ` Trond Myklebust
2008-08-13 22:39 ` [PATCH 2/8] SUNRPC: Add address family field to svc_serv data structure Chuck Lever
2008-08-13 22:39 ` [PATCH 3/8] SUNRPC: Set V6ONLY socket option for RPC listener sockets Chuck Lever
[not found] ` <20080813223953.13068.97829.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-14 20:05 ` J. Bruce Fields
2008-08-14 20:34 ` Chuck Lever
2008-08-14 20:38 ` J. Bruce Fields
2008-08-14 20:45 ` Chuck Lever
2008-08-20 19:31 ` J. Bruce Fields
2008-08-21 12:11 ` Le Rouzic
2008-08-21 14:41 ` J. Bruce Fields
2008-08-21 15:32 ` Le Rouzic
2008-08-21 16:20 ` Chuck Lever
[not found] ` <76bd70e30808210920y3db1b07cyccbe40e1b4582c12-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-21 21:26 ` J. Bruce Fields
2008-08-13 22:40 ` [PATCH 4/8] SUNRPC: Use proper INADDR_ANY when setting up RPC services on IPv6 Chuck Lever
2008-08-13 22:40 ` [PATCH 5/8] SUNRPC: Split portmap unregister API into separate function Chuck Lever
2008-08-13 22:40 ` [PATCH 6/8] SUNRPC: Refactor svc_register() Chuck Lever
[not found] ` <20080813224016.13068.29786.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-14 20:36 ` J. Bruce Fields
2008-08-14 21:11 ` Chuck Lever
2008-08-13 22:40 ` [PATCH 7/8] SUNRPC: Use new rpcb_v4_register() interface in svc_register() Chuck Lever
2008-08-13 22:40 ` [PATCH 8/8] SUNRPC: Add kernel build option to disable server-side use of rpcbind v3/v4 Chuck Lever
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox