tests: net: ieee802154: Set LL addresses on a packet

The reworked 6lowpan implementation asserts when no LL source or
destination address is set on a packet. This caused the fragmentation
tests to fail before they completed.

Fix the issue, by setting a dummy address on a packet during a setup.

Fixes #19761

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2020-01-21 17:30:04 +01:00 committed by Maureen Helm
commit 8801fd015f

View file

@ -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;
}