Re: [PATCH] pcnet32 compilation fix for 2.4.3pre6

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Thu Mar 22 2001 - 09:46:18 EST


Eli Carter wrote:
> The "!(addr[0]&1)" part of the test already catches the ff's case, so
> that is redundant.
> Using 6 bytes instead of 7 is an improvement.

oops. Thanks, updated patch attached. My patch also adds inline source
docs, and uses 'static inline' instead of 'static __inline__', two small
style improvements.

-- 
Jeff Garzik       | May you have warm words on a cold evening,
Building 1024     | a full mooon on a dark night,
MandrakeSoft      | and a smooth road all the way to your door.

Index: include/linux/etherdevice.h =================================================================== RCS file: /cvsroot/gkernel/linux_2_4/include/linux/etherdevice.h,v retrieving revision 1.1.1.14.4.2 diff -u -r1.1.1.14.4.2 etherdevice.h --- include/linux/etherdevice.h 2001/03/21 14:10:50 1.1.1.14.4.2 +++ include/linux/etherdevice.h 2001/03/22 14:44:51 @@ -46,6 +46,22 @@ memcpy (dest->data, src, len); } +/** + * is_valid_ether_addr - Determine if the given Ethernet address is valid + * @addr: Pointer to a six-byte array containing the Ethernet address + * + * Check that the Ethernet address (MAC) is not 00:00:00:00:00:00, is not + * a multicast address, and is not FF:FF:FF:FF:FF:FF. + * + * Return true if the address is valid. + */ +static inline int is_valid_ether_addr( u8 *addr ) +{ + const char zaddr[6] = {0,}; + + return !(addr[0]&1) && memcmp( addr, zaddr, 6); +} + #endif #endif /* _LINUX_ETHERDEVICE_H */

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



This archive was generated by hypermail 2b29 : Fri Mar 23 2001 - 21:00:17 EST