diff options
| author | Lu Qiuwen <[email protected]> | 2024-02-05 15:56:27 +0800 |
|---|---|---|
| committer | Lu Qiuwen <[email protected]> | 2024-02-05 15:56:27 +0800 |
| commit | 6a8a4fe6a4e28b134696028222d789059a010548 (patch) | |
| tree | 3569de117f521f1c829af23227c84237e7450ac7 | |
| parent | 94534096f851712d0fb46313510679452c474f7e (diff) | |
fix TSG-18849: parse the packet as GTP-U when source port or dest port is 2152.v4.6.74-20240205
| -rw-r--r-- | infra/src/ldbc.c | 36 | ||||
| -rw-r--r-- | infra/test/192.64.164.227_to_192.64.242.189_gtp.pcap | bin | 0 -> 36930 bytes | |||
| -rw-r--r-- | infra/test/TestDistributer.cc | 21 |
3 files changed, 38 insertions, 19 deletions
diff --git a/infra/src/ldbc.c b/infra/src/ldbc.c index 9fac464..7d8fcd1 100644 --- a/infra/src/ldbc.c +++ b/infra/src/ldbc.c @@ -79,7 +79,7 @@ static void packet_parse_icmp6(struct pkt_parser * handler, const struct rte_mbu static void packet_parse_gtpv1_u(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset); static void packet_parse_ef_vxlan(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset); -static void packet_parse_ef_vxlan(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_ef_vxlan(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_G_VXLAN, offset) == PARSE_STOP) { @@ -114,7 +114,7 @@ static void packet_parse_ef_vxlan(struct pkt_parser * handler, const struct rte_ } /* FROM SAPP */ -static int deal_gtp_calc_gtp_hdr_len(const struct rte_mbuf * mbuf, const unsigned int offset) +static inline int deal_gtp_calc_gtp_hdr_len(const struct rte_mbuf * mbuf, const unsigned int offset) { struct gtp_hdr gtp_hdr_copy; const struct gtp_hdr * gtph = rte_pktmbuf_read(mbuf, offset, sizeof(struct gtp_hdr), >p_hdr_copy); @@ -195,7 +195,7 @@ static int deal_gtp_calc_gtp_hdr_len(const struct rte_mbuf * mbuf, const unsigne return ext_hdr_offset - offset; } -static void packet_parse_gtpv1_u(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_gtpv1_u(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_GTPV1_U, offset) == PARSE_STOP) { @@ -231,7 +231,7 @@ static void packet_parse_gtpv1_u(struct pkt_parser * handler, const struct rte_m } } -static void packet_parse_icmp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_icmp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_ICMP, offset) == PARSE_STOP) { @@ -239,7 +239,7 @@ static void packet_parse_icmp(struct pkt_parser * handler, const struct rte_mbuf } } -static void packet_parse_icmp6(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_icmp6(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_ICMP6, offset) == PARSE_STOP) { @@ -247,7 +247,7 @@ static void packet_parse_icmp6(struct pkt_parser * handler, const struct rte_mbu } } -static void packet_parse_tcp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_tcp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_TCP, offset) == PARSE_STOP) { @@ -255,7 +255,7 @@ static void packet_parse_tcp(struct pkt_parser * handler, const struct rte_mbuf } } -static void packet_parse_udp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_udp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_UDP, offset) == PARSE_STOP) { @@ -275,14 +275,14 @@ static void packet_parse_udp(struct pkt_parser * handler, const struct rte_mbuf packet_parse_ef_vxlan(handler, mbuf, offset + sizeof(struct rte_udp_hdr)); return; } - else if (udp_hdr->dst_port == RTE_BE16(GTP1U_PORT)) + else if (udp_hdr->src_port == RTE_BE16(GTP1U_PORT) || udp_hdr->dst_port == RTE_BE16(GTP1U_PORT)) { packet_parse_gtpv1_u(handler, mbuf, offset + sizeof(struct rte_udp_hdr)); return; } } -static void packet_parse_gre(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_gre(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_GRE, offset) == PARSE_STOP) { @@ -323,7 +323,7 @@ static void packet_parse_gre(struct pkt_parser * handler, const struct rte_mbuf } } -static int is_ipv4_fragment(const struct rte_ipv4_hdr * hdr) +static inline int is_ipv4_fragment(const struct rte_ipv4_hdr * hdr) { uint16_t flag_offset, ip_flag, ip_ofs; @@ -334,7 +334,7 @@ static int is_ipv4_fragment(const struct rte_ipv4_hdr * hdr) return ip_flag != 0 || ip_ofs != 0; } -static void packet_parse_ipv4(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_ipv4(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_IPV4, offset) == PARSE_STOP) { @@ -377,7 +377,7 @@ static void packet_parse_ipv4(struct pkt_parser * handler, const struct rte_mbuf } } -static void packet_parse_ipv6(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_ipv6(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_IPV6, offset) == PARSE_STOP) { @@ -411,7 +411,7 @@ static void packet_parse_ipv6(struct pkt_parser * handler, const struct rte_mbuf } } -static void packet_parse_pppoe_ses(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_pppoe_ses(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_PPPOE, offset) == PARSE_STOP) { @@ -445,7 +445,7 @@ static void packet_parse_pppoe_ses(struct pkt_parser * handler, const struct rte } } -static void packet_parse_mpls_uc(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_mpls_uc(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_VLAN, offset) == PARSE_STOP) { @@ -530,7 +530,7 @@ static void packet_parse_mpls_uc(struct pkt_parser * handler, const struct rte_m } } -static void packet_parse_vlan8021q(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_vlan8021q(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_VLAN, offset) == PARSE_STOP) { @@ -574,7 +574,7 @@ static void packet_parse_vlan8021q(struct pkt_parser * handler, const struct rte } } -static void packet_parse_hdlc(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_hdlc(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_HDLC, offset) == PARSE_STOP) { @@ -604,7 +604,7 @@ static void packet_parse_hdlc(struct pkt_parser * handler, const struct rte_mbuf } } -static void packet_parse_ppp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_ppp(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_PPP, offset) == PARSE_STOP) { @@ -633,7 +633,7 @@ static void packet_parse_ppp(struct pkt_parser * handler, const struct rte_mbuf } } -static void packet_parse_ether(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) +static inline void packet_parse_ether(struct pkt_parser * handler, const struct rte_mbuf * mbuf, unsigned int offset) { if (PARSE_CAN_STOP(handler, LAYER_TYPE_ETHER, offset) == PARSE_STOP) { diff --git a/infra/test/192.64.164.227_to_192.64.242.189_gtp.pcap b/infra/test/192.64.164.227_to_192.64.242.189_gtp.pcap Binary files differnew file mode 100644 index 0000000..2cf2339 --- /dev/null +++ b/infra/test/192.64.164.227_to_192.64.242.189_gtp.pcap diff --git a/infra/test/TestDistributer.cc b/infra/test/TestDistributer.cc index 4214849..6efed5a 100644 --- a/infra/test/TestDistributer.cc +++ b/infra/test/TestDistributer.cc @@ -295,7 +295,26 @@ test_table_t testTable[]{ std::make_tuple("10.23.160.163_to_129.226.103.217_gtp_u_in_vxlan.pcap", LDBC_DIST_INNER_TUPLE4, LDBC_HASH_SYM_CRC, "10.23.160.163", "129.226.103.217", 8235, 80), std::make_tuple("10.23.160.163_to_129.226.103.217_gtp_u_in_vxlan.pcap", LDBC_DIST_INNER_TUPLE4, LDBC_HASH_SYM_RSS, - "10.23.160.163", "129.226.103.217", 8235, 80)}; + "10.23.160.163", "129.226.103.217", 8235, 80), + + /* GTP */ + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_OUTER_TUPLE2, LDBC_HASH_SYM_CRC, + "192.64.22.1", "192.64.22.25", 41668, 2152), + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_OUTER_TUPLE2, LDBC_HASH_SYM_RSS, + "192.64.22.1", "192.64.22.25", 41668, 2152), + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_OUTER_TUPLE4, LDBC_HASH_SYM_CRC, + "192.64.22.1", "192.64.22.25", 41668, 2152), + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_OUTER_TUPLE4, LDBC_HASH_SYM_RSS, + "192.64.22.1", "192.64.22.25", 41668, 2152), + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_INNER_TUPLE2, LDBC_HASH_SYM_CRC, + "192.64.164.227", "192.64.242.189", 18765, 80), + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_INNER_TUPLE2, LDBC_HASH_SYM_RSS, + "192.64.164.227", "192.64.242.189", 18765, 80), + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_INNER_TUPLE4, LDBC_HASH_SYM_CRC, + "192.64.164.227", "192.64.242.189", 18765, 80), + std::make_tuple("192.64.164.227_to_192.64.242.189_gtp.pcap", LDBC_DIST_INNER_TUPLE4, LDBC_HASH_SYM_RSS, + "192.64.164.227", "192.64.242.189", 18765, 80) +}; INSTANTIATE_TEST_CASE_P(TestOuterTuple2, TestFixtureDistributer, ::testing::ValuesIn(testTable)); |
