[ipxe-devel] [RFC 1/3] [net] Fix IN6_IS_ADDR_NONGLOBAL for multicast addresses

Thomas Bächler thomas at archlinux.org
Wed Feb 3 19:12:42 UTC 2016


Previously all multicast addresses were considered to have local scope. This changes the test
to check the scope field of the multicast address.
---
 src/include/ipxe/in.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/include/ipxe/in.h b/src/include/ipxe/in.h
index 0ebf441..61c60d7 100644
--- a/src/include/ipxe/in.h
+++ b/src/include/ipxe/in.h
@@ -70,7 +70,8 @@ struct in6_addr {
 	  htons ( 0xfe80 ) )
 
 #define IN6_IS_ADDR_NONGLOBAL( addr )					\
-	( IN6_IS_ADDR_LINKLOCAL (addr) || IN6_IS_ADDR_MULTICAST (addr) )
+	( IN6_IS_ADDR_LINKLOCAL (addr) || 					\
+	  ( IN6_IS_ADDR_MULTICAST (addr) && ( *( ( const uint16_t * ) (addr) ) & htons( 0x000f ) ) == htons( 0x0002 ) ) )
 
 /**
  * IPv4 socket address
-- 
2.6.3



More information about the ipxe-devel mailing list