aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd
diff options
context:
space:
mode:
Diffstat (limited to 'fs/lockd')
-rw-r--r--fs/lockd/host.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 22423abea281..008e4026f540 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,
40 const char *hostname, 40 const char *hostname,
41 unsigned int hostname_len); 41 unsigned int hostname_len);
42 42
43static void nlm_clear_port(struct sockaddr *sap)
44{
45 switch (sap->sa_family) {
46 case AF_INET:
47 ((struct sockaddr_in *)sap)->sin_port = 0;
48 break;
49 case AF_INET6:
50 ((struct sockaddr_in6 *)sap)->sin6_port = 0;
51 break;
52 }
53}
54
43static void nlm_display_address(const struct sockaddr *sap, 55static void nlm_display_address(const struct sockaddr *sap,
44 char *buf, const size_t len) 56 char *buf, const size_t len)
45{ 57{
@@ -154,7 +166,7 @@ static struct nlm_host *nlm_lookup_host(int server,
154 } 166 }
155 host->h_name = nsm->sm_name; 167 host->h_name = nsm->sm_name;
156 host->h_addr = *sin; 168 host->h_addr = *sin;
157 host->h_addr.sin_port = 0; /* ouch! */ 169 nlm_clear_port((struct sockaddr *)&host->h_addr);
158 host->h_saddr = *ssin; 170 host->h_saddr = *ssin;
159 host->h_version = version; 171 host->h_version = version;
160 host->h_proto = proto; 172 host->h_proto = proto;