Skip to content

Commit

Permalink
net: gptp: fix src MAC address
Browse files Browse the repository at this point in the history
The return value of net_if_get_link_addr points to a struct net_linkaddr
instead of to the raw MAC address. Without this fix the source address
will always end in 06:03 and will most likely be the same for different
boards running the same software.

Signed-off-by: Daniel Glöckner <[email protected]>
  • Loading branch information
dgloeck authored and jukkar committed Feb 7, 2019
1 parent 1d19918 commit 1e676d6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/net/l2/ethernet/gptp/gptp_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ static struct net_pkt *setup_gptp_frame(struct net_if *iface,
net_buf_add(pkt->buffer, sizeof(struct gptp_hdr) + extra_header);
net_pkt_set_gptp(pkt, true);

net_pkt_lladdr_src(pkt)->addr = (u8_t *)net_if_get_link_addr(iface);
net_pkt_lladdr_src(pkt)->len = sizeof(struct net_eth_addr);
net_pkt_lladdr_src(pkt)->addr = net_if_get_link_addr(iface)->addr;
net_pkt_lladdr_src(pkt)->len = net_if_get_link_addr(iface)->len;

net_pkt_lladdr_dst(pkt)->addr = (u8_t *)&gptp_multicast_eth_addr;
net_pkt_lladdr_dst(pkt)->len = sizeof(struct net_eth_addr);
Expand Down

0 comments on commit 1e676d6

Please sign in to comment.