Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68780
b: refs/heads/master
c: 354ecbb
h: refs/heads/master
v: v3
  • Loading branch information
Dr. David Alan Gilbert authored and J. Bruce Fields committed Oct 9, 2007
1 parent a6e672a commit 33bae80
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 40ee5dc6af351c1b3de245abed4bd8e6a4a5646a
refs/heads/master: 354ecbb9dd89c21708b319da8c4ffd3dd6e6811d
40 changes: 30 additions & 10 deletions trunk/net/sunrpc/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,30 @@ svc_register(struct svc_serv *serv, int proto, unsigned short port)
return error;
}

/*
* Printk the given error with the address of the client that caused it.
*/
static int
__attribute__ ((format (printf, 2, 3)))
svc_printk(struct svc_rqst *rqstp, const char *fmt, ...)
{
va_list args;
int r;
char buf[RPC_MAX_ADDRBUFLEN];

if (!net_ratelimit())
return 0;

printk(KERN_WARNING "svc: %s: ",
svc_print_addr(rqstp, buf, sizeof(buf)));

va_start(args, fmt);
r = vprintk(fmt, args);
va_end(args);

return r;
}

/*
* Process the RPC request.
*/
Expand Down Expand Up @@ -963,14 +987,13 @@ svc_process(struct svc_rqst *rqstp)
return 0;

err_short_len:
if (net_ratelimit())
printk("svc: short len %Zd, dropping request\n", argv->iov_len);
svc_printk(rqstp, "short len %Zd, dropping request\n",
argv->iov_len);

goto dropit; /* drop request */

err_bad_dir:
if (net_ratelimit())
printk("svc: bad direction %d, dropping request\n", dir);
svc_printk(rqstp, "bad direction %d, dropping request\n", dir);

serv->sv_stats->rpcbadfmt++;
goto dropit; /* drop request */
Expand Down Expand Up @@ -1000,8 +1023,7 @@ svc_process(struct svc_rqst *rqstp)
goto sendit;

err_bad_vers:
if (net_ratelimit())
printk("svc: unknown version (%d for prog %d, %s)\n",
svc_printk(rqstp, "unknown version (%d for prog %d, %s)\n",
vers, prog, progp->pg_name);

serv->sv_stats->rpcbadfmt++;
Expand All @@ -1011,16 +1033,14 @@ svc_process(struct svc_rqst *rqstp)
goto sendit;

err_bad_proc:
if (net_ratelimit())
printk("svc: unknown procedure (%d)\n", proc);
svc_printk(rqstp, "unknown procedure (%d)\n", proc);

serv->sv_stats->rpcbadfmt++;
svc_putnl(resv, RPC_PROC_UNAVAIL);
goto sendit;

err_garbage:
if (net_ratelimit())
printk("svc: failed to decode args\n");
svc_printk(rqstp, "failed to decode args\n");

rpc_stat = rpc_garbage_args;
err_bad:
Expand Down

0 comments on commit 33bae80

Please sign in to comment.