mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* small etherdevice.h fix
@ 2006-02-03 20:08 Mikulas Patocka
  2006-02-03 21:22 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Mikulas Patocka @ 2006-02-03 20:08 UTC (permalink / raw)
  To: linux-kernel

Hi

This fixes a small bug in is_valid_ether_addr --- for address in the form 
FF:xx:xx:xx:xx:xx it returns true. The comment is about FF:FF:FF:FF:FF:FF 
is not true, is_multicast_ether_addr doesn't accept FF:FF:FF:FF:FF:FF as 
multicast (as you can see few lines above).

Mikulas

--- include/linux/etherdevice.h_	2006-02-03 21:05:23.000000000 +0100
+++ include/linux/etherdevice.h	2006-02-03 21:05:59.000000000 +0100
@@ -91,9 +91,7 @@
   */
  static inline int is_valid_ether_addr(const u8 *addr)
  {
-	/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
-	 * explicitly check for it here. */
-	return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
+	return !(addr[0] & 1) && !is_zero_ether_addr(addr);
  }

  /**

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: small etherdevice.h fix
  2006-02-03 20:08 small etherdevice.h fix Mikulas Patocka
@ 2006-02-03 21:22 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2006-02-03 21:22 UTC (permalink / raw)
  To: linux-kernel

On Fri, 3 Feb 2006 21:08:23 +0100 (CET)
Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> wrote:

> Hi
> 
> This fixes a small bug in is_valid_ether_addr --- for address in the form 
> FF:xx:xx:xx:xx:xx it returns true. The comment is about FF:FF:FF:FF:FF:FF 
> is not true, is_multicast_ether_addr doesn't accept FF:FF:FF:FF:FF:FF as 
> multicast (as you can see few lines above).
> 
> Mikulas
> 
> --- include/linux/etherdevice.h_	2006-02-03 21:05:23.000000000 +0100
> +++ include/linux/etherdevice.h	2006-02-03 21:05:59.000000000 +0100
> @@ -91,9 +91,7 @@
>    */
>   static inline int is_valid_ether_addr(const u8 *addr)
>   {
> -	/* FF:FF:FF:FF:FF:FF is a multicast address so we don't need to
> -	 * explicitly check for it here. */
> -	return !is_multicast_ether_addr(addr) && !is_zero_ether_addr(addr);
> +	return !(addr[0] & 1) && !is_zero_ether_addr(addr);
>   }
> 
>   /**

It has already been fixed in 2.6.16 is_multicast_addr is now:

static inline int is_multicast_ether_addr(const u8 *addr)
{
	return (0x01 & addr[0]);
}


-- 
Stephen Hemminger <shemminger@osdl.org>
OSDL http://developer.osdl.org/~shemminger

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-02-03 21:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-03 20:08 small etherdevice.h fix Mikulas Patocka
2006-02-03 21:22 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®