diff options
Diffstat (limited to 'sys/netinet/if_ether.h')
-rw-r--r-- | sys/netinet/if_ether.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h index 25045da1c93..7364cdf83c1 100644 --- a/sys/netinet/if_ether.h +++ b/sys/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.h,v 1.9 1999/08/08 00:43:00 niklas Exp $ */ +/* $OpenBSD: if_ether.h,v 1.10 1999/12/08 06:50:19 itojun Exp $ */ /* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */ /* @@ -91,6 +91,23 @@ struct ether_header { (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \ (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \ } + +/* + * Macro to map an IPv6 multicast address to an Ethernet multicast address. + * The high-order 16 bits of the Ethernet address are statically assigned, + * and the low-order 32 bits are taken from the low end of the IPv6 address. + */ +#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \ + /* struct in6_addr *ip6addr; */ \ + /* u_int8_t enaddr[ETHER_ADDR_LEN]; */ \ +{ \ + (enaddr)[0] = 0x33; \ + (enaddr)[1] = 0x33; \ + (enaddr)[2] = ((u_int8_t *)ip6addr)[12]; \ + (enaddr)[3] = ((u_int8_t *)ip6addr)[13]; \ + (enaddr)[4] = ((u_int8_t *)ip6addr)[14]; \ + (enaddr)[5] = ((u_int8_t *)ip6addr)[15]; \ +} #endif /* |