From dc641ceffd10f6c0a30ef557abec4fc498db04cd Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 14 Feb 2023 17:30:07 +0100 Subject: [PATCH] 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 --- tests/net/ieee802154/6lo_fragment/src/main.c | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/net/ieee802154/6lo_fragment/src/main.c b/tests/net/ieee802154/6lo_fragment/src/main.c index 368460f8f95..0e502df6344 100644 --- a/tests/net/ieee802154/6lo_fragment/src/main.c +++ b/tests/net/ieee802154/6lo_fragment/src/main.c @@ -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);