-/* $OpenBSD: if_tpmr.c,v 1.22 2021/01/19 07:31:05 mvs Exp $ */
+/* $OpenBSD: if_tpmr.c,v 1.23 2021/02/26 02:09:45 dlg Exp $ */
/*
* Copyright (c) 2019 The University of Queensland
#include <net/if_vlan_var.h>
#endif
-static const uint8_t ether_8021_prefix[ETHER_ADDR_LEN - 1] =
- { 0x01, 0x80, 0xc2, 0x00, 0x00 };
-
-#define ETHER_IS_8021_PREFIX(_m) \
- (memcmp((_m), ether_8021_prefix, sizeof(ether_8021_prefix)) == 0)
-
/*
* tpmr interface
*/
tpmr_8021q_filter(const struct mbuf *m)
{
const struct ether_header *eh;
+ uint64_t dst;
if (m->m_len < sizeof(*eh))
return (1);
eh = mtod(m, struct ether_header *);
- if (ETHER_IS_8021_PREFIX(eh->ether_dhost)) {
- switch (eh->ether_dhost[5]) {
+ dst = ether_addr_to_e64((struct ether_addr *)eh->ether_dhost);
+ if (ETH64_IS_8021_RSVD(dst)) {
+ switch (dst & 0xf) {
case 0x01: /* IEEE MAC-specific Control Protocols */
case 0x02: /* IEEE 802.3 Slow Protocols */
case 0x04: /* IEEE MAC-specific Control Protocols */