MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_ip_frag

Function test_ip_frag

dpdk/app/test/test_ipfrag.c:314–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314static int
315test_ip_frag(void)
316{
317 static const uint16_t RND_ID = UINT16_MAX;
318 int result = TEST_SUCCESS;
319 size_t i, j;
320
321 struct test_ip_frags {
322 int ipv;
323 size_t mtu_size;
324 size_t pkt_size;
325 int set_df;
326 uint8_t set_mf;
327 uint16_t set_of;
328 uint8_t ttl;
329 uint8_t proto;
330 uint16_t pkt_id;
331 int expected_frags;
332 uint16_t expected_fragment_offset[BURST];
333 bool have_opt;
334 bool is_first_frag;
335 bool opt_copied;
336 } tests[] = {
337 {4, 1280, 1400, 0, 0, 0, 64, IPPROTO_ICMP, RND_ID, 2,
338 {0x2000, 0x009D}, false},
339 {4, 1280, 1400, 0, 0, 0, 64, IPPROTO_ICMP, 0, 2,
340 {0x2000, 0x009D}, false},
341 {4, 600, 1400, 0, 0, 0, 64, IPPROTO_ICMP, RND_ID, 3,
342 {0x2000, 0x2048, 0x0090}, false},
343 {4, 4, 1400, 0, 0, 0, 64, IPPROTO_ICMP, RND_ID, -EINVAL},
344 {4, 600, 1400, 1, 0, 0, 64, IPPROTO_ICMP, RND_ID, -ENOTSUP},
345 {4, 600, 1400, 0, 0, 0, 0, IPPROTO_ICMP, RND_ID, 3,
346 {0x2000, 0x2046, 0x008C}, true, true, true},
347 /* The first fragment */
348 {4, 68, 104, 0, 1, 0, 0, IPPROTO_ICMP, RND_ID, 5,
349 {0x2000, 0x2003, 0x2006, 0x2009, 0x200C}, true, true, true},
350 /* The middle fragment */
351 {4, 68, 104, 0, 1, 13, 0, IPPROTO_ICMP, RND_ID, 3,
352 {0x200D, 0x2012, 0x2017}, true, false, true},
353 /* The last fragment */
354 {4, 68, 104, 0, 0, 26, 0, IPPROTO_ICMP, RND_ID, 3,
355 {0x201A, 0x201F, 0x0024}, true, false, true},
356 /* The first fragment */
357 {4, 68, 104, 0, 1, 0, 0, IPPROTO_ICMP, RND_ID, 4,
358 {0x2000, 0x2004, 0x2008, 0x200C}, true, true, false},
359 /* The middle fragment */
360 {4, 68, 104, 0, 1, 13, 0, IPPROTO_ICMP, RND_ID, 3,
361 {0x200D, 0x2013, 0x2019}, true, false, false},
362 /* The last fragment */
363 {4, 68, 104, 0, 0, 26, 0, IPPROTO_ICMP, RND_ID, 3,
364 {0x201A, 0x2020, 0x0026}, true, false, false},
365 {6, 1280, 1400, 0, 0, 0, 64, IPPROTO_ICMP, RND_ID, 2,
366 {0x0001, 0x04D0}, false},
367 {6, 1300, 1400, 0, 0, 0, 64, IPPROTO_ICMP, RND_ID, 2,
368 {0x0001, 0x04E0}, false},
369 {6, 4, 1400, 0, 0, 0, 64, IPPROTO_ICMP, RND_ID, -EINVAL},
370 {6, 1300, 1400, 0, 0, 0, 0, IPPROTO_ICMP, RND_ID, 2,
371 {0x0001, 0x04E0}, false},

Callers

nothing calls this directly

Calls 15

rte_pktmbuf_allocFunction · 0.85
rte_rand_maxFunction · 0.85
v4_allocate_packet_ofFunction · 0.85
v6_allocate_packet_ofFunction · 0.85
rte_ipv4_fragment_packetFunction · 0.85
rte_ipv6_fragment_packetFunction · 0.85
rte_pktmbuf_freeFunction · 0.85
test_get_offsetFunction · 0.85
test_get_frag_optFunction · 0.85
test_free_fragmentsFunction · 0.85
test_get_ipv4_optFunction · 0.85

Tested by

no test coverage detected