summaryrefslogtreecommitdiffstats
path: root/sys/netinet/if_ether.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/if_ether.h')
-rw-r--r--sys/netinet/if_ether.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index 79f1252..09caa31 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -56,6 +56,22 @@
(enaddr)[4] = ((u_char *)ipaddr)[2]; \
(enaddr)[5] = ((u_char *)ipaddr)[3]; \
}
+/*
+ * Macro to map an IP6 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 IP6 address.
+ */
+#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \
+/* struct in6_addr *ip6addr; */ \
+/* u_char enaddr[ETHER_ADDR_LEN]; */ \
+{ \
+ (enaddr)[0] = 0x33; \
+ (enaddr)[1] = 0x33; \
+ (enaddr)[2] = ((u_char *)ip6addr)[12]; \
+ (enaddr)[3] = ((u_char *)ip6addr)[13]; \
+ (enaddr)[4] = ((u_char *)ip6addr)[14]; \
+ (enaddr)[5] = ((u_char *)ip6addr)[15]; \
+}
/*
* Ethernet Address Resolution Protocol.
OpenPOWER on IntegriCloud