[patch] linux/net/arp.c, fixes IP/hw type collision, removes unused code

From: David Ford (david@kalifornia.com)
Date: Mon Oct 02 2000 - 14:40:48 EST


Would you guys please look this over and say yes or no for Linus. I've
posted this as a fix for several people several times and not gotten any
responses from the top dogs. There are no complaints about it, it's in
the form Alexey wants and fixes the arp problem. The second portion of
the patch removes the %s, "*" for the mask as the mask isn't implemented
in this area and I'm told it won't be.

current broken implementation (eth0 works, this is an example, other
types of devices yield the below):

     $ cat /proc/net/arp
     IP address HW type Flags HW address
     Mask Device
     208.179.0.1930x1 0x2 00:E0:98:70:1E:AF
     * eth0

fixed version:

     $ cat /proc/net/arp
     IP address HW type Flags HW address
     Mask Device
     208.179.0.193 0x1 0x2 00:E0:98:70:1E:AF
     * eth0

-d

--
      "There is a natural aristocracy among men. The grounds of this are
      virtue and talents", Thomas Jefferson [1742-1826], 3rd US President

--- net/ipv4/arp.c.orig Fri Aug 4 18:18:49 2000 +++ net/ipv4/arp.c Sat Sep 23 12:47:03 2000 @@ -65,6 +65,7 @@ * clean up the APFDDI & gen. FDDI bits. * Alexey Kuznetsov: new arp state machine; * now it is in net/core/neighbour.c. + * David Ford : More fixes cleaning up the proc output */ /* RFC1122 Status: @@ -1025,6 +1026,7 @@ char hbuffer[HBUFFERLEN]; int i,j,k; const char hexbuf[] = "0123456789ABCDEF"; + char abuf[16]; size = sprintf(buffer,"IP address HW type Flags HW address Mask Device\n"); @@ -1063,20 +1065,15 @@ } #endif - { - char tbuf[16]; - sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(*(u32*)n->primary_key)); - - size = sprintf(buffer+len, "%-16s 0x%-10x0x%-10x%s", - tbuf, - hatype, - arp_state_to_flags(n), - hbuffer); - - size += sprintf(buffer+len+size, - " %-8s %s\n", - "*", dev->name); - } + size = sprintf(buffer+len, "%-16s 0x%-10x0x%-10x%s", + in_ntoa2(*(u32*)n->primary_key, abuf), + hatype, + arp_state_to_flags(n), + hbuffer); + + size += sprintf(buffer+len+size, + " * %-16s\n", + dev->name); read_unlock(&n->lock); @@ -1099,15 +1096,15 @@ struct net_device *dev = n->dev; int hatype = dev ? dev->type : 0; - size = sprintf(buffer+len, - "%u.%u.%u.%u0x%-10x0x%-10x%s", - NIPQUAD(*(u32*)n->key), + size = sprintf(buffer+len, "%-16s 0x%-10x0x%-10x%s", + in_ntoa2(*(u32*)n->key, abuf), hatype, ATF_PUBL|ATF_PERM, "00:00:00:00:00:00"); + size += sprintf(buffer+len+size, - " %-17s %s\n", - "*", dev ? dev->name : "*"); + " * %-16s\n", + dev ? dev->name : "*"); len += size; pos += size;


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Oct 07 2000 - 21:00:10 EST