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: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2023-02-14 17:30:07 +01:00 committed by Anas Nashif
parent a8bda2ef8f
commit dc641ceffd

View File

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