All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdlab.org>
To: Andreas Dilger <adilger@turbolabs.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, linux-net@vger.kernel.org,
	netdev@oss.sgi.com
Subject: Re: [patch] netconsole-2.4.10-B1
Date: Mon, 01 Oct 2001 09:58:07 -0700	[thread overview]
Message-ID: <3BB8A09F.DAFE41B3@osdlab.org> (raw)
In-Reply-To: <Pine.LNX.4.21.0109261635190.957-100000@freak.distro.conectiva> <Pine.LNX.4.33.0109270746150.1679-100000@localhost.localdomain> <20010928010819.A434@turbolinux.com>

[-- Attachment #1: Type: text/plain, Size: 867 bytes --]

Andreas Dilger wrote:
> 
> A few minor changes to the code, after testing it a bit locally (note that I
> am using kernel patch C1):
> 
> First, a patch to change the MAC address kernel parameter to be in the
> standard XX:XX:XX:XX:XX:XX form, instead of separate bytes.  It also
> fixes the output of the IP addresses to be unsigned ints.  Isn't there
> a function in the kernel to format IP addresses for output already?

Not quite for formatting, but NIPQUAD(ipaddr) passes 4 octets of IP
address to <anywhere>.

Here's a patch/replacement for the IP address printing in the
netconsole
kernel module, using NIPQUAD().  Against netconsole version C2.

BTW, in linux/include/linux/kernel.h, isn't HIPQUAD() totally useless
(and also unused)?  It looks very little-endian-specific.
Well, it can be used on little-endian systems if the ipaddr is
in host-order.

~Randy

[-- Attachment #2: netcon-ipaddr.patch --]
[-- Type: text/plain, Size: 1290 bytes --]

--- linux/drivers/net/netconsole.c.save	Mon Oct  1 07:43:31 2001
+++ linux/drivers/net/netconsole.c	Mon Oct  1 09:28:57 2001
@@ -263,25 +263,20 @@
 		printk(KERN_ERR "netconsole: network device %s is not an IP protocol device, aborting.\n", dev);
 		return -1;
 	}
-	source_ip = ntohl(in_dev->ifa_list->ifa_local);
+	source_ip = in_dev->ifa_list->ifa_local;
 	if (!source_ip) {
 		printk(KERN_ERR "netconsole: network device %s has no local address, aborting.\n", dev);
 		return -1;
 	}
-#define IP(x) ((char *)&source_ip)[x]
-	printk(KERN_INFO "netconsole: using source IP %i.%i.%i.%i\n",
-		IP(3), IP(2), IP(1), IP(0));
-#undef IP
-	source_ip = htonl(source_ip);
+	printk(KERN_INFO "netconsole: using source IP %u.%u.%u.%u\n", NIPQUAD(source_ip));
+
+	target_ip = htonl(target_ip);
 	if (!target_ip) {
 		printk(KERN_ERR "netconsole: target_ip parameter not specified, aborting.\n");
 		return -1;
 	}
-#define IP(x) ((char *)&target_ip)[x]
-	printk(KERN_INFO "netconsole: using target IP %i.%i.%i.%i\n",
-		IP(3), IP(2), IP(1), IP(0));
-#undef IP
-	target_ip = htonl(target_ip);
+	printk(KERN_INFO "netconsole: using target IP %u.%u.%u.%u\n", NIPQUAD(target_ip));
+
 	if (!source_port) {
 		printk(KERN_ERR "netconsole: source_port parameter not specified, aborting.\n");
 		return -1;

      parent reply	other threads:[~2001-10-01 17:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-26 20:04 [patch] netconsole - log kernel messages over the network. 2.4.10 Ingo Molnar
2001-09-26 19:36 ` Marcelo Tosatti
2001-09-26 21:15   ` jamal
2001-09-27  5:45     ` Ingo Molnar
2001-09-26 21:29   ` Andreas Dilger
2001-09-26 23:46     ` Andreas Dilger
2001-09-27  5:28       ` Ingo Molnar
2001-09-27  6:38   ` [patch] netconsole-2.4.10-B1 Ingo Molnar
2001-09-28  7:08     ` Andreas Dilger
2001-09-29  1:34       ` Randy.Dunlap
2001-09-29  9:52         ` Ingo Molnar
2001-09-29 16:32           ` John Alvord
2001-09-29 16:40           ` Pekka Savola
2001-09-29 22:37             ` Andreas Dilger
2001-09-30  3:38           ` Kenneth Johansson
2001-09-30  7:52             ` Rik van Riel
2001-09-30 10:40               ` Riley Williams
2001-09-30 10:48               ` Glynn Clements
2001-09-30 12:25               ` Richard Gooch
2001-10-01  7:35                 ` Ingo Molnar
2001-10-01 14:55                   ` Oliver Xymoron
2001-10-01 16:28                   ` Richard Gooch
2001-10-01  8:47               ` Henning P. Schmiedehausen
2001-10-01 16:03                 ` Andreas Dilger
2001-09-30 21:18             ` H. Peter Anvin
2001-09-30 16:00           ` Marcus Sundberg
2001-10-01  7:39             ` Ingo Molnar
2001-09-30 19:42           ` Randy.Dunlap
2001-09-30 20:25             ` Randy.Dunlap
2001-10-01  4:09               ` Andreas Dilger
2001-10-03  1:09                 ` [patch] netconsole-2.4.10-C2 Randy.Dunlap
2001-10-01 16:58       ` Randy.Dunlap [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BB8A09F.DAFE41B3@osdlab.org \
    --to=rddunlap@osdlab.org \
    --cc=adilger@turbolabs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.