1 /* main.c - Application main entry point */
2 
3 /*
4  * Copyright (c) 2016 Intel Corporation
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 #include <zephyr/logging/log.h>
10 LOG_MODULE_REGISTER(net_test, CONFIG_NET_L2_IEEE802154_LOG_LEVEL);
11 
12 #include <zephyr/kernel.h>
13 #include <zephyr/ztest.h>
14 #include <zephyr/linker/sections.h>
15 
16 #include <zephyr/types.h>
17 #include <stddef.h>
18 #include <string.h>
19 #include <stdio.h>
20 #include <errno.h>
21 #include <zephyr/device.h>
22 #include <zephyr/init.h>
23 #include <zephyr/sys/printk.h>
24 #include <zephyr/net/net_core.h>
25 #include <zephyr/net/net_pkt.h>
26 #include <zephyr/net/net_ip.h>
27 #include <zephyr/net/dummy.h>
28 
29 #include <zephyr/tc_util.h>
30 
31 #include "6lo.h"
32 #include "ieee802154_6lo_fragment.h"
33 
34 #define NET_LOG_ENABLED 1
35 #include "net_private.h"
36 
37 #define DEBUG 0
38 
39 /**
40   * IPv6 Source and Destination address
41   * Example addresses are based on SAC (Source Address Compression),
42   * SAM (Source Address Mode), DAC (Destination Address Compression),
43   * DAM (Destination Address Mode) and also if the destination address
44   * is Multicast address.
45   */
46 
47 #define src_sac1_sam00 \
48 		{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
49 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
50 
51 #define src_sam00 \
52 		{ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
53 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
54 
55 #define src_sam01 \
56 		{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
57 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa }
58 
59 #define src_sam10 \
60 		{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
61 		  0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0xbb }
62 
63 #define dst_m1_dam00 \
64 		{ 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
65 		  0x00, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }
66 
67 #define dst_m1_dam01 \
68 		{ 0xff, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
69 		  0x00, 0x00, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }
70 
71 #define dst_m1_dam10 \
72 		{ 0xff, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
73 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x22, 0x33 }
74 
75 #define dst_m1_dam11 \
76 		{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
77 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11 }
78 
79 #define dst_dam00 \
80 		{ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
81 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
82 
83 #define dst_dam01 \
84 		{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
85 		  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa }
86 
87 #define dst_dam10 \
88 		{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
89 		  0x00, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00, 0xbb }
90 
91 
92 /* UDP Ports */
93 /* 4 bit compressible udp ports */
94 #define udp_src_port_4bit 0xf0b1
95 #define udp_dst_port_4bit 0xf0b2
96 
97 /* 8 bit compressible udp ports */
98 #define udp_src_port_8bit   0xf111
99 #define udp_dst_port_8bit_y 0xf022 /* compressible */
100 
101 #define udp_src_port_8bit_y 0xf011 /* compressible */
102 #define udp_dst_port_8bit   0xf122
103 
104 /* uncompressible ports */
105 #define udp_src_port_16bit 0xff11
106 #define udp_dst_port_16bit 0xff22
107 
108 static const char user_data[] =
109 		"0123456789012345678901234567890123456789"
110 		"0123456789012345678901234567890123456789"
111 		"0123456789012345678901234567890123456789"
112 		"0123456789012345678901234567890123456789"
113 		"0123456789012345678901234567890123456789"
114 		"0123456789012345678901234567890123456789"
115 		"0123456789012345678901234567890123456789"
116 		"0123456789012345678901234567890123456789"
117 		"0123456789012345678901234567890123456789"
118 		"0123456789012345678901234567890123456789"
119 		"0123456789012345678901234567890123456789"
120 		"0123456789012345678901234567890123456789"
121 		"0123456789012345678901234567890123456789"
122 		"0123456789012345678901234567890123456789"
123 		"0123456789012345678901234567890123456789"
124 		"0123456789012345678901234567890123456789"
125 		"0123456789012345678901234567890123456789"
126 		"0123456789012345678901234567890123456789"
127 		"0123456789012345678901234567890123456789"
128 		"0123456789012345678901234567890123456789"
129 		"0123456789012345678901234567890123456789"
130 		"0123456789012345678901234567890123456789"
131 		"0123456789012345678901234567890123456789"
132 		"0123456789012345678901234567890123456789"
133 		"0123456789012345678901234567890123456789"
134 		"0123456789012345678901234567890123456789"
135 		"0123456789012345678901234567890123456789"
136 		"0123456789012345678901234567890123456789"
137 		"0123456789012345678901234567890123456789"
138 		"0123456789012345678901234567890123456789"
139 		"0123456789012345678901234567890123456789"
140 		"0123456789012345678901234567890123456789"
141 		"0123456789012345678901234567890123456789"
142 		"0123456789012345678901234567890123456789"
143 		"0123456789012345678901234567890123456789"
144 		"0123456789012345678901234567890123456789"
145 		"0123456789012345678901234567890123456789"
146 		"0123456789012345678901234567890123456789"
147 		"0123456789012345678901234567890123456789"
148 		"0123456789012345678901234567890123456789"
149 		"0123456789012345678901234567890123456789"
150 		"0123456789012345678901234567890123456789"
151 		"0123456789012345678901234567890123456789"
152 		"0123456789012345678901234567890123456789";
153 
154 struct net_fragment_data {
155 	struct net_ipv6_hdr ipv6;
156 	struct net_udp_hdr udp;
157 	int len;
158 	bool iphc;
159 } __packed;
160 
161 
net_fragment_dev_init(const struct device * dev)162 int net_fragment_dev_init(const struct device *dev)
163 {
164 	return 0;
165 }
166 
net_fragment_iface_init(struct net_if * iface)167 static void net_fragment_iface_init(struct net_if *iface)
168 {
169 	static uint8_t mac[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xbb};
170 
171 	net_if_set_link_addr(iface, mac, 8, NET_LINK_IEEE802154);
172 }
173 
tester_send(const struct device * dev,struct net_pkt * pkt)174 static int tester_send(const struct device *dev, struct net_pkt *pkt)
175 {
176 	return 0;
177 }
178 
179 static struct dummy_api net_fragment_if_api = {
180 	.iface_api.init = net_fragment_iface_init,
181 	.send = tester_send,
182 };
183 
184 NET_DEVICE_INIT(net_fragment_test, "net_fragment_test",
185 		net_fragment_dev_init, NULL, NULL, NULL,
186 		CONFIG_KERNEL_INIT_PRIORITY_DEFAULT,
187 		&net_fragment_if_api, DUMMY_L2,
188 		NET_L2_GET_CTX_TYPE(DUMMY_L2), 127);
189 
compare_data(struct net_pkt * pkt,struct net_fragment_data * data)190 static bool compare_data(struct net_pkt *pkt, struct net_fragment_data *data)
191 {
192 	int remaining = data->len;
193 	uint32_t bytes, pos, compare, offset;
194 	struct net_buf *frag;
195 
196 	if (net_pkt_get_len(pkt) != (NET_IPV6UDPH_LEN + remaining)) {
197 		printk("mismatch lengths, expected %d received %zd\n",
198 			NET_IPV6UDPH_LEN + remaining,
199 			net_pkt_get_len(pkt));
200 		return false;
201 	}
202 
203 	frag = pkt->frags;
204 
205 	if (memcmp(frag->data, (uint8_t *)data, NET_IPV6UDPH_LEN)) {
206 		printk("mismatch headers\n");
207 		return false;
208 	}
209 
210 	pos = 0U;
211 	offset = NET_IPV6UDPH_LEN;
212 
213 	while (remaining > 0 && frag) {
214 		bytes = frag->len - offset;
215 		compare = remaining > bytes ? bytes : remaining;
216 
217 		if (memcmp(frag->data + offset, user_data + pos, compare)) {
218 			printk("data mismatch\n");
219 			return false;
220 		}
221 
222 		pos += compare;
223 		remaining -= compare;
224 		frag = frag->frags;
225 		offset = 0U;
226 	}
227 
228 	return true;
229 }
230 
create_pkt(struct net_fragment_data * data)231 static struct net_pkt *create_pkt(struct net_fragment_data *data)
232 {
233 	static uint16_t dummy_short_addr;
234 	struct net_pkt *pkt;
235 	struct net_buf *buf;
236 	uint32_t bytes, pos;
237 	uint16_t len;
238 	int remaining;
239 
240 	pkt = net_pkt_alloc_on_iface(
241 		net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY)), K_FOREVER);
242 	if (!pkt) {
243 		return NULL;
244 	}
245 
246 	net_pkt_set_ip_hdr_len(pkt, NET_IPV6H_LEN);
247 
248 	buf = net_pkt_get_frag(pkt, NET_IPV6UDPH_LEN, K_FOREVER);
249 	if (!buf) {
250 		net_pkt_unref(pkt);
251 		return NULL;
252 	}
253 
254 	memcpy(buf->data, (uint8_t *) data, NET_IPV6UDPH_LEN);
255 	net_buf_add(buf, NET_IPV6UDPH_LEN);
256 
257 	pos = 0U;
258 	remaining = data->len;
259 
260 	len = NET_UDPH_LEN + remaining;
261 	/* length is not set in net_fragment_data data pointer, calculate and set
262 	 * in ipv6, udp and in data pointer too (it's required in comparison) */
263 	buf->data[4] = len >> 8;
264 	buf->data[5] = (uint8_t) len;
265 	buf->data[44] = len >> 8;
266 	buf->data[45] = (uint8_t) len;
267 
268 	data->ipv6.len = htons(len);
269 	data->udp.len = htons(len);
270 
271 	while (remaining > 0) {
272 		uint8_t copy;
273 		bytes = net_buf_tailroom(buf);
274 		copy = remaining > bytes ? bytes : remaining;
275 		memcpy(net_buf_add(buf, copy), &user_data[pos], copy);
276 
277 		pos += bytes;
278 		remaining -= bytes;
279 
280 		if (net_buf_tailroom(buf) - (bytes - copy)) {
281 			net_pkt_unref(pkt);
282 			return NULL;
283 		}
284 
285 		net_pkt_frag_add(pkt, buf);
286 
287 		if (remaining > 0) {
288 			buf = net_pkt_get_frag(pkt, CONFIG_NET_BUF_DATA_SIZE, K_FOREVER);
289 		}
290 	}
291 
292 	/* Setup link layer addresses. */
293 	net_pkt_lladdr_dst(pkt)->addr = (uint8_t *)&dummy_short_addr;
294 	net_pkt_lladdr_dst(pkt)->len = sizeof(dummy_short_addr);
295 	net_pkt_lladdr_dst(pkt)->type = NET_LINK_IEEE802154;
296 
297 	memcpy(net_pkt_lladdr_src(pkt),
298 	       net_if_get_link_addr(
299 		       net_if_get_first_by_type(&NET_L2_GET_NAME(DUMMY))),
300 	       sizeof(struct net_linkaddr));
301 
302 	return pkt;
303 }
304 
305 static struct net_fragment_data test_data_1 = {
306 	.ipv6.vtc = 0x60,
307 	.ipv6.tcflow = 0x00,
308 	.ipv6.flow = 0x00,
309 	.ipv6.len = 0,
310 	.ipv6.nexthdr = IPPROTO_UDP,
311 	.ipv6.hop_limit = 0xff,
312 	.ipv6.src = src_sam00,
313 	.ipv6.dst = dst_dam00,
314 	.udp.src_port = htons(udp_src_port_4bit),
315 	.udp.dst_port = htons(udp_dst_port_4bit),
316 	.udp.len = 0x00,
317 	.udp.chksum = 0x00,
318 	.len = 70,
319 	.iphc = true
320 };
321 
322 static struct net_fragment_data test_data_2 = {
323 	.ipv6.vtc = 0x60,
324 	.ipv6.tcflow = 0x20,
325 	.ipv6.flow = 0x3412,
326 	.ipv6.len = 0,
327 	.ipv6.nexthdr = IPPROTO_UDP,
328 	.ipv6.hop_limit = 0xff,
329 	.ipv6.src = src_sam01,
330 	.ipv6.dst = dst_dam01,
331 	.udp.src_port = htons(udp_src_port_8bit_y),
332 	.udp.dst_port = htons(udp_dst_port_8bit),
333 	.udp.len = 0x00,
334 	.udp.chksum = 0x00,
335 	.len = 200,
336 	.iphc = true
337 };
338 
339 static struct net_fragment_data test_data_3 = {
340 	.ipv6.vtc = 0x60,
341 	.ipv6.tcflow = 0x21,
342 	.ipv6.flow = 0x3412,
343 	.ipv6.len = 0,
344 	.ipv6.nexthdr = IPPROTO_UDP,
345 	.ipv6.hop_limit = 0xff,
346 	.ipv6.src = src_sam10,
347 	.ipv6.dst = dst_dam10,
348 	.udp.src_port = htons(udp_src_port_8bit),
349 	.udp.dst_port = htons(udp_dst_port_8bit_y),
350 	.udp.len = 0x00,
351 	.udp.chksum = 0x00,
352 	.len = 300,
353 	.iphc = true
354 };
355 
356 static struct net_fragment_data test_data_4 = {
357 	.ipv6.vtc = 0x61,
358 	.ipv6.tcflow = 0x20,
359 	.ipv6.flow = 0x00,
360 	.ipv6.len = 0,
361 	.ipv6.nexthdr = IPPROTO_UDP,
362 	.ipv6.hop_limit = 0xff,
363 	.ipv6.src = src_sam00,
364 	.ipv6.dst = dst_m1_dam00,
365 	.udp.src_port = htons(udp_src_port_16bit),
366 	.udp.dst_port = htons(udp_dst_port_16bit),
367 	.udp.len = 0x00,
368 	.udp.chksum = 0x00,
369 	.len = 400,
370 	.iphc = true
371 };
372 
373 static struct net_fragment_data test_data_5 = {
374 	.ipv6.vtc = 0x61,
375 	.ipv6.tcflow = 0x23,
376 	.ipv6.flow = 0x4567,
377 	.ipv6.len = 0,
378 	.ipv6.nexthdr = IPPROTO_UDP,
379 	.ipv6.hop_limit = 0xff,
380 	.ipv6.src = src_sam01,
381 	.ipv6.dst = dst_m1_dam01,
382 	.udp.src_port = htons(udp_src_port_16bit),
383 	.udp.dst_port = htons(udp_dst_port_16bit),
384 	.udp.len = 0x00,
385 	.udp.chksum = 0x00,
386 	.len = 500,
387 	.iphc = true
388 };
389 
390 static struct net_fragment_data test_data_6 = {
391 	.ipv6.vtc = 0x60,
392 	.ipv6.tcflow = 0x0,
393 	.ipv6.flow = 0x0,
394 	.ipv6.len = 0,
395 	.ipv6.nexthdr = IPPROTO_UDP,
396 	.ipv6.hop_limit = 0xff,
397 	.ipv6.src = src_sam10,
398 	.ipv6.dst = dst_m1_dam10,
399 	.udp.src_port = htons(udp_src_port_8bit),
400 	.udp.dst_port = htons(udp_dst_port_8bit),
401 	.udp.len = 0x00,
402 	.udp.chksum = 0x00,
403 	.len = 1200,
404 	.iphc = true
405 };
406 
407 static struct net_fragment_data test_data_7 = {
408 	.ipv6.vtc = 0x61,
409 	.ipv6.tcflow = 0x20,
410 	.ipv6.flow = 0x00,
411 	.ipv6.len = 0,
412 	.ipv6.nexthdr = IPPROTO_UDP,
413 	.ipv6.hop_limit = 0xff,
414 	.ipv6.src = src_sac1_sam00,
415 	.ipv6.dst = dst_m1_dam00,
416 	.udp.src_port = htons(udp_src_port_16bit),
417 	.udp.dst_port = htons(udp_dst_port_16bit),
418 	.udp.len = 0x00,
419 	.udp.chksum = 0x00,
420 	.len = 70,
421 	.iphc = false
422 };
423 
424 static struct net_fragment_data test_data_8 = {
425 	.ipv6.vtc = 0x61,
426 	.ipv6.tcflow = 0x20,
427 	.ipv6.flow = 0x00,
428 	.ipv6.len = 0,
429 	.ipv6.nexthdr = IPPROTO_UDP,
430 	.ipv6.hop_limit = 0xff,
431 	.ipv6.src = src_sac1_sam00,
432 	.ipv6.dst = dst_m1_dam00,
433 	.udp.src_port = htons(udp_src_port_16bit),
434 	.udp.dst_port = htons(udp_dst_port_16bit),
435 	.udp.len = 0x00,
436 	.udp.chksum = 0x00,
437 	.len = 1200,
438 	.iphc = false
439 };
440 
441 
442 static struct net_fragment_data test_data_9 = {
443 	.ipv6.vtc = 0x61,
444 	.ipv6.tcflow = 0x20,
445 	.ipv6.flow = 0x00,
446 	.ipv6.len = 0,
447 	.ipv6.nexthdr = IPPROTO_UDP,
448 	.ipv6.hop_limit = 0xff,
449 	.ipv6.src = src_sam00,
450 	.ipv6.dst = dst_m1_dam01,
451 	.udp.src_port = htons(udp_src_port_16bit),
452 	.udp.dst_port = htons(udp_dst_port_16bit),
453 	.udp.len = 0x00,
454 	.udp.chksum = 0x00,
455 	.len = 90,
456 	.iphc = true
457 };
458 
459 static uint8_t frame_buffer_data[IEEE802154_MTU];
460 
461 static struct net_buf frame_buf = {
462 	.data = frame_buffer_data,
463 	.size = IEEE802154_MTU,
464 	.frags = NULL,
465 	.__buf = frame_buffer_data,
466 };
467 
test_fragment(struct net_fragment_data * data)468 static bool test_fragment(struct net_fragment_data *data)
469 {
470 	struct net_pkt *rxpkt = NULL;
471 	struct net_pkt *f_pkt = NULL;
472 	int result = false;
473 	struct ieee802154_6lo_fragment_ctx ctx;
474 	struct net_buf *buf, *dfrag;
475 	struct net_pkt *pkt;
476 	int hdr_diff;
477 
478 	pkt = create_pkt(data);
479 	if (!pkt) {
480 		TC_PRINT("%s: failed to create buffer\n", __func__);
481 		goto end;
482 	}
483 
484 #if DEBUG > 0
485 	printk("length before compression %zd\n", net_pkt_get_len(pkt));
486 	net_pkt_hexdump(pkt, "before-compression");
487 #endif
488 
489 	hdr_diff = net_6lo_compress(pkt, data->iphc);
490 	if (hdr_diff < 0) {
491 		TC_PRINT("compression failed\n");
492 		goto end;
493 	}
494 
495 	if (!ieee802154_6lo_requires_fragmentation(pkt, 0, 0)) {
496 		f_pkt = pkt;
497 		pkt = NULL;
498 
499 		goto reassemble;
500 	}
501 
502 	f_pkt = net_pkt_alloc(K_FOREVER);
503 	if (!f_pkt) {
504 		goto end;
505 	}
506 
507 	ieee802154_6lo_fragment_ctx_init(&ctx, pkt, hdr_diff, data->iphc);
508 	frame_buf.len = 0U;
509 
510 	buf = pkt->buffer;
511 	while (buf) {
512 		buf = ieee802154_6lo_fragment(&ctx, &frame_buf, data->iphc);
513 
514 		dfrag = net_pkt_get_frag(f_pkt, frame_buf.len, K_FOREVER);
515 		if (!dfrag) {
516 			goto end;
517 		}
518 
519 		memcpy(dfrag->data, frame_buf.data, frame_buf.len);
520 		dfrag->len = frame_buf.len;
521 
522 		net_pkt_frag_add(f_pkt, dfrag);
523 
524 		frame_buf.len = 0U;
525 	}
526 
527 	net_pkt_unref(pkt);
528 	pkt = NULL;
529 
530 reassemble:
531 
532 #if DEBUG > 0
533 	printk("length after compression and fragmentation %zd\n",
534 	       net_pkt_get_len(f_pkt));
535 	net_pkt_hexdump(f_pkt, "after-compression");
536 #endif
537 
538 	buf = f_pkt->buffer;
539 	while (buf) {
540 		rxpkt = net_pkt_rx_alloc(K_FOREVER);
541 		if (!rxpkt) {
542 			goto end;
543 		}
544 
545 		dfrag = net_pkt_get_frag(rxpkt, buf->len, K_FOREVER);
546 		if (!dfrag) {
547 			goto end;
548 		}
549 
550 		memcpy(dfrag->data, buf->data, buf->len);
551 		dfrag->len = buf->len;
552 
553 		net_pkt_frag_add(rxpkt, dfrag);
554 
555 		net_pkt_set_overwrite(rxpkt, true);
556 
557 		switch (ieee802154_6lo_reassemble(rxpkt)) {
558 		case NET_OK:
559 			buf = buf->frags;
560 			break;
561 		case NET_CONTINUE:
562 			goto compare;
563 		case NET_DROP:
564 			net_pkt_unref(rxpkt);
565 			goto end;
566 		}
567 	}
568 
569 compare:
570 #if DEBUG > 0
571 	printk("length after reassembly and uncompression %zd\n",
572 	       net_pkt_get_len(rxpkt));
573 	net_pkt_hexdump(rxpkt, "after-uncompression");
574 #endif
575 
576 	if (compare_data(rxpkt, data)) {
577 		result = true;
578 	}
579 
580 end:
581 	if (pkt) {
582 		net_pkt_unref(pkt);
583 	}
584 
585 	if (f_pkt) {
586 		net_pkt_unref(f_pkt);
587 	}
588 
589 	if (rxpkt) {
590 		net_pkt_unref(rxpkt);
591 	}
592 
593 	return result;
594 }
595 
ZTEST(ieee802154_6lo_fragment,test_fragment_sam00_dam00)596 ZTEST(ieee802154_6lo_fragment, test_fragment_sam00_dam00)
597 {
598 	bool ret = test_fragment(&test_data_1);
599 
600 	zassert_true(ret);
601 }
602 
ZTEST(ieee802154_6lo_fragment,test_fragment_sam01_dam01)603 ZTEST(ieee802154_6lo_fragment, test_fragment_sam01_dam01)
604 {
605 	bool ret = test_fragment(&test_data_2);
606 
607 	zassert_true(ret);
608 }
609 
ZTEST(ieee802154_6lo_fragment,test_fragment_sam10_dam10)610 ZTEST(ieee802154_6lo_fragment, test_fragment_sam10_dam10)
611 {
612 	bool ret = test_fragment(&test_data_3);
613 
614 	zassert_true(ret);
615 }
616 
ZTEST(ieee802154_6lo_fragment,test_fragment_sam00_m1_dam00)617 ZTEST(ieee802154_6lo_fragment, test_fragment_sam00_m1_dam00)
618 {
619 	bool ret = test_fragment(&test_data_4);
620 
621 	zassert_true(ret);
622 }
623 
ZTEST(ieee802154_6lo_fragment,test_fragment_sam01_m1_dam01)624 ZTEST(ieee802154_6lo_fragment, test_fragment_sam01_m1_dam01)
625 {
626 	bool ret = test_fragment(&test_data_5);
627 
628 	zassert_true(ret);
629 }
630 
ZTEST(ieee802154_6lo_fragment,test_fragment_sam10_m1_dam10)631 ZTEST(ieee802154_6lo_fragment, test_fragment_sam10_m1_dam10)
632 {
633 	bool ret = test_fragment(&test_data_6);
634 
635 	zassert_true(ret);
636 }
637 
ZTEST(ieee802154_6lo_fragment,test_fragment_ipv6_dispatch_small)638 ZTEST(ieee802154_6lo_fragment, test_fragment_ipv6_dispatch_small)
639 {
640 	bool ret = test_fragment(&test_data_7);
641 
642 	zassert_true(ret);
643 }
644 
ZTEST(ieee802154_6lo_fragment,test_fragment_ipv6_dispatch_big)645 ZTEST(ieee802154_6lo_fragment, test_fragment_ipv6_dispatch_big)
646 {
647 	bool ret = test_fragment(&test_data_8);
648 
649 	zassert_true(ret);
650 }
651 
ZTEST(ieee802154_6lo_fragment,test_fragment_ipv6_no_fragmentation_after_iphc)652 ZTEST(ieee802154_6lo_fragment, test_fragment_ipv6_no_fragmentation_after_iphc)
653 {
654 	bool ret = test_fragment(&test_data_9);
655 
656 	zassert_true(ret);
657 }
658 
659 ZTEST_SUITE(ieee802154_6lo_fragment, NULL, NULL, NULL, NULL, NULL);
660