Commit dc641cef authored by Robert Lubos's avatar Robert Lubos Committed by Anas Nashif
Browse files

net: ieee802154: 6lo: Add test case for IPHC fragmentation corner case

Add a test case, which reproduces a scenario, where packet before IPHC
exceeds 802154 MTU, but after header compression, in fits.

Signed-off-by: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent a8bda2ef
Loading
Loading
Loading
Loading
+24 −0
Changes for tests/net/ieee802154/6lo_fragment/src/main.c: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -438,6 +438,24 @@ static struct net_fragment_data test_data_8 = {
	.iphc = false
};


static struct net_fragment_data test_data_9 = {
	.ipv6.vtc = 0x61,
	.ipv6.tcflow = 0x20,
	.ipv6.flow = 0x00,
	.ipv6.len = 0,
	.ipv6.nexthdr = IPPROTO_UDP,
	.ipv6.hop_limit = 0xff,
	.ipv6.src = src_sam00,
	.ipv6.dst = dst_m1_dam01,
	.udp.src_port = htons(udp_src_port_16bit),
	.udp.dst_port = htons(udp_dst_port_16bit),
	.udp.len = 0x00,
	.udp.chksum = 0x00,
	.len = 90,
	.iphc = true
};

static uint8_t frame_buffer_data[IEEE802154_MTU];

static struct net_buf frame_buf = {
@@ -631,5 +649,11 @@ ZTEST(ieee802154_6lo_fragment, test_fragment_ipv6_dispatch_big)
	zassert_true(ret);
}

ZTEST(ieee802154_6lo_fragment, test_fragment_ipv6_no_fragmentation_after_iphc)
{
	bool ret = test_fragment(&test_data_9);

	zassert_true(ret);
}

ZTEST_SUITE(ieee802154_6lo_fragment, NULL, NULL, NULL, NULL, NULL);