From: Chuck Lever <chuck.lever@oracle.com>
To: bfields@fieldses.org, trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 5/5] lockd: Add address family-agnostic helper for zeroing the port number
Date: Fri, 22 Aug 2008 12:42:33 -0400 [thread overview]
Message-ID: <20080822164232.20488.11685.stgit@manray.1015granger.net> (raw)
In-Reply-To: <20080822163939.20488.92983.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
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 55ef751..3f0c1a8 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -39,6 +39,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)
{
@@ -149,7 +161,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;
next prev parent reply other threads:[~2008-08-22 16:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-22 16:41 [PATCH 0/5] IPv6-related clean-ups Chuck Lever
[not found] ` <20080822163939.20488.92983.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-22 16:42 ` [PATCH 1/5] NFS: Enable NFSv4 callback server to listen on AF_INET6 sockets Chuck Lever
[not found] ` <20080822164201.20488.61180.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-22 23:18 ` J. Bruce Fields
2008-08-23 2:34 ` Chuck Lever
[not found] ` <76bd70e30808221934o22de4d51vca758957f565f256-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-08-25 16:16 ` Chuck Lever
2008-08-25 22:48 ` J. Bruce Fields
2008-08-22 16:42 ` [PATCH 2/5] NLM: Clean up before introducing new debugging messages Chuck Lever
2008-08-22 16:42 ` [PATCH 3/5] lockd: address-family independent printable addresses Chuck Lever
2008-08-22 16:42 ` [PATCH 4/5] lockd: Specify address family for source address Chuck Lever
2008-08-22 16:42 ` Chuck Lever [this message]
[not found] ` <20080822164232.20488.11685.stgit-meopP2rzCrTwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-08-26 19:03 ` [PATCH 5/5] lockd: Add address family-agnostic helper for zeroing the port number J. Bruce Fields
2008-08-26 19:17 ` J. Bruce Fields
2008-08-26 19:56 ` Chuck Lever
2008-08-27 13:55 ` J. Bruce Fields
2008-08-27 18:37 ` Chuck Lever
2008-08-26 19:49 ` Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080822164232.20488.11685.stgit@manray.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@netapp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox