summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLu Qiuwen <[email protected]>2023-08-25 15:44:57 +0800
committerLu Qiuwen <[email protected]>2023-08-25 15:44:57 +0800
commit13716e5dc4af3692a1ac63b2f9f9d447f3095f39 (patch)
treefd269d2e3299bf45e6c076dd426ef44b3f24ba09
parent39eb1356b770ccbd5eb302835cfa7e6fa120cf79 (diff)
支持GRE隧道解析及隧道内层地址分流。v4.6.46-20230825
-rw-r--r--infra/include/ldbc.h16
-rw-r--r--infra/src/ldbc.c57
-rw-r--r--infra/test/TestPacketParser.cc438
3 files changed, 499 insertions, 12 deletions
diff --git a/infra/include/ldbc.h b/infra/include/ldbc.h
index e8e85cf..df52856 100644
--- a/infra/include/ldbc.h
+++ b/infra/include/ldbc.h
@@ -51,6 +51,7 @@ enum complex_layer_type_id
LAYER_TYPE_ID_TCP,
LAYER_TYPE_ID_ICMP,
LAYER_TYPE_ID_ICMP6,
+ LAYER_TYPE_ID_GRE,
LAYER_TYPE_ID_G_VXLAN,
LAYER_TYPE_ID_GTPV1_U,
};
@@ -81,15 +82,16 @@ enum complex_layer_type_mask
LAYER_TYPE_TCP = 1 << 9,
LAYER_TYPE_ICMP = 1 << 10,
LAYER_TYPE_ICMP6 = 1 << 11,
- LAYER_TYPE_L4 = (LAYER_TYPE_UDP | LAYER_TYPE_TCP | LAYER_TYPE_ICMP | LAYER_TYPE_ICMP6),
+ LAYER_TYPE_GRE = 1 << 12,
+ LAYER_TYPE_L4 = (LAYER_TYPE_UDP | LAYER_TYPE_TCP | LAYER_TYPE_ICMP | LAYER_TYPE_ICMP6 | LAYER_TYPE_GRE),
/* 传输层 -- 隧道 */
- LAYER_TYPE_G_VXLAN = 1 << 12,
- LAYER_TYPE_GTPV1_U = 1 << 13,
+ LAYER_TYPE_G_VXLAN = 1 << 13,
+ LAYER_TYPE_GTPV1_U = 1 << 14,
/* ALL */
- LAYER_TYPE_ALL =
- (LAYER_TYPE_L2 | LAYER_TYPE_L2_TUN | LAYER_TYPE_L3 | LAYER_TYPE_L4 | LAYER_TYPE_G_VXLAN | LAYER_TYPE_GTPV1_U),
+ LAYER_TYPE_ALL =(LAYER_TYPE_L2 | LAYER_TYPE_L2_TUN | LAYER_TYPE_L3 |
+ LAYER_TYPE_L4 | LAYER_TYPE_G_VXLAN | LAYER_TYPE_GTPV1_U),
};
#define MR_PKT_PARSER_LAYERS_MAX 16
@@ -287,6 +289,8 @@ static inline uint16_t complex_layer_mask_to_id(enum complex_layer_type_mask thi
return LAYER_TYPE_ID_ICMP;
case LAYER_TYPE_ICMP6:
return LAYER_TYPE_ID_ICMP6;
+ case LAYER_TYPE_GRE:
+ return LAYER_TYPE_ID_GRE;
case LAYER_TYPE_G_VXLAN:
return LAYER_TYPE_ID_G_VXLAN;
case LAYER_TYPE_GTPV1_U:
@@ -324,6 +328,8 @@ static inline enum complex_layer_type_mask complex_layer_id_to_mask(enum complex
return LAYER_TYPE_ICMP;
case LAYER_TYPE_ID_ICMP6:
return LAYER_TYPE_ICMP6;
+ case LAYER_TYPE_ID_GRE:
+ return LAYER_TYPE_GRE;
case LAYER_TYPE_ID_G_VXLAN:
return LAYER_TYPE_G_VXLAN;
case LAYER_TYPE_ID_GTPV1_U:
diff --git a/infra/src/ldbc.c b/infra/src/ldbc.c
index f30c8d8..1f79e6e 100644
--- a/infra/src/ldbc.c
+++ b/infra/src/ldbc.c
@@ -14,8 +14,7 @@
#include <rte_mbuf.h>
#include <rte_tcp.h>
#include <rte_udp.h>
-#include <rte_version.h>
-#include <stdbool.h>
+#include <rte_gre.h>
#include <stdint.h>
#include <string.h>
@@ -58,7 +57,7 @@ static inline int parser_stop_or_continue(struct pkt_parser * handler, const voi
return PARSE_CONTINUE;
}
- /* convert the this layer mask to id */
+ /* convert the layer mask to id */
uint16_t this_layer_type_id = complex_layer_mask_to_id(this_layer_type);
uint16_t offset = RTE_PTR_DIFF(data, handler->ptr_pkt_start);
@@ -261,6 +260,50 @@ static const void * __complex_parser_udp(struct pkt_parser * handler, const void
return NULL;
}
+static const void * __complex_parser_gre(struct pkt_parser * handler, const void * data,
+ enum complex_layer_type_mask this_layer_type)
+{
+ if (parser_stop_or_continue(handler, data, this_layer_type) == PARSE_STOP)
+ return data;
+
+ static const uint8_t opt_len[16] = {
+ [0x0] = 4, [0x1] = 8, [0x2] = 8, [0x8] = 8, [0x3] = 12, [0x9] = 12, [0xa] = 12, [0xb] = 16,
+ };
+
+ struct rte_gre_hdr * gre_hdr = (struct rte_gre_hdr *)data;
+ uint16_t flags = rte_be_to_cpu_16(*(const uint16_t *)gre_hdr);
+ flags >>= 12;
+
+ if (unlikely(opt_len[flags] == 0))
+ {
+ return NULL;
+ }
+
+ void * data_next_layer = (void *)RTE_PTR_ADD(gre_hdr, opt_len[flags]);
+ switch (gre_hdr->proto)
+ {
+ case RTE_BE16(ETH_P_IP):
+ return __complex_parser_ipv4(handler, data_next_layer, LAYER_TYPE_IPV4);
+
+ case RTE_BE16(ETH_P_IPV6):
+ return __complex_parser_ipv6(handler, data_next_layer, LAYER_TYPE_IPV6);
+
+ default:
+ return NULL;
+ }
+}
+
+static int is_ipv4_fragment(const struct rte_ipv4_hdr *hdr)
+{
+ uint16_t flag_offset, ip_flag, ip_ofs;
+
+ flag_offset = rte_be_to_cpu_16(hdr->fragment_offset);
+ ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK);
+ ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG);
+
+ return ip_flag != 0 || ip_ofs != 0;
+}
+
static const void * __complex_parser_ipv4(struct pkt_parser * handler, const void * data,
enum complex_layer_type_mask this_layer_type)
{
@@ -271,6 +314,11 @@ static const void * __complex_parser_ipv4(struct pkt_parser * handler, const voi
unsigned int ipv4_hdr_len = (ipv4_hdr->version_ihl & 0xf) * 4u;
void * data_next_layer = (uint8_t *)data + ipv4_hdr_len;
+ if (is_ipv4_fragment(ipv4_hdr))
+ {
+ return NULL;
+ }
+
switch (ipv4_hdr->next_proto_id)
{
case IPPROTO_TCP:
@@ -282,6 +330,9 @@ static const void * __complex_parser_ipv4(struct pkt_parser * handler, const voi
case IPPROTO_ICMP:
return __complex_parser_icmp(handler, data_next_layer, LAYER_TYPE_ICMP);
+ case IPPROTO_GRE:
+ return __complex_parser_gre(handler, data_next_layer, LAYER_TYPE_GRE);
+
default:
return NULL;
}
diff --git a/infra/test/TestPacketParser.cc b/infra/test/TestPacketParser.cc
index 4d9a5dd..553d2fa 100644
--- a/infra/test/TestPacketParser.cc
+++ b/infra/test/TestPacketParser.cc
@@ -362,8 +362,8 @@ static const unsigned char pkt_gtp_u_ext_v6_v6[174] = {
#define TestCheckIPv4Addr(__ptr, __str_src_addr, __str_dst_addr) \
do { \
struct rte_ipv4_hdr * _ipv4_hdr = (struct rte_ipv4_hdr *)__ptr; \
- struct in_addr _src_in_addr; \
- struct in_addr _dst_in_addr; \
+ struct in_addr _src_in_addr{}; \
+ struct in_addr _dst_in_addr{}; \
\
inet_aton(__str_src_addr, &_src_in_addr); \
inet_aton(__str_dst_addr, &_dst_in_addr); \
@@ -376,8 +376,8 @@ do { \
#define TestCheckIPv6Addr(__ptr, __str_src_addr, __str_dst_addr) \
do { \
struct rte_ipv6_hdr * _ipv6_hdr = (struct rte_ipv6_hdr *)__ptr; \
- struct in6_addr _src_in6_addr; \
- struct in6_addr _dst_in6_addr; \
+ struct in6_addr _src_in6_addr{}; \
+ struct in6_addr _dst_in6_addr{}; \
\
inet_pton(AF_INET6, __str_src_addr, &_src_in6_addr); \
inet_pton(AF_INET6, __str_dst_addr, &_dst_in6_addr); \
@@ -904,6 +904,436 @@ TEST(PacketParseInnerL3, EtherVxlanGTPIPv4TCP)
TestCheckIPv4Addr(layer_data, "216.58.209.132", "10.59.238.65");
}
+
+/*
+ * 1599 04:11:59.446706 85.202.75.36 103.153.116.110 DNS 1029
+ * Standard query response 0x4567 ANY aoc.gov DNSKEY DNSKEY DNSKEY DNSKEY
+ * NS a.gov-servers.net NS b.gov-servers.net NS c.gov-servers.net NS d.gov-servers.net OPT
+ */
+
+/* GRE */
+static const unsigned char _dns_over_gre_1[1029] = {
+ 0x8c, 0x6d, 0x77, 0xff, 0xaa, 0xa7, 0x60, 0xf1, /* .mw...`. */
+ 0x8a, 0x43, 0xd8, 0xb6, 0x08, 0x00, 0x45, 0x00, /* .C....E. */
+ 0x03, 0xf7, 0x45, 0x24, 0x00, 0x00, 0xff, 0x2f, /* ..E$.../ */
+ 0x5f, 0xf2, 0x0a, 0x38, 0xff, 0x2b, 0x0a, 0x38, /* _..8.+.8 */
+ 0xff, 0x25, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00, /* .%....E. */
+ 0x03, 0xdf, 0x1e, 0x41, 0x40, 0x00, 0x2c, 0x11, /* ...A@.,. */
+ 0xaf, 0xd7, 0x55, 0xca, 0x4b, 0x24, 0x67, 0x99, /* ..U.K$g. */
+ 0x74, 0x6e, 0x00, 0x35, 0x0f, 0xf8, 0x03, 0xcb, /* tn.5.... */
+ 0xad, 0x38, 0x45, 0x67, 0x81, 0x80, 0x00, 0x01, /* .8Eg.... */
+ 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x03, 0x61, /* .......a */
+ 0x6f, 0x63, 0x03, 0x67, 0x6f, 0x76, 0x00, 0x00, /* oc.gov.. */
+ 0xff, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x30, 0x00, /* ......0. */
+ 0x01, 0x00, 0x00, 0xd6, 0x87, 0x01, 0x08, 0x01, /* ........ */
+ 0x01, 0x03, 0x08, 0x03, 0x01, 0x00, 0x01, 0xb1, /* ........ */
+ 0xbd, 0xe5, 0xcb, 0xf1, 0xf2, 0xa6, 0xfc, 0x3e, /* .......> */
+ 0x41, 0x62, 0xa3, 0xcc, 0xb0, 0x2b, 0x0b, 0x4e, /* Ab...+.N */
+ 0xd0, 0x21, 0xbb, 0x41, 0x37, 0x89, 0xf0, 0xf2, /* .!.A7... */
+ 0xf9, 0x30, 0x5b, 0xfb, 0x8d, 0x74, 0xbf, 0x70, /* .0[..t.p */
+ 0xb4, 0xaf, 0xbd, 0x6b, 0x21, 0x09, 0x3e, 0x9f, /* ...k!.>. */
+ 0x77, 0x65, 0x0c, 0x64, 0x7c, 0xf2, 0x31, 0x18, /* we.d|.1. */
+ 0x90, 0x6f, 0xba, 0x8c, 0xb8, 0x50, 0xc8, 0x32, /* .o...P.2 */
+ 0xb9, 0xb6, 0x6b, 0xee, 0x16, 0xb9, 0x33, 0xc0, /* ..k...3. */
+ 0xe3, 0x41, 0x9c, 0xa8, 0x73, 0xde, 0xcb, 0xd3, /* .A..s... */
+ 0x36, 0x45, 0x70, 0x91, 0xe3, 0xc8, 0x51, 0xdb, /* 6Ep...Q. */
+ 0xf3, 0x48, 0x2d, 0x44, 0x46, 0x41, 0xdc, 0xc0, /* .H-DFA.. */
+ 0xa1, 0xc9, 0x2f, 0xf3, 0xa3, 0x0b, 0x0e, 0x7f, /* ../..... */
+ 0xff, 0x84, 0x44, 0x47, 0xae, 0x9a, 0x91, 0x53, /* ..DG...S */
+ 0xa3, 0xf1, 0x97, 0x01, 0x6b, 0xe7, 0x85, 0x65, /* ....k..e */
+ 0x50, 0x40, 0xf4, 0x56, 0x04, 0xb2, 0xd9, 0xd0, /* [email protected].... */
+ 0x24, 0x20, 0x77, 0x5a, 0xfe, 0x28, 0x67, 0x86, /* $ wZ.(g. */
+ 0xd4, 0x7a, 0xea, 0xba, 0xb2, 0x53, 0x36, 0x0d, /* .z...S6. */
+ 0x03, 0xb0, 0x0a, 0x3c, 0xd8, 0x80, 0x45, 0xce, /* ...<..E. */
+ 0x2e, 0x80, 0x3a, 0x88, 0xb9, 0x58, 0x69, 0x9a, /* ..:..Xi. */
+ 0x7c, 0x6d, 0x7c, 0x5b, 0xb3, 0xfc, 0x29, 0x7c, /* |m|[..)| */
+ 0x73, 0x48, 0xd3, 0x51, 0x1c, 0xed, 0xbb, 0x87, /* sH.Q.... */
+ 0x22, 0xf0, 0x0e, 0x3f, 0xdc, 0xb2, 0xe0, 0x2d, /* "..?...- */
+ 0x77, 0xde, 0x53, 0x5f, 0xa0, 0xe6, 0xb7, 0x3d, /* w.S_...= */
+ 0x98, 0x0d, 0xfa, 0xb8, 0xa1, 0x30, 0x6e, 0xf1, /* .....0n. */
+ 0x35, 0xfd, 0x1a, 0x01, 0x3d, 0x49, 0xe6, 0xec, /* 5...=I.. */
+ 0x30, 0xd0, 0x01, 0x52, 0x38, 0xaf, 0xd4, 0xd9, /* 0..R8... */
+ 0x4d, 0x2f, 0x28, 0xa3, 0x00, 0x9b, 0xdc, 0x0f, /* M/(..... */
+ 0xac, 0x80, 0x71, 0x9e, 0x7d, 0x01, 0xab, 0x99, /* ..q.}... */
+ 0x08, 0xee, 0xc5, 0x1d, 0xd4, 0xd0, 0xec, 0xe6, /* ........ */
+ 0xba, 0x8b, 0x9b, 0x23, 0x6c, 0xb8, 0xfe, 0x27, /* ...#l..' */
+ 0xc1, 0x97, 0xfc, 0xed, 0xc3, 0xc5, 0x4b, 0x67, /* ......Kg */
+ 0x02, 0x2d, 0xa4, 0xe9, 0x58, 0xe3, 0x5b, 0xc0, /* .-..X.[. */
+ 0x0c, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0xd6, /* ..0..... */
+ 0x87, 0x01, 0x08, 0x01, 0x01, 0x03, 0x08, 0x03, /* ........ */
+ 0x01, 0x00, 0x01, 0xf7, 0x1c, 0x6d, 0xd5, 0xd9, /* .....m.. */
+ 0x0e, 0x5b, 0x50, 0x13, 0x9b, 0x5b, 0x03, 0x6b, /* .[P..[.k */
+ 0xf6, 0x18, 0x49, 0xd4, 0x34, 0x43, 0x44, 0x01, /* ..I.4CD. */
+ 0x0f, 0xfe, 0xdc, 0x5b, 0x5b, 0x99, 0xc9, 0x5e, /* ...[[..^ */
+ 0xb8, 0x7e, 0xee, 0x11, 0x61, 0xf1, 0x28, 0xf7, /* .~..a.(. */
+ 0x24, 0xe3, 0xa8, 0x9c, 0x72, 0x7a, 0x21, 0x85, /* $...rz!. */
+ 0xe5, 0x26, 0xfa, 0xf1, 0x9a, 0x40, 0x1b, 0x3d, /* .&...@.= */
+ 0x45, 0xd5, 0xe6, 0x9e, 0xc1, 0xac, 0x3b, 0x05, /* E.....;. */
+ 0x87, 0xc0, 0x04, 0x73, 0x90, 0xdb, 0x72, 0x9e, /* ...s..r. */
+ 0xe4, 0xc2, 0x19, 0x91, 0x5b, 0x99, 0xd9, 0x86, /* ....[... */
+ 0x7e, 0xc8, 0x27, 0xc2, 0xa1, 0xcd, 0x10, 0xc9, /* ~.'..... */
+ 0x79, 0xfd, 0xc8, 0x5f, 0x49, 0xee, 0x2e, 0x4f, /* y.._I..O */
+ 0xdd, 0x1c, 0x3a, 0xd2, 0xeb, 0xd7, 0xdf, 0x80, /* ..:..... */
+ 0xb4, 0xb3, 0x7d, 0xaf, 0x75, 0xdd, 0x74, 0x74, /* ..}.u.tt */
+ 0x9d, 0x71, 0x36, 0x84, 0x8e, 0x91, 0x37, 0xd3, /* .q6...7. */
+ 0x4d, 0x65, 0x42, 0xbf, 0x37, 0x80, 0x63, 0x4f, /* MeB.7.cO */
+ 0x7b, 0x3f, 0xbd, 0x3a, 0xe6, 0x88, 0x23, 0xf1, /* {?.:..#. */
+ 0xc7, 0x8e, 0x00, 0xdf, 0xc7, 0x4d, 0x95, 0xf0, /* .....M.. */
+ 0xa8, 0x8b, 0xa1, 0x4a, 0x78, 0x72, 0x72, 0xce, /* ...Jxrr. */
+ 0xed, 0x68, 0xdf, 0x1f, 0x3d, 0x42, 0x29, 0x0a, /* .h..=B). */
+ 0xfb, 0xd6, 0x5e, 0x9e, 0xd9, 0x4a, 0x6d, 0x16, /* ..^..Jm. */
+ 0x6d, 0x76, 0x7b, 0x7e, 0x3c, 0xdc, 0xb8, 0x04, /* mv{~<... */
+ 0x1f, 0x27, 0x76, 0x78, 0xad, 0xec, 0x4e, 0x2e, /* .'vx..N. */
+ 0xe8, 0x22, 0x87, 0x2e, 0x4a, 0x3b, 0x7a, 0x6a, /* ."..J;zj */
+ 0x6f, 0x70, 0x55, 0x7a, 0xe9, 0x53, 0x57, 0xb0, /* opUz.SW. */
+ 0xb1, 0x40, 0x22, 0xd9, 0xa7, 0x63, 0x34, 0xcf, /* .@"..c4. */
+ 0x39, 0x0a, 0xfb, 0xa4, 0xf1, 0x8a, 0xa9, 0xdb, /* 9....... */
+ 0x43, 0x0c, 0xc3, 0x49, 0xd7, 0x20, 0x73, 0x45, /* C..I. sE */
+ 0x80, 0x57, 0xb9, 0x41, 0x68, 0xbe, 0x6a, 0x05, /* .W.Ah.j. */
+ 0x51, 0x11, 0x54, 0xb1, 0xa2, 0xc3, 0xc6, 0x17, /* Q.T..... */
+ 0x72, 0x44, 0x7d, 0xe3, 0xf5, 0xf0, 0x2e, 0x0c, /* rD}..... */
+ 0x38, 0xcd, 0x21, 0x19, 0x42, 0xb8, 0x8c, 0x9c, /* 8.!.B... */
+ 0xab, 0x15, 0xfd, 0xc0, 0x0c, 0x00, 0x30, 0x00, /* ......0. */
+ 0x01, 0x00, 0x00, 0xd6, 0x87, 0x00, 0x88, 0x01, /* ........ */
+ 0x00, 0x03, 0x08, 0x03, 0x01, 0x00, 0x01, 0xb1, /* ........ */
+ 0xec, 0x7f, 0x7d, 0x90, 0x6c, 0xad, 0xe4, 0xeb, /* ..}.l... */
+ 0x8a, 0x1f, 0xf7, 0x50, 0x1d, 0xbf, 0x72, 0x8e, /* ...P..r. */
+ 0x3d, 0x91, 0x95, 0x7f, 0xd8, 0xcd, 0x15, 0x54, /* =......T */
+ 0x9a, 0x27, 0xe2, 0xa8, 0xed, 0x78, 0x14, 0x97, /* .'...x.. */
+ 0xc5, 0xca, 0xe6, 0x44, 0x0c, 0xe9, 0x3d, 0xd2, /* ...D..=. */
+ 0xcf, 0x1d, 0xd9, 0x48, 0xb5, 0x5e, 0x42, 0x28, /* ...H.^B( */
+ 0x38, 0x95, 0xdc, 0x81, 0x28, 0xdf, 0xb0, 0x8a, /* 8...(... */
+ 0x0f, 0x29, 0xb0, 0x3b, 0x4b, 0x9f, 0xee, 0x71, /* .).;K..q */
+ 0xb7, 0x02, 0x61, 0x47, 0x8d, 0x90, 0xc9, 0x06, /* ..aG.... */
+ 0x45, 0xfe, 0x6a, 0xeb, 0x46, 0xf6, 0xb3, 0x6f, /* E.j.F..o */
+ 0xde, 0xab, 0xfe, 0xa4, 0x27, 0xaf, 0x7d, 0xf6, /* ....'.}. */
+ 0x54, 0x6e, 0xe5, 0x5a, 0xc9, 0x15, 0x28, 0xf3, /* Tn.Z..(. */
+ 0x95, 0x86, 0x32, 0xc7, 0x34, 0xd8, 0x95, 0xa5, /* ..2.4... */
+ 0x7c, 0xa4, 0x8f, 0xef, 0x5b, 0x8f, 0xd9, 0xfe, /* |...[... */
+ 0xce, 0x21, 0xf1, 0x1c, 0xa1, 0x3b, 0x2e, 0x80, /* .!...;.. */
+ 0x12, 0xee, 0x12, 0x33, 0xe4, 0x1a, 0xc9, 0xc0, /* ...3.... */
+ 0x0c, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, 0xd6, /* ..0..... */
+ 0x87, 0x00, 0x88, 0x01, 0x00, 0x03, 0x08, 0x03, /* ........ */
+ 0x01, 0x00, 0x01, 0xbc, 0x17, 0xad, 0x81, 0xd2, /* ........ */
+ 0xde, 0x60, 0x50, 0xcc, 0x12, 0xcd, 0xbb, 0x8c, /* .`P..... */
+ 0xc6, 0xda, 0x14, 0xb6, 0xe0, 0x7e, 0xfc, 0xcc, /* .....~.. */
+ 0x5d, 0xb8, 0xc3, 0x8f, 0xf3, 0x4c, 0xd6, 0xc0, /* ]....L.. */
+ 0xb4, 0x05, 0x84, 0x0a, 0xdb, 0xf7, 0x28, 0x5c, /* ......(\ */
+ 0x33, 0x93, 0x98, 0xf8, 0x6e, 0x34, 0x27, 0xfe, /* 3...n4'. */
+ 0x79, 0x15, 0x62, 0x14, 0x56, 0x20, 0xb2, 0x16, /* y.b.V .. */
+ 0x03, 0x5c, 0x6f, 0xd9, 0x68, 0xd2, 0xbc, 0x3d, /* .\o.h..= */
+ 0x20, 0xbb, 0x66, 0xfb, 0x01, 0x3d, 0xfa, 0x49, /* .f..=.I */
+ 0x4c, 0xf3, 0xf9, 0x92, 0xb8, 0x4f, 0x10, 0x56, /* L....O.V */
+ 0xd8, 0x9c, 0x6f, 0xb8, 0x78, 0x69, 0x5f, 0xd0, /* ..o.xi_. */
+ 0xe6, 0xc9, 0x2b, 0xfb, 0x68, 0x99, 0xcb, 0x73, /* ..+.h..s */
+ 0xf5, 0x8d, 0xc1, 0x23, 0x95, 0x4d, 0x06, 0x93, /* ...#.M.. */
+ 0xb2, 0x85, 0xcc, 0x68, 0x05, 0x92, 0xf5, 0xae, /* ...h.... */
+ 0x31, 0x13, 0x87, 0xd8, 0x2e, 0x3f, 0x3e, 0x61, /* 1....?>a */
+ 0x71, 0x8f, 0xf0, 0xb2, 0x9c, 0x83, 0x90, 0xbd, /* q....... */
+ 0x76, 0xf1, 0xef, 0xc0, 0x10, 0x00, 0x02, 0x00, /* v....... */
+ 0x01, 0x00, 0x02, 0x69, 0xa5, 0x00, 0x13, 0x01, /* ...i.... */
+ 0x61, 0x0b, 0x67, 0x6f, 0x76, 0x2d, 0x73, 0x65, /* a.gov-se */
+ 0x72, 0x76, 0x65, 0x72, 0x73, 0x03, 0x6e, 0x65, /* rvers.ne */
+ 0x74, 0x00, 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01, /* t....... */
+ 0x00, 0x02, 0x69, 0xa5, 0x00, 0x04, 0x01, 0x62, /* ..i....b */
+ 0xc3, 0x77, 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01, /* .w...... */
+ 0x00, 0x02, 0x69, 0xa5, 0x00, 0x04, 0x01, 0x63, /* ..i....c */
+ 0xc3, 0x77, 0xc0, 0x10, 0x00, 0x02, 0x00, 0x01, /* .w...... */
+ 0x00, 0x02, 0x69, 0xa5, 0x00, 0x04, 0x01, 0x64, /* ..i....d */
+ 0xc3, 0x77, 0x00, 0x00, 0x29, 0x10, 0x00, 0x00, /* .w..)... */
+ 0x00, 0x00, 0x00, 0x00, 0x00 /* ..... */
+};
+
+TEST(PacketParseOuterL3, EtherIPv4GREIPv4)
+{
+ struct pkt_parser _pkt_eth_ipv4_gre_1_handler;
+ struct pkt_parser_result _pkt_eth_ipv4_gre_1_result;
+
+ pkt_parser_init(&_pkt_eth_ipv4_gre_1_handler, &_pkt_eth_ipv4_gre_1_result, LAYER_TYPE_L3, 1);
+ complex_parser_ether(&_pkt_eth_ipv4_gre_1_handler, _dns_over_gre_1);
+
+ struct pkt_parser_result * parser_result = &_pkt_eth_ipv4_gre_1_result;
+ EXPECT_EQ(parser_result->nr_layers, 1);
+
+ struct pkt_layer_result * layer_result = &parser_result->layers[0];
+ EXPECT_EQ(layer_result->type_id, LAYER_TYPE_ID_IPV4);
+ EXPECT_TRUE(layer_result->offset != 0);
+
+ void * layer_data = RTE_PTR_ADD(_dns_over_gre_1, layer_result->offset);
+ TestCheckIPv4Addr(layer_data, "10.56.255.43", "10.56.255.37");
+}
+
+TEST(PacketParseInnerL3, EtherIPv4GREIPv4)
+{
+ struct pkt_parser _pkt_eth_ipv4_gre_1_handler;
+ struct pkt_parser_result _pkt_eth_ipv4_gre_1_result;
+
+ pkt_parser_init(&_pkt_eth_ipv4_gre_1_handler, &_pkt_eth_ipv4_gre_1_result, LAYER_TYPE_L3, 4);
+ complex_parser_ether(&_pkt_eth_ipv4_gre_1_handler, _dns_over_gre_1);
+
+ struct pkt_parser_result * parser_result = &_pkt_eth_ipv4_gre_1_result;
+ EXPECT_EQ(parser_result->nr_layers, 2);
+
+ /* ---------------------------------------------------------------------------------- */
+ struct pkt_layer_result * layer_result = &parser_result->layers[0];
+ EXPECT_EQ(layer_result->type_id, LAYER_TYPE_ID_IPV4);
+ EXPECT_TRUE(layer_result->offset != 0);
+
+ void * layer_data = RTE_PTR_ADD(_dns_over_gre_1, layer_result->offset);
+ TestCheckIPv4Addr(layer_data, "10.56.255.43", "10.56.255.37");
+
+ /* ----------------------------------------------------------------------------------- */
+ layer_result = &parser_result->layers[1];
+ EXPECT_EQ(layer_result->type_id, LAYER_TYPE_ID_IPV4);
+ EXPECT_TRUE(layer_result->offset != 0);
+
+ layer_data = RTE_PTR_ADD(_dns_over_gre_1, layer_result->offset);
+ TestCheckIPv4Addr(layer_data, "85.202.75.36", "103.153.116.110");
+}
+
+static const unsigned char _ip_frag_over_gre[1538] = {
+ 0x8c, 0x6d, 0x77, 0xff, 0xaa, 0xa7, 0x60, 0xf1, /* .mw...`. */
+ 0x8a, 0x43, 0xd8, 0xb6, 0x08, 0x00, 0x45, 0x00, /* .C....E. */
+ 0x05, 0xf4, 0x3b, 0x67, 0x00, 0x00, 0xff, 0x2f, /* ..;g.../ */
+ 0x67, 0xb2, 0x0a, 0x38, 0xff, 0x2b, 0x0a, 0x38, /* g..8.+.8 */
+ 0xff, 0x25, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00, /* .%....E. */
+ 0x05, 0xdc, 0xd7, 0xcc, 0x20, 0x00, 0x33, 0x11, /* .... .3. */
+ 0x70, 0x0b, 0xc8, 0xe1, 0x75, 0x1e, 0x67, 0x99, /* p...u.g. */
+ 0x74, 0xa0, 0x00, 0x35, 0x37, 0xf8, 0x0b, 0xf1, /* t..57... */
+ 0x3c, 0x3f, 0x00, 0x01, 0x81, 0x80, 0x00, 0x01, /* <?...... */
+ 0x00, 0x0e, 0x00, 0x02, 0x00, 0x00, 0x04, 0x68, /* .......h */
+ 0x69, 0x67, 0x69, 0x03, 0x63, 0x6f, 0x6d, 0x00, /* igi.com. */
+ 0x00, 0xff, 0x00, 0x01, 0xc0, 0x0c, 0x00, 0x2e, /* ........ */
+ 0x00, 0x01, 0x00, 0x00, 0x04, 0xde, 0x01, 0x1c, /* ........ */
+ 0x00, 0x02, 0x08, 0x02, 0x00, 0x00, 0x0e, 0x10, /* ........ */
+ 0x64, 0xf2, 0x03, 0xf6, 0x64, 0xde, 0x3d, 0x76, /* d...d.=v */
+ 0x6d, 0xd4, 0x04, 0x68, 0x69, 0x67, 0x69, 0x03, /* m..higi. */
+ 0x63, 0x6f, 0x6d, 0x00, 0x18, 0x69, 0x8c, 0xa7, /* com..i.. */
+ 0xdf, 0x90, 0x2c, 0x5a, 0xa1, 0xfe, 0x47, 0x3d, /* ..,Z..G= */
+ 0xff, 0xe6, 0x89, 0x86, 0x83, 0x36, 0x1d, 0x6e, /* .....6.n */
+ 0xa4, 0x42, 0x6a, 0x0a, 0xd0, 0x71, 0xde, 0x38, /* .Bj..q.8 */
+ 0xda, 0x4a, 0x50, 0x82, 0x9b, 0x56, 0x27, 0xab, /* .JP..V'. */
+ 0x85, 0x17, 0x47, 0x60, 0x91, 0xca, 0xbe, 0x3a, /* ..G`...: */
+ 0x63, 0xf8, 0x2f, 0x52, 0x7d, 0x2e, 0xb3, 0xa6, /* c./R}... */
+ 0xcd, 0xd7, 0x0c, 0x55, 0xb3, 0x96, 0x4d, 0x03, /* ...U..M. */
+ 0xf3, 0x6d, 0xaf, 0x8b, 0x8a, 0x4f, 0x4f, 0x96, /* .m...OO. */
+ 0xde, 0x50, 0xb3, 0xdf, 0x7a, 0xfe, 0xd4, 0xe3, /* .P..z... */
+ 0x0e, 0xc9, 0xbe, 0xc5, 0xbe, 0x21, 0xf9, 0xe3, /* .....!.. */
+ 0x87, 0xe2, 0x6a, 0x0d, 0x3f, 0xfa, 0xc5, 0xe1, /* ..j.?... */
+ 0x2c, 0x62, 0x99, 0xff, 0xb7, 0x30, 0x9b, 0x5b, /* ,b...0.[ */
+ 0xb0, 0x01, 0xc5, 0x56, 0x30, 0x1b, 0x3f, 0x68, /* ...V0.?h */
+ 0xdd, 0xec, 0x7d, 0xf1, 0x9a, 0xec, 0xdd, 0xbd, /* ..}..... */
+ 0x44, 0x7e, 0xfc, 0x8e, 0x63, 0x9b, 0x5c, 0x35, /* D~..c.\5 */
+ 0xc7, 0x3b, 0xf5, 0x2f, 0x47, 0x49, 0xae, 0xb4, /* .;./GI.. */
+ 0x9d, 0xf0, 0x8b, 0x9e, 0xa1, 0xe3, 0x88, 0xa1, /* ........ */
+ 0xcd, 0xb6, 0x7f, 0x2c, 0x9c, 0x2a, 0x9b, 0xa4, /* ...,.*.. */
+ 0x34, 0x40, 0x8a, 0xf5, 0xc0, 0x90, 0xaf, 0x0b, /* 4@...... */
+ 0xcb, 0x0f, 0x41, 0x44, 0xb0, 0xa0, 0x88, 0x2f, /* ..AD.../ */
+ 0x20, 0x65, 0x0e, 0x1c, 0x47, 0x61, 0xef, 0x2b, /* e..Ga.+ */
+ 0xee, 0x3e, 0x2a, 0xd9, 0x97, 0x24, 0xc6, 0xb8, /* .>*..$.. */
+ 0x39, 0x23, 0x7e, 0x8f, 0xdf, 0x74, 0x05, 0xbe, /* 9#~..t.. */
+ 0x1b, 0x5c, 0xad, 0x4c, 0x12, 0x27, 0xad, 0x68, /* .\.L.'.h */
+ 0xb2, 0x5d, 0x86, 0xf9, 0x7d, 0x11, 0x58, 0x24, /* .]..}.X$ */
+ 0xce, 0xbb, 0xf3, 0x4e, 0x53, 0xb1, 0xe4, 0xda, /* ...NS... */
+ 0x5b, 0x29, 0xa4, 0xb2, 0x53, 0xdf, 0xe4, 0xd2, /* [)..S... */
+ 0xc3, 0x6c, 0x3c, 0xd3, 0x14, 0xd9, 0x22, 0xe9, /* .l<...". */
+ 0x8e, 0xc7, 0xd8, 0x3e, 0xbf, 0x73, 0x20, 0x64, /* ...>.s d */
+ 0x56, 0x45, 0x35, 0x59, 0xc8, 0xec, 0x92, 0xcd, /* VE5Y.... */
+ 0xdd, 0x66, 0x2d, 0xc0, 0x24, 0x41, 0x08, 0x04, /* .f-.$A.. */
+ 0x69, 0x08, 0x79, 0xca, 0xc0, 0x0c, 0x00, 0x3b, /* i.y....; */
+ 0x00, 0x01, 0x00, 0x00, 0x04, 0xde, 0x00, 0x24, /* .......$ */
+ 0xd4, 0x2f, 0x08, 0x02, 0x8c, 0xe3, 0x87, 0xcd, /* ./...... */
+ 0xa1, 0xa9, 0x54, 0x80, 0xfb, 0xc2, 0xc9, 0x6a, /* ..T....j */
+ 0xaf, 0x69, 0x78, 0xd1, 0x6d, 0x6e, 0x99, 0x82, /* .ix.mn.. */
+ 0xdb, 0xb1, 0x6d, 0x6e, 0xb0, 0xb5, 0x66, 0x1d, /* ..mn..f. */
+ 0x85, 0x06, 0xdb, 0x55, 0xc0, 0x0c, 0x00, 0x3b, /* ...U...; */
+ 0x00, 0x01, 0x00, 0x00, 0x04, 0xde, 0x00, 0x24, /* .......$ */
+ 0xe8, 0x54, 0x08, 0x02, 0x4c, 0x07, 0xe7, 0xb0, /* .T..L... */
+ 0x90, 0xe9, 0xb5, 0x5d, 0x65, 0xa4, 0x8e, 0x56, /* ...]e..V */
+ 0xcc, 0x74, 0x88, 0x06, 0xaf, 0x4a, 0xc8, 0xae, /* .t...J.. */
+ 0x34, 0x9b, 0x31, 0x8c, 0x1d, 0x8a, 0x70, 0x45, /* 4.1...pE */
+ 0xe3, 0xbb, 0x20, 0xc2, 0xc0, 0x0c, 0x00, 0x3c, /* .. ....< */
+ 0x00, 0x01, 0x00, 0x00, 0x04, 0xde, 0x01, 0x08, /* ........ */
+ 0x01, 0x01, 0x03, 0x08, 0x03, 0x01, 0x00, 0x01, /* ........ */
+ 0xba, 0x3d, 0x77, 0x76, 0xe2, 0xbb, 0xf1, 0x7f, /* .=wv.... */
+ 0xd1, 0xbc, 0x34, 0x1a, 0xe6, 0x49, 0x13, 0x00, /* ..4..I.. */
+ 0xe6, 0xac, 0xfa, 0xa9, 0xb5, 0xe4, 0xa2, 0x64, /* .......d */
+ 0x4f, 0xe4, 0x51, 0xa8, 0x8c, 0x19, 0x83, 0xe8, /* O.Q..... */
+ 0xb9, 0xc1, 0xf1, 0x09, 0xa9, 0x11, 0x0c, 0xcc, /* ........ */
+ 0x60, 0x28, 0xc2, 0x71, 0x85, 0x70, 0xa7, 0x70, /* `(.q.p.p */
+ 0x39, 0x4b, 0xab, 0xc1, 0x67, 0xb8, 0xc6, 0x81, /* 9K..g... */
+ 0x58, 0xe5, 0xa3, 0x93, 0xb1, 0xa5, 0xb9, 0x60, /* X......` */
+ 0x92, 0x9b, 0xca, 0x76, 0x27, 0x51, 0x36, 0xb0, /* ...v'Q6. */
+ 0x66, 0xc5, 0xee, 0xb2, 0x35, 0xe1, 0x86, 0x09, /* f...5... */
+ 0x15, 0x4a, 0x3e, 0x98, 0xaf, 0x16, 0xdc, 0xac, /* .J>..... */
+ 0xf6, 0x26, 0x39, 0x75, 0xe4, 0x60, 0x36, 0xa2, /* .&9u.`6. */
+ 0x30, 0x26, 0xc3, 0xf9, 0xb1, 0x95, 0xcf, 0x2f, /* 0&...../ */
+ 0x83, 0xbe, 0xe6, 0x65, 0x59, 0x97, 0xab, 0x95, /* ...eY... */
+ 0xa9, 0x1a, 0xab, 0xa3, 0x27, 0x8c, 0x4e, 0xa9, /* ....'.N. */
+ 0x06, 0xaf, 0xb5, 0xbb, 0xb9, 0x5f, 0xaa, 0x5e, /* ....._.^ */
+ 0x42, 0x5c, 0x0d, 0xf4, 0x0a, 0xc2, 0x06, 0x68, /* B\.....h */
+ 0x52, 0xe2, 0x99, 0xb5, 0x5e, 0xa5, 0x1b, 0x06, /* R...^... */
+ 0x3d, 0x2d, 0x5a, 0x3a, 0x65, 0x01, 0x20, 0x5e, /* =-Z:e. ^ */
+ 0xce, 0xca, 0x69, 0xcb, 0x1f, 0x35, 0x00, 0x32, /* ..i..5.2 */
+ 0x40, 0x17, 0xd3, 0xd2, 0xa4, 0x10, 0xd9, 0x9a, /* @....... */
+ 0x2e, 0xcf, 0x1e, 0x2f, 0x8b, 0x81, 0xda, 0x1b, /* .../.... */
+ 0xff, 0x2a, 0x1a, 0x04, 0x20, 0x20, 0xff, 0xd8, /* .*.. .. */
+ 0x82, 0x29, 0x7c, 0xbc, 0xdb, 0x96, 0xc3, 0x8f, /* .)|..... */
+ 0xcf, 0xcb, 0xf0, 0x68, 0xca, 0x19, 0xf8, 0x22, /* ...h..." */
+ 0x0e, 0x4b, 0x8f, 0xad, 0x7c, 0x41, 0xd4, 0x51, /* .K..|A.Q */
+ 0xd0, 0x65, 0xa7, 0x47, 0x6f, 0xda, 0xca, 0x73, /* .e.Go..s */
+ 0xe4, 0x6a, 0xb7, 0x2d, 0x21, 0xe8, 0x5c, 0xd3, /* .j.-!.\. */
+ 0xcd, 0x78, 0x97, 0x07, 0x10, 0x0b, 0x9e, 0xd4, /* .x...... */
+ 0x2f, 0x17, 0xa6, 0xd3, 0x28, 0x33, 0x59, 0xee, /* /...(3Y. */
+ 0xde, 0x6d, 0x8f, 0x88, 0x68, 0x61, 0x0f, 0x3c, /* .m..ha.< */
+ 0x89, 0x57, 0x1b, 0xb8, 0x08, 0xe5, 0x57, 0xbf, /* .W....W. */
+ 0xc0, 0x0c, 0x00, 0x3c, 0x00, 0x01, 0x00, 0x00, /* ...<.... */
+ 0x04, 0xde, 0x01, 0x08, 0x01, 0x01, 0x03, 0x08, /* ........ */
+ 0x03, 0x01, 0x00, 0x01, 0xb7, 0x53, 0xe6, 0xad, /* .....S.. */
+ 0x9b, 0x11, 0x83, 0x98, 0x24, 0xcb, 0x2a, 0xf7, /* ....$.*. */
+ 0x6b, 0xea, 0x00, 0x0e, 0x9a, 0x3a, 0xb3, 0x01, /* k....:.. */
+ 0x7b, 0x01, 0x42, 0x57, 0x9b, 0x9d, 0x1a, 0x1e, /* {.BW.... */
+ 0x61, 0xfd, 0xc5, 0x34, 0x7b, 0xa8, 0xf1, 0x46, /* a..4{..F */
+ 0x5c, 0x6b, 0xce, 0x0c, 0x9f, 0x5b, 0x45, 0xc8, /* \k...[E. */
+ 0xd9, 0x37, 0x06, 0x88, 0x5f, 0xbe, 0x80, 0xc8, /* .7.._... */
+ 0x02, 0x02, 0xad, 0xda, 0xa0, 0xd6, 0x22, 0x70, /* ......"p */
+ 0xf5, 0x27, 0x19, 0xb1, 0xc4, 0x15, 0xe0, 0x36, /* .'.....6 */
+ 0xc0, 0xec, 0x96, 0xc9, 0x0b, 0xc9, 0x51, 0x71, /* ......Qq */
+ 0xd8, 0xfc, 0x6e, 0x1d, 0x74, 0x2e, 0x38, 0xbe, /* ..n.t.8. */
+ 0x8b, 0xa5, 0x80, 0xec, 0x34, 0x07, 0x51, 0x03, /* ....4.Q. */
+ 0x68, 0xab, 0x8e, 0x29, 0x3d, 0x03, 0x88, 0x9e, /* h..)=... */
+ 0x7d, 0x57, 0x9f, 0xac, 0x1c, 0xb4, 0x9a, 0x84, /* }W...... */
+ 0x0b, 0x3e, 0x8a, 0x32, 0xf3, 0x66, 0xfb, 0x04, /* .>.2.f.. */
+ 0xad, 0xb9, 0x0c, 0x6b, 0x0c, 0x7c, 0x52, 0x8a, /* ...k.|R. */
+ 0xa7, 0xc4, 0xe9, 0x33, 0x7b, 0x72, 0xb6, 0x26, /* ...3{r.& */
+ 0x5b, 0x58, 0x75, 0xd4, 0xf4, 0x41, 0xbf, 0xa2, /* [Xu..A.. */
+ 0x13, 0x9d, 0x33, 0xcc, 0x62, 0x3d, 0x83, 0xd6, /* ..3.b=.. */
+ 0x11, 0x3d, 0xd9, 0x73, 0xeb, 0x8c, 0x01, 0x2a, /* .=.s...* */
+ 0x09, 0xe2, 0x43, 0xa6, 0x84, 0x86, 0xec, 0x26, /* ..C....& */
+ 0x1f, 0x7d, 0x1b, 0xa9, 0xde, 0xb7, 0x9a, 0x4b, /* .}.....K */
+ 0x9b, 0x2d, 0x59, 0xb5, 0x0a, 0xa0, 0x34, 0x71, /* .-Y...4q */
+ 0x27, 0x3a, 0xfc, 0x68, 0x38, 0xdb, 0xfa, 0x6a, /* ':.h8..j */
+ 0x46, 0x5e, 0x27, 0x07, 0x00, 0x15, 0x2a, 0x40, /* F^'...*@ */
+ 0xd1, 0x84, 0xdb, 0xae, 0x7e, 0xc1, 0x11, 0x70, /* ....~..p */
+ 0x1f, 0xa0, 0x87, 0x2a, 0xb6, 0x85, 0x50, 0xde, /* ...*..P. */
+ 0xd2, 0xa8, 0xbc, 0x6d, 0xc4, 0xe3, 0x82, 0x4f, /* ...m...O */
+ 0x62, 0xd2, 0x28, 0x12, 0xda, 0x72, 0xd0, 0xba, /* b.(..r.. */
+ 0xe1, 0x60, 0xeb, 0xa9, 0x2d, 0x2e, 0x42, 0x28, /* .`..-.B( */
+ 0xeb, 0x31, 0xb4, 0x1b, 0xb7, 0x1e, 0x4d, 0x65, /* .1....Me */
+ 0x2d, 0x9e, 0x4d, 0xfc, 0x1a, 0x62, 0x75, 0xd0, /* -.M..bu. */
+ 0x4d, 0xac, 0xa2, 0xd9, 0xc0, 0x0c, 0x00, 0x30, /* M......0 */
+ 0x00, 0x01, 0x00, 0x00, 0x04, 0xde, 0x01, 0x08, /* ........ */
+ 0x01, 0x01, 0x03, 0x08, 0x03, 0x01, 0x00, 0x01, /* ........ */
+ 0xb7, 0x53, 0xe6, 0xad, 0x9b, 0x11, 0x83, 0x98, /* .S...... */
+ 0x24, 0xcb, 0x2a, 0xf7, 0x6b, 0xea, 0x00, 0x0e, /* $.*.k... */
+ 0x9a, 0x3a, 0xb3, 0x01, 0x7b, 0x01, 0x42, 0x57, /* .:..{.BW */
+ 0x9b, 0x9d, 0x1a, 0x1e, 0x61, 0xfd, 0xc5, 0x34, /* ....a..4 */
+ 0x7b, 0xa8, 0xf1, 0x46, 0x5c, 0x6b, 0xce, 0x0c, /* {..F\k.. */
+ 0x9f, 0x5b, 0x45, 0xc8, 0xd9, 0x37, 0x06, 0x88, /* .[E..7.. */
+ 0x5f, 0xbe, 0x80, 0xc8, 0x02, 0x02, 0xad, 0xda, /* _....... */
+ 0xa0, 0xd6, 0x22, 0x70, 0xf5, 0x27, 0x19, 0xb1, /* .."p.'.. */
+ 0xc4, 0x15, 0xe0, 0x36, 0xc0, 0xec, 0x96, 0xc9, /* ...6.... */
+ 0x0b, 0xc9, 0x51, 0x71, 0xd8, 0xfc, 0x6e, 0x1d, /* ..Qq..n. */
+ 0x74, 0x2e, 0x38, 0xbe, 0x8b, 0xa5, 0x80, 0xec, /* t.8..... */
+ 0x34, 0x07, 0x51, 0x03, 0x68, 0xab, 0x8e, 0x29, /* 4.Q.h..) */
+ 0x3d, 0x03, 0x88, 0x9e, 0x7d, 0x57, 0x9f, 0xac, /* =...}W.. */
+ 0x1c, 0xb4, 0x9a, 0x84, 0x0b, 0x3e, 0x8a, 0x32, /* .....>.2 */
+ 0xf3, 0x66, 0xfb, 0x04, 0xad, 0xb9, 0x0c, 0x6b, /* .f.....k */
+ 0x0c, 0x7c, 0x52, 0x8a, 0xa7, 0xc4, 0xe9, 0x33, /* .|R....3 */
+ 0x7b, 0x72, 0xb6, 0x26, 0x5b, 0x58, 0x75, 0xd4, /* {r.&[Xu. */
+ 0xf4, 0x41, 0xbf, 0xa2, 0x13, 0x9d, 0x33, 0xcc, /* .A....3. */
+ 0x62, 0x3d, 0x83, 0xd6, 0x11, 0x3d, 0xd9, 0x73, /* b=...=.s */
+ 0xeb, 0x8c, 0x01, 0x2a, 0x09, 0xe2, 0x43, 0xa6, /* ...*..C. */
+ 0x84, 0x86, 0xec, 0x26, 0x1f, 0x7d, 0x1b, 0xa9, /* ...&.}.. */
+ 0xde, 0xb7, 0x9a, 0x4b, 0x9b, 0x2d, 0x59, 0xb5, /* ...K.-Y. */
+ 0x0a, 0xa0, 0x34, 0x71, 0x27, 0x3a, 0xfc, 0x68, /* ..4q':.h */
+ 0x38, 0xdb, 0xfa, 0x6a, 0x46, 0x5e, 0x27, 0x07, /* 8..jF^'. */
+ 0x00, 0x15, 0x2a, 0x40, 0xd1, 0x84, 0xdb, 0xae, /* ..*@.... */
+ 0x7e, 0xc1, 0x11, 0x70, 0x1f, 0xa0, 0x87, 0x2a, /* ~..p...* */
+ 0xb6, 0x85, 0x50, 0xde, 0xd2, 0xa8, 0xbc, 0x6d, /* ..P....m */
+ 0xc4, 0xe3, 0x82, 0x4f, 0x62, 0xd2, 0x28, 0x12, /* ...Ob.(. */
+ 0xda, 0x72, 0xd0, 0xba, 0xe1, 0x60, 0xeb, 0xa9, /* .r...`.. */
+ 0x2d, 0x2e, 0x42, 0x28, 0xeb, 0x31, 0xb4, 0x1b, /* -.B(.1.. */
+ 0xb7, 0x1e, 0x4d, 0x65, 0x2d, 0x9e, 0x4d, 0xfc, /* ..Me-.M. */
+ 0x1a, 0x62, 0x75, 0xd0, 0x4d, 0xac, 0xa2, 0xd9, /* .bu.M... */
+ 0xc0, 0x0c, 0x00, 0x30, 0x00, 0x01, 0x00, 0x00, /* ...0.... */
+ 0x04, 0xde, 0x01, 0x08, 0x01, 0x01, 0x03, 0x08, /* ........ */
+ 0x03, 0x01, 0x00, 0x01, 0xba, 0x3d, 0x77, 0x76, /* .....=wv */
+ 0xe2, 0xbb, 0xf1, 0x7f, 0xd1, 0xbc, 0x34, 0x1a, /* ......4. */
+ 0xe6, 0x49, 0x13, 0x00, 0xe6, 0xac, 0xfa, 0xa9, /* .I...... */
+ 0xb5, 0xe4, 0xa2, 0x64, 0x4f, 0xe4, 0x51, 0xa8, /* ...dO.Q. */
+ 0x8c, 0x19, 0x83, 0xe8, 0xb9, 0xc1, 0xf1, 0x09, /* ........ */
+ 0xa9, 0x11, 0x0c, 0xcc, 0x60, 0x28, 0xc2, 0x71, /* ....`(.q */
+ 0x85, 0x70, 0xa7, 0x70, 0x39, 0x4b, 0xab, 0xc1, /* .p.p9K.. */
+ 0x67, 0xb8, 0xc6, 0x81, 0x58, 0xe5, 0xa3, 0x93, /* g...X... */
+ 0xb1, 0xa5, 0xb9, 0x60, 0x92, 0x9b, 0xca, 0x76, /* ...`...v */
+ 0x27, 0x51, 0x36, 0xb0, 0x66, 0xc5, 0xee, 0xb2, /* 'Q6.f... */
+ 0x35, 0xe1, 0x86, 0x09, 0x15, 0x4a, 0x3e, 0x98, /* 5....J>. */
+ 0xaf, 0x16, 0xdc, 0xac, 0xf6, 0x26, 0x39, 0x75, /* .....&9u */
+ 0xe4, 0x60, 0x36, 0xa2, 0x30, 0x26, 0xc3, 0xf9, /* .`6.0&.. */
+ 0xb1, 0x95, 0xcf, 0x2f, 0x83, 0xbe, 0xe6, 0x65, /* .../...e */
+ 0x59, 0x97, 0xab, 0x95, 0xa9, 0x1a, 0xab, 0xa3, /* Y....... */
+ 0x27, 0x8c, 0x4e, 0xa9, 0x06, 0xaf, 0xb5, 0xbb, /* '.N..... */
+ 0xb9, 0x5f, 0xaa, 0x5e, 0x42, 0x5c, 0x0d, 0xf4, /* ._.^B\.. */
+ 0x0a, 0xc2, 0x06, 0x68, 0x52, 0xe2, 0x99, 0xb5, /* ...hR... */
+ 0x5e, 0xa5, 0x1b, 0x06, 0x3d, 0x2d, 0x5a, 0x3a, /* ^...=-Z: */
+ 0x65, 0x01, 0x20, 0x5e, 0xce, 0xca, 0x69, 0xcb, /* e. ^..i. */
+ 0x1f, 0x35, 0x00, 0x32, 0x40, 0x17, 0xd3, 0xd2, /* .5.2@... */
+ 0xa4, 0x10, 0xd9, 0x9a, 0x2e, 0xcf, 0x1e, 0x2f, /* ......./ */
+ 0x8b, 0x81, 0xda, 0x1b, 0xff, 0x2a, 0x1a, 0x04, /* .....*.. */
+ 0x20, 0x20, 0xff, 0xd8, 0x82, 0x29, 0x7c, 0xbc, /* ...)|. */
+ 0xdb, 0x96, 0xc3, 0x8f, 0xcf, 0xcb, 0xf0, 0x68, /* .......h */
+ 0xca, 0x19, 0xf8, 0x22, 0x0e, 0x4b, 0x8f, 0xad, /* ...".K.. */
+ 0x7c, 0x41 /* |A */
+};
+
+TEST(PacketParseOuterL3, EtherIPv4GREIPv4Frag)
+{
+ struct pkt_parser _pkt_eth_ipv4_gre_ipv4_frag_1_handler;
+ struct pkt_parser_result _pkt_eth_ipv4_gre_ipv4_frag_1_result;
+
+ pkt_parser_init(&_pkt_eth_ipv4_gre_ipv4_frag_1_handler, &_pkt_eth_ipv4_gre_ipv4_frag_1_result, LAYER_TYPE_L3, 1);
+ complex_parser_ether(&_pkt_eth_ipv4_gre_ipv4_frag_1_handler, _ip_frag_over_gre);
+
+ struct pkt_parser_result * parser_result = &_pkt_eth_ipv4_gre_ipv4_frag_1_result;
+ EXPECT_EQ(parser_result->nr_layers, 1);
+
+ struct pkt_layer_result * layer_result = &parser_result->layers[0];
+ EXPECT_EQ(layer_result->type_id, LAYER_TYPE_ID_IPV4);
+ EXPECT_TRUE(layer_result->offset != 0);
+
+ void * layer_data = RTE_PTR_ADD(_ip_frag_over_gre, layer_result->offset);
+ TestCheckIPv4Addr(layer_data, "10.56.255.43", "10.56.255.37");
+}
+
+TEST(PacketParseInnerL3, EtherIPv4GREIPv4Frag)
+{
+ struct pkt_parser _pkt_eth_ipv4_gre_ipv4_frag_1_handler;
+ struct pkt_parser_result _pkt_eth_ipv4_gre_ipv4_frag_1_result;
+
+ pkt_parser_init(&_pkt_eth_ipv4_gre_ipv4_frag_1_handler, &_pkt_eth_ipv4_gre_ipv4_frag_1_result, LAYER_TYPE_L3, 4);
+ complex_parser_ether(&_pkt_eth_ipv4_gre_ipv4_frag_1_handler, _ip_frag_over_gre);
+
+ struct pkt_parser_result * parser_result = &_pkt_eth_ipv4_gre_ipv4_frag_1_result;
+ EXPECT_EQ(parser_result->nr_layers, 2);
+
+ /* ---------------------------------------------------------------------------------- */
+ struct pkt_layer_result * layer_result = &parser_result->layers[0];
+ EXPECT_EQ(layer_result->type_id, LAYER_TYPE_ID_IPV4);
+ EXPECT_TRUE(layer_result->offset != 0);
+
+ void * layer_data = RTE_PTR_ADD(_ip_frag_over_gre, layer_result->offset);
+ TestCheckIPv4Addr(layer_data, "10.56.255.43", "10.56.255.37");
+
+ /* ----------------------------------------------------------------------------------- */
+ layer_result = &parser_result->layers[1];
+ EXPECT_EQ(layer_result->type_id, LAYER_TYPE_ID_IPV4);
+ EXPECT_TRUE(layer_result->offset != 0);
+
+ layer_data = RTE_PTR_ADD(_ip_frag_over_gre, layer_result->offset);
+ TestCheckIPv4Addr(layer_data, "200.225.117.30", "103.153.116.160");
+}
+
#if 0
TEST(DistributerInner4, EtherIPv4VxLANIPv4TCP)
{