net: ethernet: add PTP multicast default MAC address

All except peer delay message in PTP protocol use multicast MAC
address is 01:1b:19:00:00:00

Signed-off-by: Weiwei Guo <guoweiwei@syriusrobotics.com>
This commit is contained in:
Weiwei Guo 2023-07-04 13:39:50 +08:00 committed by Fabio Baltieri
parent b25dc410de
commit 631dce5866
2 changed files with 17 additions and 0 deletions

View file

@ -715,6 +715,22 @@ static inline bool net_eth_is_addr_lldp_multicast(struct net_eth_addr *addr)
return false;
}
static inline bool net_eth_is_addr_ptp_multicast(struct net_eth_addr *addr)
{
#if defined(CONFIG_NET_GPTP)
if (addr->addr[0] == 0x01 &&
addr->addr[1] == 0x1b &&
addr->addr[2] == 0x19 &&
addr->addr[3] == 0x00 &&
addr->addr[4] == 0x00 &&
addr->addr[5] == 0x00) {
return true;
}
#endif
return false;
}
const struct net_eth_addr *net_eth_broadcast_addr(void);
/** @endcond */

View file

@ -302,6 +302,7 @@ static enum net_verdict ethernet_recv(struct net_if *iface,
!net_eth_is_addr_multicast((struct net_eth_addr *)lladdr->addr) &&
!net_eth_is_addr_lldp_multicast(
(struct net_eth_addr *)lladdr->addr) &&
!net_eth_is_addr_ptp_multicast((struct net_eth_addr *)lladdr->addr) &&
!net_linkaddr_cmp(net_if_get_link_addr(iface), lladdr)) {
/* The ethernet frame is not for me as the link addresses
* are different.