Skip to content

Commit

Permalink
net: ethernet: add PTP multicast default MAC address
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Cherish-Gww authored and fabiobaltieri committed Jul 5, 2023
1 parent b25dc41 commit 631dce5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/zephyr/net/ethernet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions subsys/net/l2/ethernet/ethernet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 631dce5

Please sign in to comment.