Re: [Patch] nfsd: Insecure port warning shows decimal IPv4 address

From: Andrew Morton
Date: Sun Oct 03 2004 - 14:36:45 EST


"Ed Schouten" <ed@xxxxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/