[2531] in linux-net channel archive
Re: tcpdump
daemon@ATHENA.MIT.EDU (Jonathan Layes)
Tue Apr 16 21:27:28 1996
From: Jonathan Layes <layes@loran.com>
Date: Tue, 16 Apr 1996 10:18:11 -0400
To: Avery Pennarun <apenwarr@foxnet.net>, naderr@topaz.cqu.edu.au
Cc: linux-net@vger.rutgers.edu
>The Debian R6 sources contain a tcpdump which almost compiles on recent
>kernels. The problem is that linux/if_arp.h still requires
>linux/netdevice.h. The cleanest way around this that I could find was to
>modify net/if_arp.h (which the tcpdump sources use) to look like this:
> #include <linux/netdevice.h>
> #include <linux/if_arp.h>
>Again, is there any real reason why linux/if_arp.h can't include
>linux/netdevice.h by itself? It is, as far as I can tell, strictly
>necessary to include netdevice.h first if you use if_arp.h, so you gain
>absolutely nothing by not doing it automatically.
I have sent in a fix for this already, but someone broke it again in
the last couple versions of the kernel. So, I sent in another fix about
five minutes ago, which I'm including below.
In particular, #include <linux/netdevice.h> is a bad idea. In fact,
I introduced that change when I first released arpd, but all of a sudden
the world started complaining that most C++ code (and even a bit of C
code) which requires if_arp.h no longer compiled. So, I just got rid
of the MAX_ADDR_SIZE constant and replaced it with the number 7. If
the size of MAC addresses ever changes, a whole lot more than if_arp.h
is going to break, so I'm not too worried about it.
Someone also removed the #include <linux/socket.h> from if_arp.h, which
is a bad idea, since that means users must include socket.h before if_arp.h
in their code, and order-dependent header files drive me nuts.
Jonathan
--- linux-1.3.89.orig/include/linux/if_arp.h Mon Apr 1 02:46:30 1996
+++ linux/include/linux/if_arp.h Tue Apr 16 08:55:19 1996
@@ -22,6 +22,8 @@
#ifndef _LINUX_IF_ARP_H
#define _LINUX_IF_ARP_H
+#include <linux/socket.h>
+
/* ARP protocol HARDWARE identifiers. */
#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */
#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */
@@ -116,7 +118,7 @@
unsigned short req; /* request type */
__u32 ip; /* ip address of entry */
__u32 mask; /* netmask - used for proxy */
- unsigned char ha[MAX_ADDR_LEN]; /* Hardware address */
+ unsigned char ha[7]; /* Hardware address */
unsigned long last_used; /* For expiry */
unsigned long last_updated; /* For expiry */
unsigned int flags; /* Control status */