@@ -424,6 +424,18 @@ static const uint8_t test_packet_ipv4_udp_last_frag[] = {
0x2E
};
+/* IPv4 / Record Route + NOP options / ICMP */
+static const uint8_t test_packet_ipv4_rr_nop_icmp[] = {
+ 0x02, 0x00, 0x00, 0x04, 0x05, 0x06, 0x02, 0x00,
+ 0x00, 0x01, 0x02, 0x03, 0x08, 0x00, 0x49, 0x00,
+ 0x00, 0x2C, 0x00, 0x01, 0x00, 0x00, 0x40, 0x01,
+ 0x8E, 0xE2, 0xC0, 0xA8, 0x00, 0x01, 0xC0, 0xA8,
+ 0x00, 0x02, 0x07, 0x0F, 0x0C, 0xC0, 0xA8, 0x04,
+ 0x01, 0xC0, 0xA8, 0x05, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x08, 0x00, 0xF7, 0xFF, 0x00, 0x00,
+ 0x00, 0x00
+};
+
#ifdef __cplusplus
}
#endif
@@ -70,7 +70,8 @@ static uint32_t parse_test_pkt_len[] = {
sizeof(test_packet_bcast_eth_ipv4_udp),
sizeof(test_packet_mcast_eth_ipv6_udp),
sizeof(test_packet_ipv4_udp_first_frag),
- sizeof(test_packet_ipv4_udp_last_frag)
+ sizeof(test_packet_ipv4_udp_last_frag),
+ sizeof(test_packet_ipv4_rr_nop_icmp)
};
#define packet_compare_offset(pkt1, off1, pkt2, off2, len) \
@@ -3223,6 +3224,39 @@ static void parse_eth_ipv4_udp_last_frag(void)
odp_packet_free_multi(pkt, num_pkt);
}
+/* Ethernet/IPv4 + options (Record route, NOP)/ICMP */
+static void parse_eth_ipv4_rr_nop_icmp(void)
+{
+ odp_packet_parse_param_t parse;
+ int i;
+ int num_pkt = PARSE_TEST_NUM_PKT;
+ odp_packet_t pkt[num_pkt];
+
+ parse_test_alloc(pkt, test_packet_ipv4_rr_nop_icmp,
+ sizeof(test_packet_ipv4_rr_nop_icmp));
+
+ parse.proto = ODP_PROTO_ETH;
+ parse.last_layer = ODP_PROTO_LAYER_L4;
+ parse.chksums.all_chksum = 0;
+
+ CU_ASSERT(odp_packet_parse(pkt[0], 0, &parse) == 0);
+ CU_ASSERT(odp_packet_parse_multi(&pkt[1], parse_test.offset_zero,
+ num_pkt - 1, &parse) == (num_pkt - 1));
+
+ for (i = 0; i < num_pkt; i++) {
+ CU_ASSERT(odp_packet_has_eth(pkt[i]));
+ CU_ASSERT(odp_packet_has_ipv4(pkt[i]));
+ CU_ASSERT(odp_packet_has_ipopt(pkt[i]));
+ CU_ASSERT(odp_packet_has_icmp(pkt[i]));
+ CU_ASSERT(!odp_packet_has_ipfrag(pkt[i]));
+ CU_ASSERT(!odp_packet_has_ipv6(pkt[i]));
+ CU_ASSERT(!odp_packet_has_udp(pkt[i]));
+ CU_ASSERT(!odp_packet_has_tcp(pkt[i]));
+ }
+
+ odp_packet_free_multi(pkt, num_pkt);
+}
+
odp_testinfo_t packet_suite[] = {
ODP_TEST_INFO(packet_test_alloc_free),
ODP_TEST_INFO(packet_test_alloc_free_multi),
@@ -3279,6 +3313,7 @@ odp_testinfo_t packet_parse_suite[] = {
ODP_TEST_INFO(parse_mcast_eth_ipv6_udp),
ODP_TEST_INFO(parse_eth_ipv4_udp_first_frag),
ODP_TEST_INFO(parse_eth_ipv4_udp_last_frag),
+ ODP_TEST_INFO(parse_eth_ipv4_rr_nop_icmp),
ODP_TEST_INFO_NULL,
};