public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] nfsd: Insecure port warning shows decimal IPv4 address
@ 2004-10-03 18:03 Ed Schouten
  2004-10-03 19:32 ` Andrew Morton
       [not found] ` <Pine.LNX.4.10.10410031203240.7525-100000@netwinder.perches.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Ed Schouten @ 2004-10-03 18:03 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

Hi guys,

Made a quick patch that changes dmesg(8) output to show IPv4 addresses in
decimal form instead of hexadecimal when you receive an insecure port
warning.
---

 nfsfh.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

--- linux-2.6.9-rc3/fs/nfsd/nfsfh.c	2004-09-30 05:04:26.000000000 +0200
+++ linux-2.6.9-rc3-xbox/fs/nfsd/nfsfh.c	2004-10-03 19:29:39.711659000 +0200
@@ -153,8 +153,11 @@
 		error = nfserr_perm;
 		if (!rqstp->rq_secure && EX_SECURE(exp)) {
 			printk(KERN_WARNING
-			       "nfsd: request from insecure port (%08x:%d)!\n",
-			       ntohl(rqstp->rq_addr.sin_addr.s_addr),
+			       "nfsd: request from insecure port (%d.%d.%d.%d:%d)!\n",
+			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr) >> 24),
+			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr) >> 16),
+			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr) >> 8),
+			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr)),
 			       ntohs(rqstp->rq_addr.sin_port));
 			goto out;
 		}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] nfsd: Insecure port warning shows decimal IPv4 address
  2004-10-03 18:03 [Patch] nfsd: Insecure port warning shows decimal IPv4 address Ed Schouten
@ 2004-10-03 19:32 ` Andrew Morton
  2004-10-03 20:15   ` Ed Schouten
       [not found] ` <Pine.LNX.4.10.10410031203240.7525-100000@netwinder.perches.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2004-10-03 19:32 UTC (permalink / raw)
  To: Ed Schouten; +Cc: linux-kernel, torvalds

"Ed Schouten" <ed@il.fontys.nl> wrote:
>
> Made a quick patch that changes dmesg(8) output to show IPv4 addresses in
>  decimal form instead of hexadecimal when you receive an insecure port
>  warning.
>  ---
> 
>   nfsfh.c |    7 +++++--
>   1 files changed, 5 insertions(+), 2 deletions(-)
> 
>  --- linux-2.6.9-rc3/fs/nfsd/nfsfh.c	2004-09-30 05:04:26.000000000 +0200
>  +++ linux-2.6.9-rc3-xbox/fs/nfsd/nfsfh.c	2004-10-03 19:29:39.711659000 +0200
>  @@ -153,8 +153,11 @@
>   		error = nfserr_perm;
>   		if (!rqstp->rq_secure && EX_SECURE(exp)) {
>   			printk(KERN_WARNING
>  -			       "nfsd: request from insecure port (%08x:%d)!\n",
>  -			       ntohl(rqstp->rq_addr.sin_addr.s_addr),
>  +			       "nfsd: request from insecure port (%d.%d.%d.%d:%d)!\n",
>  +			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr) >> 24),
>  +			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr) >> 16),
>  +			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr) >> 8),
>  +			       (unsigned char)(ntohl(rqstp->rq_addr.sin_addr.s_addr)),
>   			       ntohs(rqstp->rq_addr.sin_port));
>   			goto out;
>   		}

There's a NIPQUAD macro to make this a bit tidier.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] nfsd: Insecure port warning shows decimal IPv4 address
  2004-10-03 19:32 ` Andrew Morton
@ 2004-10-03 20:15   ` Ed Schouten
  0 siblings, 0 replies; 4+ messages in thread
From: Ed Schouten @ 2004-10-03 20:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Sun, October 3, 2004 9:32 pm, Andrew Morton said:
> There's a NIPQUAD macro to make this a bit tidier.

Yes, I heard that 3 minutes after I mailed this patch to you guys ;-) I'll
take a look at it tomorrow.

Yours,
-- 
 Ed Schouten <ed@il.fontys.nl>
 Website: http://g-rave.nl/
 GnuPG key: 0xD6A1AF3E

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] nfsd: Insecure port warning shows decimal IPv4 address
       [not found] ` <Pine.LNX.4.10.10410031203240.7525-100000@netwinder.perches.com>
@ 2004-10-03 22:49   ` Ed Schouten
  0 siblings, 0 replies; 4+ messages in thread
From: Ed Schouten @ 2004-10-03 22:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: Joe Perches, akpm

On Sun, October 3, 2004 9:12 pm, Joe Perches said:
> There may be a couple of places where this could be done in fs/nfsd

True. After a quick look, I found another spot in nfsproc.c. Here's a new
patch, using the NIPQUAD macro.
---

 nfsfh.c   |    4 ++--
 nfsproc.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -u -r linux-2.6.9-rc3/fs/nfsd/nfsfh.c
linux-2.6.9-rc3-xbox/fs/nfsd/nfsfh.c
--- linux-2.6.9-rc3/fs/nfsd/nfsfh.c	2004-09-30 05:04:26.000000000 +0200
+++ linux-2.6.9-rc3-xbox/fs/nfsd/nfsfh.c	2004-10-04 00:45:16.926659000 +0200
@@ -153,8 +153,8 @@
 		error = nfserr_perm;
 		if (!rqstp->rq_secure && EX_SECURE(exp)) {
 			printk(KERN_WARNING
-			       "nfsd: request from insecure port (%08x:%d)!\n",
-			       ntohl(rqstp->rq_addr.sin_addr.s_addr),
+			       "nfsd: request from insecure port (%u.%u.%u.%u:%d)!\n",
+			       NIPQUAD(rqstp->rq_addr.sin_addr.s_addr),
 			       ntohs(rqstp->rq_addr.sin_port));
 			goto out;
 		}
diff -u -r linux-2.6.9-rc3/fs/nfsd/nfsproc.c
linux-2.6.9-rc3-xbox/fs/nfsd/nfsproc.c
--- linux-2.6.9-rc3/fs/nfsd/nfsproc.c	2004-09-30 05:04:25.000000000 +0200
+++ linux-2.6.9-rc3-xbox/fs/nfsd/nfsproc.c	2004-10-04 00:44:58.225659000
+0200
@@ -128,8 +128,8 @@

 	if (NFSSVC_MAXBLKSIZE < argp->count) {
 		printk(KERN_NOTICE
-			"oversized read request from %08x:%d (%d bytes)\n",
-				ntohl(rqstp->rq_addr.sin_addr.s_addr),
+			"oversized read request from %u.%u.%u.%u:%d (%d bytes)\n",
+				NIPQUAD(rqstp->rq_addr.sin_addr.s_addr),
 				ntohs(rqstp->rq_addr.sin_port),
 				argp->count);
 		argp->count = NFSSVC_MAXBLKSIZE;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-03 22:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-03 18:03 [Patch] nfsd: Insecure port warning shows decimal IPv4 address Ed Schouten
2004-10-03 19:32 ` Andrew Morton
2004-10-03 20:15   ` Ed Schouten
     [not found] ` <Pine.LNX.4.10.10410031203240.7525-100000@netwinder.perches.com>
2004-10-03 22:49   ` Ed Schouten

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox