diff --git a/tests/net/ieee802154/fragment/src/main.c b/tests/net/ieee802154/fragment/src/main.c index 14c1d4f7ec1..465d375a311 100644 --- a/tests/net/ieee802154/fragment/src/main.c +++ b/tests/net/ieee802154/fragment/src/main.c @@ -166,7 +166,7 @@ int net_fragment_dev_init(struct device *dev) static void net_fragment_iface_init(struct net_if *iface) { - u8_t mac[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb}; + static u8_t mac[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb}; net_if_set_link_addr(iface, mac, 8, NET_LINK_IEEE802154); } @@ -230,6 +230,7 @@ static bool compare_data(struct net_pkt *pkt, struct net_fragment_data *data) static struct net_pkt *create_pkt(struct net_fragment_data *data) { + static u16_t dummy_short_addr; struct net_pkt *pkt; struct net_buf *buf; u32_t bytes, pos; @@ -287,6 +288,15 @@ static struct net_pkt *create_pkt(struct net_fragment_data *data) } } + /* Setup link layer addresses. */ + net_pkt_lladdr_dst(pkt)->addr = (u8_t *)&dummy_short_addr; + net_pkt_lladdr_dst(pkt)->len = sizeof(dummy_short_addr); + net_pkt_lladdr_dst(pkt)->type = NET_LINK_IEEE802154; + + memcpy(net_pkt_lladdr_src(pkt), + net_if_get_link_addr(net_if_get_default()), + sizeof(struct net_linkaddr)); + return pkt; }