+/* Returns true if 'ea' is a reserved address, that a bridge must never
+ * forward, false otherwise.
+ *
+ * If you change this function's behavior, please update corresponding
+ * documentation in vswitch.xml at the same time. */
+bool
+eth_addr_is_reserved(const uint8_t ea[ETH_ADDR_LEN])
+{
+ struct eth_addr_node {
+ struct hmap_node hmap_node;
+ const uint64_t ea64;
+ };
+
+ static struct eth_addr_node nodes[] = {
+ /* STP, IEEE pause frames, and other reserved protocols. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000000ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000001ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000002ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000003ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000004ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000005ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000006ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000007ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000008ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c2000009ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c200000aULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c200000bULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c200000cULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c200000dULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c200000eULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x0180c200000fULL },
+
+ /* Extreme protocols. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x00e02b000000ULL }, /* EDP. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x00e02b000004ULL }, /* EAPS. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x00e02b000006ULL }, /* EAPS. */
+
+ /* Cisco protocols. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000c000000ULL }, /* ISL. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccccULL }, /* PAgP, UDLD, CDP,
+ * DTP, VTP. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000ccccccdULL }, /* PVST+. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000ccdcdcdULL }, /* STP Uplink Fast,
+ * FlexLink. */
+
+ /* Cisco CFM. */
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc0ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc1ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc2ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc3ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc4ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc5ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc6ULL },
+ { HMAP_NODE_NULL_INITIALIZER, 0x01000cccccc7ULL },
+ };
+
+ static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
+ struct eth_addr_node *node;
+ static struct hmap addrs;
+ uint64_t ea64;
+
+ if (ovsthread_once_start(&once)) {
+ hmap_init(&addrs);
+ for (node = nodes; node < &nodes[ARRAY_SIZE(nodes)]; node++) {
+ hmap_insert(&addrs, &node->hmap_node, hash_uint64(node->ea64));
+ }
+ ovsthread_once_done(&once);
+ }
+
+ ea64 = eth_addr_to_uint64(ea);
+ HMAP_FOR_EACH_IN_BUCKET (node, hmap_node, hash_uint64(ea64), &addrs) {
+ if (node->ea64 == ea64) {
+ return true;
+ }
+ }
+ return false;
+}
+