aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-02-12 03:53:32 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:35 -0500
commitad06e4bd62351bc569cca0f25d68c58dbd298146 (patch)
tree82024c01e61de32af17d3b67eac0bb93138a2954 /fs
parent1ba951053f07187f6e77be664a4b6f8bf0ba7ae4 (diff)
[PATCH] knfsd: SUNRPC: Add a function to format the address in an svc_rqst for printing
There are loads of places where the RPC server assumes that the rq_addr fields contains an IPv4 address. Top among these are error and debugging messages that display the server's IP address. Let's refactor the address printing into a separate function that's smart enough to figure out the difference between IPv4 and IPv6 addresses. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/svc.c6
-rw-r--r--fs/lockd/svc4proc.c7
-rw-r--r--fs/lockd/svcproc.c7
-rw-r--r--fs/nfs/callback.c12
-rw-r--r--fs/nfsd/nfsfh.c7
-rw-r--r--fs/nfsd/nfsproc.c7
6 files changed, 26 insertions, 20 deletions
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 2c3d5ac4a3b6..80fcacc1acf9 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -141,6 +141,7 @@ lockd(struct svc_rqst *rqstp)
141 */ 141 */
142 while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) { 142 while ((nlmsvc_users || !signalled()) && nlmsvc_pid == current->pid) {
143 long timeout = MAX_SCHEDULE_TIMEOUT; 143 long timeout = MAX_SCHEDULE_TIMEOUT;
144 char buf[RPC_MAX_ADDRBUFLEN];
144 145
145 if (signalled()) { 146 if (signalled()) {
146 flush_signals(current); 147 flush_signals(current);
@@ -175,11 +176,10 @@ lockd(struct svc_rqst *rqstp)
175 break; 176 break;
176 } 177 }
177 178
178 dprintk("lockd: request from %08x\n", 179 dprintk("lockd: request from %s\n",
179 (unsigned)ntohl(rqstp->rq_addr.sin_addr.s_addr)); 180 svc_print_addr(rqstp, buf, sizeof(buf)));
180 181
181 svc_process(rqstp); 182 svc_process(rqstp);
182
183 } 183 }
184 184
185 flush_signals(current); 185 flush_signals(current);
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index f67146a8199a..9b591bc18341 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -426,10 +426,9 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
426 dprintk("lockd: SM_NOTIFY called\n"); 426 dprintk("lockd: SM_NOTIFY called\n");
427 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) 427 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
428 || ntohs(saddr.sin_port) >= 1024) { 428 || ntohs(saddr.sin_port) >= 1024) {
429 printk(KERN_WARNING 429 char buf[RPC_MAX_ADDRBUFLEN];
430 "lockd: rejected NSM callback from %08x:%d\n", 430 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
431 ntohl(rqstp->rq_addr.sin_addr.s_addr), 431 svc_print_addr(rqstp, buf, sizeof(buf)));
432 ntohs(rqstp->rq_addr.sin_port));
433 return rpc_system_err; 432 return rpc_system_err;
434 } 433 }
435 434
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index 3707c3a23e93..f590304d93bf 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -457,10 +457,9 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
457 dprintk("lockd: SM_NOTIFY called\n"); 457 dprintk("lockd: SM_NOTIFY called\n");
458 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) 458 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
459 || ntohs(saddr.sin_port) >= 1024) { 459 || ntohs(saddr.sin_port) >= 1024) {
460 printk(KERN_WARNING 460 char buf[RPC_MAX_ADDRBUFLEN];
461 "lockd: rejected NSM callback from %08x:%d\n", 461 printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
462 ntohl(rqstp->rq_addr.sin_addr.s_addr), 462 svc_print_addr(rqstp, buf, sizeof(buf)));
463 ntohs(rqstp->rq_addr.sin_port));
464 return rpc_system_err; 463 return rpc_system_err;
465 } 464 }
466 465
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index a070109fa6c7..8c790af85984 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -71,6 +71,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
71 complete(&nfs_callback_info.started); 71 complete(&nfs_callback_info.started);
72 72
73 for(;;) { 73 for(;;) {
74 char buf[RPC_MAX_ADDRBUFLEN];
75
74 if (signalled()) { 76 if (signalled()) {
75 if (nfs_callback_info.users == 0) 77 if (nfs_callback_info.users == 0)
76 break; 78 break;
@@ -88,8 +90,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
88 __FUNCTION__, -err); 90 __FUNCTION__, -err);
89 break; 91 break;
90 } 92 }
91 dprintk("%s: request from %u.%u.%u.%u\n", __FUNCTION__, 93 dprintk("%s: request from %s\n", __FUNCTION__,
92 NIPQUAD(rqstp->rq_addr.sin_addr.s_addr)); 94 svc_print_addr(rqstp, buf, sizeof(buf)));
93 svc_process(rqstp); 95 svc_process(rqstp);
94 } 96 }
95 97
@@ -166,13 +168,17 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp)
166{ 168{
167 struct sockaddr_in *addr = &rqstp->rq_addr; 169 struct sockaddr_in *addr = &rqstp->rq_addr;
168 struct nfs_client *clp; 170 struct nfs_client *clp;
171 char buf[RPC_MAX_ADDRBUFLEN];
169 172
170 /* Don't talk to strangers */ 173 /* Don't talk to strangers */
171 clp = nfs_find_client(addr, 4); 174 clp = nfs_find_client(addr, 4);
172 if (clp == NULL) 175 if (clp == NULL)
173 return SVC_DROP; 176 return SVC_DROP;
174 dprintk("%s: %u.%u.%u.%u NFSv4 callback!\n", __FUNCTION__, NIPQUAD(addr->sin_addr)); 177
178 dprintk("%s: %s NFSv4 callback!\n", __FUNCTION__,
179 svc_print_addr(rqstp, buf, sizeof(buf)));
175 nfs_put_client(clp); 180 nfs_put_client(clp);
181
176 switch (rqstp->rq_authop->flavour) { 182 switch (rqstp->rq_authop->flavour) {
177 case RPC_AUTH_NULL: 183 case RPC_AUTH_NULL:
178 if (rqstp->rq_proc != CB_NULL) 184 if (rqstp->rq_proc != CB_NULL)
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index c59d6fbb7a6b..a0b4282cb284 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -20,6 +20,7 @@
20#include <linux/mount.h> 20#include <linux/mount.h>
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22 22
23#include <linux/sunrpc/clnt.h>
23#include <linux/sunrpc/svc.h> 24#include <linux/sunrpc/svc.h>
24#include <linux/nfsd/nfsd.h> 25#include <linux/nfsd/nfsd.h>
25 26
@@ -180,10 +181,10 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
180 /* Check if the request originated from a secure port. */ 181 /* Check if the request originated from a secure port. */
181 error = nfserr_perm; 182 error = nfserr_perm;
182 if (!rqstp->rq_secure && EX_SECURE(exp)) { 183 if (!rqstp->rq_secure && EX_SECURE(exp)) {
184 char buf[RPC_MAX_ADDRBUFLEN];
183 printk(KERN_WARNING 185 printk(KERN_WARNING
184 "nfsd: request from insecure port (%u.%u.%u.%u:%d)!\n", 186 "nfsd: request from insecure port %s!\n",
185 NIPQUAD(rqstp->rq_addr.sin_addr.s_addr), 187 svc_print_addr(rqstp, buf, sizeof(buf)));
186 ntohs(rqstp->rq_addr.sin_port));
187 goto out; 188 goto out;
188 } 189 }
189 190
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index ec983b777680..5cc2eec981b8 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -19,6 +19,7 @@
19#include <linux/unistd.h> 19#include <linux/unistd.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21 21
22#include <linux/sunrpc/clnt.h>
22#include <linux/sunrpc/svc.h> 23#include <linux/sunrpc/svc.h>
23#include <linux/nfsd/nfsd.h> 24#include <linux/nfsd/nfsd.h>
24#include <linux/nfsd/cache.h> 25#include <linux/nfsd/cache.h>
@@ -147,10 +148,10 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
147 */ 148 */
148 149
149 if (NFSSVC_MAXBLKSIZE_V2 < argp->count) { 150 if (NFSSVC_MAXBLKSIZE_V2 < argp->count) {
151 char buf[RPC_MAX_ADDRBUFLEN];
150 printk(KERN_NOTICE 152 printk(KERN_NOTICE
151 "oversized read request from %u.%u.%u.%u:%d (%d bytes)\n", 153 "oversized read request from %s (%d bytes)\n",
152 NIPQUAD(rqstp->rq_addr.sin_addr.s_addr), 154 svc_print_addr(rqstp, buf, sizeof(buf)),
153 ntohs(rqstp->rq_addr.sin_port),
154 argp->count); 155 argp->count);
155 argp->count = NFSSVC_MAXBLKSIZE_V2; 156 argp->count = NFSSVC_MAXBLKSIZE_V2;
156 } 157 }