[lkml]   [2001]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [patch] netconsole-2.4.10-B1
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
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--- linux/drivers/net/ 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;
 \ /
  Last update: 2005-03-22 13:03    [W:0.090 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site