* [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost)
@ 2008-08-27 20:56 Chuck Lever
[not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
0 siblings, 1 reply; 13+ messages in thread
From: Chuck Lever @ 2008-08-27 20:56 UTC (permalink / raw)
To: bfields, trond.myklebust; +Cc: linux-nfs
Based on review comments, I've changed how the NFSv4 callback server
starts its listener. If the kernel has IPv6 support, it will start an
AF_INET6 listener; otherwise it will start an AF_INET listener.
Subsequent lockd IPv6 patches already work this way, it turns out, so
I've updated the patch in this subseries that adds a helper to display
NLM IPv6 addresses. If an IPv6 address is a mapped IPv4 address, it
will be displayed as a dotted-quad instead of as an IPv6 address. This
should cause the helper to display IPv4-style addresses on systems that
use only IPv4, even though the listener is AF_INET6. This effects
only error and debugging messages.
I should revisit other areas (already integrated, and in pending
patches) which display presentation format addresses, to ensure they
follow suit.
---
Chuck Lever (6):
SUNRPC: Make svc_addr's argument a constant
lockd: Add address family-agnostic helper for zeroing the port number
lockd: Specify address family for source address
lockd: address-family independent printable addresses
NLM: Clean up before introducing new debugging messages
NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets
fs/lockd/host.c | 123 +++++++++++++++++++++++++++++++++----------
fs/nfs/callback.c | 19 +++++--
include/linux/lockd/lockd.h | 4 +
include/linux/sunrpc/svc.h | 6 +-
4 files changed, 115 insertions(+), 37 deletions(-)
--
Chuck Lever
^ permalink raw reply [flat|nested] 13+ messages in thread[parent not found: <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>]
* [PATCH 1/6] NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets [not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> @ 2008-08-27 20:57 ` Chuck Lever [not found] ` <20080827205706.17837.28843.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-27 20:57 ` [PATCH 2/6] NLM: Clean up before introducing new debugging messages Chuck Lever ` (5 subsequent siblings) 6 siblings, 1 reply; 13+ messages in thread From: Chuck Lever @ 2008-08-27 20:57 UTC (permalink / raw) To: bfields, trond.myklebust; +Cc: linux-nfs Allow the NFS callback server to listen for requests via an AF_INET6 or AF_INET socket when IPv6 support is present in the kernel. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/nfs/callback.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 6a09760..c2e9cfd 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c @@ -40,6 +40,16 @@ unsigned short nfs_callback_tcpport; static const int nfs_set_port_min = 0; static const int nfs_set_port_max = 65535; +/* + * If the kernel has IPv6 support available, always listen for + * both AF_INET and AF_INET6 requests. + */ +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) +static const sa_family_t nfs_callback_family = AF_INET6; +#else +static const sa_family_t nfs_callback_family = AF_INET; +#endif + static int param_set_port(const char *val, struct kernel_param *kp) { char *endp; @@ -106,7 +116,7 @@ int nfs_callback_up(void) if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) goto out; serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, - AF_INET, NULL); + nfs_callback_family, NULL); ret = -ENOMEM; if (!serv) goto out_err; @@ -116,7 +126,8 @@ int nfs_callback_up(void) if (ret <= 0) goto out_err; nfs_callback_tcpport = ret; - dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); + dprintk("NFS: Callback listener port = %u (af %u)\n", + nfs_callback_tcpport, nfs_callback_family); nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]); if (IS_ERR(nfs_callback_info.rqst)) { @@ -149,8 +160,8 @@ out: mutex_unlock(&nfs_callback_mutex); return ret; out_err: - dprintk("Couldn't create callback socket or server thread; err = %d\n", - ret); + dprintk("NFS: Couldn't create callback socket or server thread; " + "err = %d\n", ret); nfs_callback_info.users--; goto out; } ^ permalink raw reply related [flat|nested] 13+ messages in thread
[parent not found: <20080827205706.17837.28843.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>]
* Re: [PATCH 1/6] NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets [not found] ` <20080827205706.17837.28843.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> @ 2008-09-11 21:41 ` J. Bruce Fields 0 siblings, 0 replies; 13+ messages in thread From: J. Bruce Fields @ 2008-09-11 21:41 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, linux-nfs On Wed, Aug 27, 2008 at 04:57:07PM -0400, Chuck Lever wrote: > Allow the NFS callback server to listen for requests via an AF_INET6 or > AF_INET socket when IPv6 support is present in the kernel. My only nitpick is that the above sentence isn't clear. (I think you want to say something like "... via AF_INET6, if IPv6 is supported, or AF_INET otherwise".) The patch makes sense to me, though.--b. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > > fs/nfs/callback.c | 19 +++++++++++++++---- > 1 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c > index 6a09760..c2e9cfd 100644 > --- a/fs/nfs/callback.c > +++ b/fs/nfs/callback.c > @@ -40,6 +40,16 @@ unsigned short nfs_callback_tcpport; > static const int nfs_set_port_min = 0; > static const int nfs_set_port_max = 65535; > > +/* > + * If the kernel has IPv6 support available, always listen for > + * both AF_INET and AF_INET6 requests. > + */ > +#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) > +static const sa_family_t nfs_callback_family = AF_INET6; > +#else > +static const sa_family_t nfs_callback_family = AF_INET; > +#endif > + > static int param_set_port(const char *val, struct kernel_param *kp) > { > char *endp; > @@ -106,7 +116,7 @@ int nfs_callback_up(void) > if (nfs_callback_info.users++ || nfs_callback_info.task != NULL) > goto out; > serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, > - AF_INET, NULL); > + nfs_callback_family, NULL); > ret = -ENOMEM; > if (!serv) > goto out_err; > @@ -116,7 +126,8 @@ int nfs_callback_up(void) > if (ret <= 0) > goto out_err; > nfs_callback_tcpport = ret; > - dprintk("Callback port = 0x%x\n", nfs_callback_tcpport); > + dprintk("NFS: Callback listener port = %u (af %u)\n", > + nfs_callback_tcpport, nfs_callback_family); > > nfs_callback_info.rqst = svc_prepare_thread(serv, &serv->sv_pools[0]); > if (IS_ERR(nfs_callback_info.rqst)) { > @@ -149,8 +160,8 @@ out: > mutex_unlock(&nfs_callback_mutex); > return ret; > out_err: > - dprintk("Couldn't create callback socket or server thread; err = %d\n", > - ret); > + dprintk("NFS: Couldn't create callback socket or server thread; " > + "err = %d\n", ret); > nfs_callback_info.users--; > goto out; > } > ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/6] NLM: Clean up before introducing new debugging messages [not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-27 20:57 ` [PATCH 1/6] NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets Chuck Lever @ 2008-08-27 20:57 ` Chuck Lever [not found] ` <20080827205714.17837.95227.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-27 20:57 ` [PATCH 3/6] lockd: address-family independent printable addresses Chuck Lever ` (4 subsequent siblings) 6 siblings, 1 reply; 13+ messages in thread From: Chuck Lever @ 2008-08-27 20:57 UTC (permalink / raw) To: bfields, trond.myklebust; +Cc: linux-nfs We're about to introduce some extra debugging messages in nlm_lookup_host(). Bring the coding style up to date first so we can cleanly introduce the new debugging messages. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/lockd/host.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/fs/lockd/host.c b/fs/lockd/host.c index a17664c..cb26e3d 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -103,16 +103,19 @@ static struct nlm_host *nlm_lookup_host(int server, nlm_get_host(host); goto out; } - if (nsm) - atomic_inc(&nsm->sm_count); - - host = NULL; - /* Sadly, the host isn't in our hash table yet. See if - * we have an NSM handle for it. If not, create one. + /* + * The host wasn't in our hash table. If we don't + * have an NSM handle for it yet, create one. */ - if (!nsm && !(nsm = nsm_find(sin, hostname, hostname_len))) - goto out; + if (nsm) + atomic_inc(&nsm->sm_count); + else { + host = NULL; + nsm = nsm_find(sin, hostname, hostname_len); + if (!nsm) + goto out; + } host = kzalloc(sizeof(*host), GFP_KERNEL); if (!host) { ^ permalink raw reply related [flat|nested] 13+ messages in thread
[parent not found: <20080827205714.17837.95227.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>]
* Re: [PATCH 2/6] NLM: Clean up before introducing new debugging messages [not found] ` <20080827205714.17837.95227.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> @ 2008-09-11 21:42 ` J. Bruce Fields 2008-09-11 21:45 ` J. Bruce Fields 0 siblings, 1 reply; 13+ messages in thread From: J. Bruce Fields @ 2008-09-11 21:42 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, linux-nfs On Wed, Aug 27, 2008 at 04:57:15PM -0400, Chuck Lever wrote: > We're about to introduce some extra debugging messages in nlm_lookup_host(). > Bring the coding style up to date first so we can cleanly introduce the new > debugging messages. Looks fine to me.--b. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > > fs/lockd/host.c | 19 +++++++++++-------- > 1 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/fs/lockd/host.c b/fs/lockd/host.c > index a17664c..cb26e3d 100644 > --- a/fs/lockd/host.c > +++ b/fs/lockd/host.c > @@ -103,16 +103,19 @@ static struct nlm_host *nlm_lookup_host(int server, > nlm_get_host(host); > goto out; > } > - if (nsm) > - atomic_inc(&nsm->sm_count); > - > - host = NULL; > > - /* Sadly, the host isn't in our hash table yet. See if > - * we have an NSM handle for it. If not, create one. > + /* > + * The host wasn't in our hash table. If we don't > + * have an NSM handle for it yet, create one. > */ > - if (!nsm && !(nsm = nsm_find(sin, hostname, hostname_len))) > - goto out; > + if (nsm) > + atomic_inc(&nsm->sm_count); > + else { > + host = NULL; > + nsm = nsm_find(sin, hostname, hostname_len); > + if (!nsm) > + goto out; > + } > > host = kzalloc(sizeof(*host), GFP_KERNEL); > if (!host) { > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/6] NLM: Clean up before introducing new debugging messages 2008-09-11 21:42 ` J. Bruce Fields @ 2008-09-11 21:45 ` J. Bruce Fields 0 siblings, 0 replies; 13+ messages in thread From: J. Bruce Fields @ 2008-09-11 21:45 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, linux-nfs On Thu, Sep 11, 2008 at 05:42:25PM -0400, bfields wrote: > On Wed, Aug 27, 2008 at 04:57:15PM -0400, Chuck Lever wrote: > > We're about to introduce some extra debugging messages in nlm_lookup_host(). > > Bring the coding style up to date first so we can cleanly introduce the new > > debugging messages. > > Looks fine to me.--b. Whoops, sorry, ignore me, I was starting to run through patches I've already applied....--b. > > > > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > > --- > > > > fs/lockd/host.c | 19 +++++++++++-------- > > 1 files changed, 11 insertions(+), 8 deletions(-) > > > > diff --git a/fs/lockd/host.c b/fs/lockd/host.c > > index a17664c..cb26e3d 100644 > > --- a/fs/lockd/host.c > > +++ b/fs/lockd/host.c > > @@ -103,16 +103,19 @@ static struct nlm_host *nlm_lookup_host(int server, > > nlm_get_host(host); > > goto out; > > } > > - if (nsm) > > - atomic_inc(&nsm->sm_count); > > - > > - host = NULL; > > > > - /* Sadly, the host isn't in our hash table yet. See if > > - * we have an NSM handle for it. If not, create one. > > + /* > > + * The host wasn't in our hash table. If we don't > > + * have an NSM handle for it yet, create one. > > */ > > - if (!nsm && !(nsm = nsm_find(sin, hostname, hostname_len))) > > - goto out; > > + if (nsm) > > + atomic_inc(&nsm->sm_count); > > + else { > > + host = NULL; > > + nsm = nsm_find(sin, hostname, hostname_len); > > + if (!nsm) > > + goto out; > > + } > > > > host = kzalloc(sizeof(*host), GFP_KERNEL); > > if (!host) { > > ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/6] lockd: address-family independent printable addresses [not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> 2008-08-27 20:57 ` [PATCH 1/6] NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets Chuck Lever 2008-08-27 20:57 ` [PATCH 2/6] NLM: Clean up before introducing new debugging messages Chuck Lever @ 2008-08-27 20:57 ` Chuck Lever 2008-08-27 20:57 ` [PATCH 4/6] lockd: Specify address family for source address Chuck Lever ` (3 subsequent siblings) 6 siblings, 0 replies; 13+ messages in thread From: Chuck Lever @ 2008-08-27 20:57 UTC (permalink / raw) To: bfields, trond.myklebust; +Cc: linux-nfs Knowing which source address is used for communicating with remote NLM services can be helpful for debugging configuration problems on hosts with multiple addresses. Keep the dprintk debugging here, but adapt it so it displays AF_INET6 addresses properly. There are also a couple of dprintk clean-ups as well. At some point we will aggregate the helpers that display presentation format addresses into a single set of shared helpers. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/lockd/host.c | 78 ++++++++++++++++++++++++++++++++++--------- include/linux/lockd/lockd.h | 4 ++ 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/fs/lockd/host.c b/fs/lockd/host.c index cb26e3d..e5dcfa5 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -11,12 +11,14 @@ #include <linux/types.h> #include <linux/slab.h> #include <linux/in.h> +#include <linux/in6.h> #include <linux/sunrpc/clnt.h> #include <linux/sunrpc/svc.h> #include <linux/lockd/lockd.h> #include <linux/lockd/sm_inter.h> #include <linux/mutex.h> +#include <net/ipv6.h> #define NLMDBG_FACILITY NLMDBG_HOSTCACHE #define NLM_HOST_NRHASH 32 @@ -38,6 +40,32 @@ static struct nsm_handle * nsm_find(const struct sockaddr_in *sin, const char *hostname, unsigned int hostname_len); +static void nlm_display_address(const struct sockaddr *sap, + char *buf, const size_t len) +{ + const struct sockaddr_in *sin = (struct sockaddr_in *)sap; + const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; + + switch (sap->sa_family) { + case AF_UNSPEC: + snprintf(buf, len, "unspecified"); + break; + case AF_INET: + snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr)); + break; + case AF_INET6: + if (ipv6_addr_v4mapped(&sin6->sin6_addr)) + snprintf(buf, len, NIPQUAD_FMT, + NIPQUAD(sin6->sin6_addr.s6_addr32[3])); + else + snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr)); + break; + default: + snprintf(buf, len, "unsupported address family"); + break; + } +} + /* * Common host lookup routine for server & client */ @@ -54,14 +82,10 @@ static struct nlm_host *nlm_lookup_host(int server, struct nsm_handle *nsm = NULL; int hash; - dprintk("lockd: nlm_lookup_host("NIPQUAD_FMT"->"NIPQUAD_FMT - ", p=%d, v=%u, my role=%s, name=%.*s)\n", - NIPQUAD(ssin->sin_addr.s_addr), - NIPQUAD(sin->sin_addr.s_addr), proto, version, - server? "server" : "client", - hostname_len, - hostname? hostname : "<none>"); - + dprintk("lockd: nlm_lookup_host(proto=%d, vers=%u," + " my role is %s, hostname=%.*s)\n", + proto, version, server ? "server" : "client", + hostname_len, hostname ? hostname : "<none>"); hash = NLM_ADDRHASH(sin->sin_addr.s_addr); @@ -101,6 +125,8 @@ static struct nlm_host *nlm_lookup_host(int server, hlist_add_head(&host->h_hash, chain); nlm_get_host(host); + dprintk("lockd: nlm_lookup_host found host %s (%s)\n", + host->h_name, host->h_addrbuf); goto out; } @@ -113,13 +139,17 @@ static struct nlm_host *nlm_lookup_host(int server, else { host = NULL; nsm = nsm_find(sin, hostname, hostname_len); - if (!nsm) + if (!nsm) { + dprintk("lockd: nlm_lookup_host failed; " + "no nsm handle\n"); goto out; + } } host = kzalloc(sizeof(*host), GFP_KERNEL); if (!host) { nsm_release(nsm); + dprintk("lockd: nlm_lookup_host failed; no memory\n"); goto out; } host->h_name = nsm->sm_name; @@ -146,6 +176,15 @@ static struct nlm_host *nlm_lookup_host(int server, INIT_LIST_HEAD(&host->h_reclaim); nrhosts++; + + nlm_display_address((struct sockaddr *)&host->h_addr, + host->h_addrbuf, sizeof(host->h_addrbuf)); + nlm_display_address((struct sockaddr *)&host->h_saddr, + host->h_saddrbuf, sizeof(host->h_saddrbuf)); + + dprintk("lockd: nlm_lookup_host created host %s\n", + host->h_name); + out: mutex_unlock(&nlm_host_mutex); return host; @@ -210,9 +249,8 @@ nlm_bind_host(struct nlm_host *host) { struct rpc_clnt *clnt; - dprintk("lockd: nlm_bind_host("NIPQUAD_FMT"->"NIPQUAD_FMT")\n", - NIPQUAD(host->h_saddr.sin_addr), - NIPQUAD(host->h_addr.sin_addr)); + dprintk("lockd: nlm_bind_host %s (%s), my addr=%s\n", + host->h_name, host->h_addrbuf, host->h_saddrbuf); /* Lock host handle */ mutex_lock(&host->h_mutex); @@ -224,7 +262,7 @@ nlm_bind_host(struct nlm_host *host) if (time_after_eq(jiffies, host->h_nextrebind)) { rpc_force_rebind(clnt); host->h_nextrebind = jiffies + NLM_HOST_REBIND; - dprintk("lockd: next rebind in %ld jiffies\n", + dprintk("lockd: next rebind in %lu jiffies\n", host->h_nextrebind - jiffies); } } else { @@ -327,12 +365,16 @@ void nlm_host_rebooted(const struct sockaddr_in *sin, struct nsm_handle *nsm; struct nlm_host *host; - dprintk("lockd: nlm_host_rebooted(%s, %u.%u.%u.%u)\n", - hostname, NIPQUAD(sin->sin_addr)); - /* Find the NSM handle for this peer */ - if (!(nsm = __nsm_find(sin, hostname, hostname_len, 0))) + nsm = __nsm_find(sin, hostname, hostname_len, 0); + if (nsm == NULL) { + dprintk("lockd: never saw rebooted peer '%.*s' before\n", + hostname_len, hostname); return; + } + + dprintk("lockd: nlm_host_rebooted(%.*s, %s)\n", + hostname_len, hostname, nsm->sm_addrbuf); /* When reclaiming locks on this peer, make sure that * we set up a new notification */ @@ -516,6 +558,8 @@ retry: nsm->sm_name = (char *) (nsm + 1); memcpy(nsm->sm_name, hostname, hostname_len); nsm->sm_name[hostname_len] = '\0'; + nlm_display_address((struct sockaddr *)&nsm->sm_addr, + nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf)); atomic_set(&nsm->sm_count, 1); goto retry; diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index dbb87ab..0691efb 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h @@ -61,6 +61,9 @@ struct nlm_host { struct list_head h_granted; /* Locks in GRANTED state */ struct list_head h_reclaim; /* Locks in RECLAIM state */ struct nsm_handle * h_nsmhandle; /* NSM status handle */ + + char h_addrbuf[48], /* address eyecatchers */ + h_saddrbuf[48]; }; struct nsm_handle { @@ -70,6 +73,7 @@ struct nsm_handle { struct sockaddr_in sm_addr; unsigned int sm_monitored : 1, sm_sticky : 1; /* don't unmonitor */ + char sm_addrbuf[48]; /* address eyecatcher */ }; /* ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] lockd: Specify address family for source address [not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (2 preceding siblings ...) 2008-08-27 20:57 ` [PATCH 3/6] lockd: address-family independent printable addresses Chuck Lever @ 2008-08-27 20:57 ` Chuck Lever 2008-08-27 20:57 ` [PATCH 5/6] lockd: Add address family-agnostic helper for zeroing the port number Chuck Lever ` (2 subsequent siblings) 6 siblings, 0 replies; 13+ messages in thread From: Chuck Lever @ 2008-08-27 20:57 UTC (permalink / raw) To: bfields, trond.myklebust; +Cc: linux-nfs Make sure an address family is specified for source addresses passed to nlm_lookup_host(). nlm_lookup_host() will need this when it becomes capable of dealing with AF_INET6 addresses. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/lockd/host.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/lockd/host.c b/fs/lockd/host.c index e5dcfa5..22423ab 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -220,10 +220,12 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin, const char *hostname, unsigned int hostname_len) { - struct sockaddr_in ssin = {0}; + const struct sockaddr_in source = { + .sin_family = AF_UNSPEC, + }; return nlm_lookup_host(0, sin, proto, version, - hostname, hostname_len, &ssin); + hostname, hostname_len, &source); } /* @@ -233,12 +235,14 @@ struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *rqstp, const char *hostname, unsigned int hostname_len) { - struct sockaddr_in ssin = {0}; + const struct sockaddr_in source = { + .sin_family = AF_INET, + .sin_addr = rqstp->rq_daddr.addr, + }; - ssin.sin_addr = rqstp->rq_daddr.addr; return nlm_lookup_host(1, svc_addr_in(rqstp), rqstp->rq_prot, rqstp->rq_vers, - hostname, hostname_len, &ssin); + hostname, hostname_len, &source); } /* ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] lockd: Add address family-agnostic helper for zeroing the port number [not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (3 preceding siblings ...) 2008-08-27 20:57 ` [PATCH 4/6] lockd: Specify address family for source address Chuck Lever @ 2008-08-27 20:57 ` Chuck Lever 2008-08-27 20:57 ` [PATCH 6/6] SUNRPC: Make svc_addr's argument a constant Chuck Lever 2008-08-29 17:25 ` [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) J. Bruce Fields 6 siblings, 0 replies; 13+ messages in thread From: Chuck Lever @ 2008-08-27 20:57 UTC (permalink / raw) To: bfields, trond.myklebust; +Cc: linux-nfs Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- fs/lockd/host.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 22423ab..008e402 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -40,6 +40,18 @@ static struct nsm_handle * nsm_find(const struct sockaddr_in *sin, const char *hostname, unsigned int hostname_len); +static void nlm_clear_port(struct sockaddr *sap) +{ + switch (sap->sa_family) { + case AF_INET: + ((struct sockaddr_in *)sap)->sin_port = 0; + break; + case AF_INET6: + ((struct sockaddr_in6 *)sap)->sin6_port = 0; + break; + } +} + static void nlm_display_address(const struct sockaddr *sap, char *buf, const size_t len) { @@ -154,7 +166,7 @@ static struct nlm_host *nlm_lookup_host(int server, } host->h_name = nsm->sm_name; host->h_addr = *sin; - host->h_addr.sin_port = 0; /* ouch! */ + nlm_clear_port((struct sockaddr *)&host->h_addr); host->h_saddr = *ssin; host->h_version = version; host->h_proto = proto; ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] SUNRPC: Make svc_addr's argument a constant [not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (4 preceding siblings ...) 2008-08-27 20:57 ` [PATCH 5/6] lockd: Add address family-agnostic helper for zeroing the port number Chuck Lever @ 2008-08-27 20:57 ` Chuck Lever 2008-08-29 17:25 ` [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) J. Bruce Fields 6 siblings, 0 replies; 13+ messages in thread From: Chuck Lever @ 2008-08-27 20:57 UTC (permalink / raw) To: bfields, trond.myklebust; +Cc: linux-nfs Clean up: Add extra type safety and squelch a few compiler complaints in upcoming patches. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- include/linux/sunrpc/svc.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 2a41d29..564e045 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -266,17 +266,17 @@ struct svc_rqst { /* * Rigorous type checking on sockaddr type conversions */ -static inline struct sockaddr_in *svc_addr_in(struct svc_rqst *rqst) +static inline struct sockaddr_in *svc_addr_in(const struct svc_rqst *rqst) { return (struct sockaddr_in *) &rqst->rq_addr; } -static inline struct sockaddr_in6 *svc_addr_in6(struct svc_rqst *rqst) +static inline struct sockaddr_in6 *svc_addr_in6(const struct svc_rqst *rqst) { return (struct sockaddr_in6 *) &rqst->rq_addr; } -static inline struct sockaddr *svc_addr(struct svc_rqst *rqst) +static inline struct sockaddr *svc_addr(const struct svc_rqst *rqst) { return (struct sockaddr *) &rqst->rq_addr; } ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) [not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org> ` (5 preceding siblings ...) 2008-08-27 20:57 ` [PATCH 6/6] SUNRPC: Make svc_addr's argument a constant Chuck Lever @ 2008-08-29 17:25 ` J. Bruce Fields 2008-08-29 17:25 ` J. Bruce Fields 6 siblings, 1 reply; 13+ messages in thread From: J. Bruce Fields @ 2008-08-29 17:25 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, linux-nfs On Wed, Aug 27, 2008 at 04:56:58PM -0400, Chuck Lever wrote: > Based on review comments, I've changed how the NFSv4 callback server > starts its listener. If the kernel has IPv6 support, it will start an > AF_INET6 listener; otherwise it will start an AF_INET listener. > > Subsequent lockd IPv6 patches already work this way, it turns out, so > I've updated the patch in this subseries that adds a helper to display > NLM IPv6 addresses. If an IPv6 address is a mapped IPv4 address, it > will be displayed as a dotted-quad instead of as an IPv6 address. This > should cause the helper to display IPv4-style addresses on systems that > use only IPv4, even though the listener is AF_INET6. This effects > only error and debugging messages. > > I should revisit other areas (already integrated, and in pending > patches) which display presentation format addresses, to ensure they > follow suit. I already applied 2-6, so I've removed those and replaced them by your new versions. The resulting change is just the following. I'm assuming #1 will be up to Trond. I think I've got nothing else outstanding from you right now? --b. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) 2008-08-29 17:25 ` [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) J. Bruce Fields @ 2008-08-29 17:25 ` J. Bruce Fields 2008-08-29 17:29 ` Chuck Lever 0 siblings, 1 reply; 13+ messages in thread From: J. Bruce Fields @ 2008-08-29 17:25 UTC (permalink / raw) To: Chuck Lever; +Cc: trond.myklebust, linux-nfs On Fri, Aug 29, 2008 at 01:25:06PM -0400, bfields wrote: > On Wed, Aug 27, 2008 at 04:56:58PM -0400, Chuck Lever wrote: > > Based on review comments, I've changed how the NFSv4 callback server > > starts its listener. If the kernel has IPv6 support, it will start an > > AF_INET6 listener; otherwise it will start an AF_INET listener. > > > > Subsequent lockd IPv6 patches already work this way, it turns out, so > > I've updated the patch in this subseries that adds a helper to display > > NLM IPv6 addresses. If an IPv6 address is a mapped IPv4 address, it > > will be displayed as a dotted-quad instead of as an IPv6 address. This > > should cause the helper to display IPv4-style addresses on systems that > > use only IPv4, even though the listener is AF_INET6. This effects > > only error and debugging messages. > > > > I should revisit other areas (already integrated, and in pending > > patches) which display presentation format addresses, to ensure they > > follow suit. > > I already applied 2-6, so I've removed those and replaced them by your > new versions. The resulting change is just the following. Whoops, sorry, I meant: --b. diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 3f0c1a8..008e402 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c @@ -18,6 +18,7 @@ #include <linux/lockd/sm_inter.h> #include <linux/mutex.h> +#include <net/ipv6.h> #define NLMDBG_FACILITY NLMDBG_HOSTCACHE #define NLM_HOST_NRHASH 32 @@ -65,7 +66,11 @@ static void nlm_display_address(const struct sockaddr *sap, snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr)); break; case AF_INET6: - snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr)); + if (ipv6_addr_v4mapped(&sin6->sin6_addr)) + snprintf(buf, len, NIPQUAD_FMT, + NIPQUAD(sin6->sin6_addr.s6_addr32[3])); + else + snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr)); break; default: snprintf(buf, len, "unsupported address family"); ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) 2008-08-29 17:25 ` J. Bruce Fields @ 2008-08-29 17:29 ` Chuck Lever 0 siblings, 0 replies; 13+ messages in thread From: Chuck Lever @ 2008-08-29 17:29 UTC (permalink / raw) To: J. Bruce Fields; +Cc: trond.myklebust, linux-nfs On Fri, Aug 29, 2008 at 1:25 PM, J. Bruce Fields <bfields@fieldses.org> wrote: > On Fri, Aug 29, 2008 at 01:25:06PM -0400, bfields wrote: >> On Wed, Aug 27, 2008 at 04:56:58PM -0400, Chuck Lever wrote: >> > Based on review comments, I've changed how the NFSv4 callback server >> > starts its listener. If the kernel has IPv6 support, it will start an >> > AF_INET6 listener; otherwise it will start an AF_INET listener. >> > >> > Subsequent lockd IPv6 patches already work this way, it turns out, so >> > I've updated the patch in this subseries that adds a helper to display >> > NLM IPv6 addresses. If an IPv6 address is a mapped IPv4 address, it >> > will be displayed as a dotted-quad instead of as an IPv6 address. This >> > should cause the helper to display IPv4-style addresses on systems that >> > use only IPv4, even though the listener is AF_INET6. This effects >> > only error and debugging messages. >> > >> > I should revisit other areas (already integrated, and in pending >> > patches) which display presentation format addresses, to ensure they >> > follow suit. >> >> I already applied 2-6, so I've removed those and replaced them by your >> new versions. The resulting change is just the following. > > Whoops, sorry, I meant: > > --b. > > diff --git a/fs/lockd/host.c b/fs/lockd/host.c > index 3f0c1a8..008e402 100644 > --- a/fs/lockd/host.c > +++ b/fs/lockd/host.c > @@ -18,6 +18,7 @@ > #include <linux/lockd/sm_inter.h> > #include <linux/mutex.h> > > +#include <net/ipv6.h> > > #define NLMDBG_FACILITY NLMDBG_HOSTCACHE > #define NLM_HOST_NRHASH 32 > @@ -65,7 +66,11 @@ static void nlm_display_address(const struct sockaddr *sap, > snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr)); > break; > case AF_INET6: > - snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr)); > + if (ipv6_addr_v4mapped(&sin6->sin6_addr)) > + snprintf(buf, len, NIPQUAD_FMT, > + NIPQUAD(sin6->sin6_addr.s6_addr32[3])); > + else > + snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr)); > break; > default: > snprintf(buf, len, "unsupported address family"); Yes, I think that's the only change in patches 2-6. -- Chuck Lever ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-09-11 21:45 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-27 20:56 [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) Chuck Lever
[not found] ` <20080827204852.17837.38361.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-27 20:57 ` [PATCH 1/6] NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets Chuck Lever
[not found] ` <20080827205706.17837.28843.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-09-11 21:41 ` J. Bruce Fields
2008-08-27 20:57 ` [PATCH 2/6] NLM: Clean up before introducing new debugging messages Chuck Lever
[not found] ` <20080827205714.17837.95227.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-09-11 21:42 ` J. Bruce Fields
2008-09-11 21:45 ` J. Bruce Fields
2008-08-27 20:57 ` [PATCH 3/6] lockd: address-family independent printable addresses Chuck Lever
2008-08-27 20:57 ` [PATCH 4/6] lockd: Specify address family for source address Chuck Lever
2008-08-27 20:57 ` [PATCH 5/6] lockd: Add address family-agnostic helper for zeroing the port number Chuck Lever
2008-08-27 20:57 ` [PATCH 6/6] SUNRPC: Make svc_addr's argument a constant Chuck Lever
2008-08-29 17:25 ` [PATCH 0/6] 2nd IPv6 patchset for 2.6.28 (repost) J. Bruce Fields
2008-08-29 17:25 ` J. Bruce Fields
2008-08-29 17:29 ` Chuck Lever
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox