Re: 1.3.94 : if_arp.h

Matthew J Brown (mjb@sophos.com)
Fri, 26 Apr 1996 17:25:35 +0100


Jonathan Layes writes:
> On Apr 23, 1:24, Thomas Quinot <thomas@cuivre.fdn.fr> wrote:
> Subject: 1.3.94 : if_arp.h
> >It looks like if_arp.h lacks a #include (it uses MAX_ADDR_LEN from
> >netdevice.h).
>
> I'm getting a bit tired of writing in reply to this problem. Don't:
> #include <linux/netdevice.h>
> but instead just hard code the length of the hardware address field.
> If you include linux/netdevice.h, then lots of programs that use if_arp.h
> won't compile (especially c++ programs). So, please, don't do that. I'm
> sorry I ever used the constant MAX_ADDR_LEN, in if_arp.h; I should have
> just hard coded the length of the MAC address in the first place,
> like most of the other net header files do.

This sounds very bad to me.

If some programs can't include linux/netdevice.h, then
linux/netdevice.h maybe should be fixed.

Is the hardware address field supposed to be a device-specific
constant or a system-wide constant? Either way, it should be a
symbolic constant, not a magic number.

If it's a system-wide constant and including linux/netdevice.h is
impractical, then maybe there should be a new header file for
MAX_ADDR_LEN and other useful stuff.

Whatever, coding magic constants into structures like this is the road
to unmaintainability, and should be avoided at all costs.

-Matt