Skip to content

Commit 1e676d6

Browse files
dgloeckjukkar
authored andcommitted
net: gptp: fix src MAC address
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 <dg@emlix.com>
1 parent 1d19918 commit 1e676d6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

subsys/net/l2/ethernet/gptp/gptp_messages.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ static struct net_pkt *setup_gptp_frame(struct net_if *iface,
172172
net_buf_add(pkt->buffer, sizeof(struct gptp_hdr) + extra_header);
173173
net_pkt_set_gptp(pkt, true);
174174

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

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

0 commit comments

Comments
 (0)