From: dlg Date: Fri, 26 Feb 2021 02:09:45 +0000 (+0000) Subject: tpmr can use the eth64 bits too. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0f2d5894bd0f3a0be4553765e34321202ef358bc;p=openbsd tpmr can use the eth64 bits too. --- diff --git a/sys/net/if_tpmr.c b/sys/net/if_tpmr.c index e9206e6573d..5b9e09b5705 100644 --- a/sys/net/if_tpmr.c +++ b/sys/net/if_tpmr.c @@ -1,4 +1,4 @@ -/* $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 @@ -62,12 +62,6 @@ #include #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 */ @@ -233,13 +227,15 @@ static int 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 */