From d20b3f8b33e960317ac3fa4be87d0a46191bf103 Mon Sep 17 00:00:00 2001 From: wangmenglan Date: Tue, 19 Mar 2024 17:53:26 +0800 Subject: 调整解析GTP-U协议 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/packet.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/common/src/packet.cpp b/common/src/packet.cpp index b96edcc..4428f65 100644 --- a/common/src/packet.cpp +++ b/common/src/packet.cpp @@ -945,19 +945,20 @@ static inline const char *parse_udp(struct packet *handler, const char *data, ui struct udphdr *hdr = (struct udphdr *)data; SET_LAYER(handler, layer, LAYER_TYPE_UDP, sizeof(struct udphdr), data, len); - switch (ntohs(hdr->uh_dport)) + // VXLAN_DPORT 4789 + if (ntohs(hdr->uh_dport) == 4789) { - // TESTED - // VXLAN_DPORT - case 4789: return parse_vxlan(handler, layer->pld_ptr, layer->pld_len); - // TESTED - // GTP1U_PORT - case 2152: + } + + // GTP1U_PORT 2152 + if (ntohs(hdr->uh_dport) == 2152 || ntohs(hdr->uh_sport) == 2152) + { return parse_gtpv1_u(handler, layer->pld_ptr, layer->pld_len); - default: - return layer->pld_ptr; } + + return layer->pld_ptr; + } static inline const char *parse_tcp(struct packet *handler, const char *data, uint16_t len) -- cgit v1.2.3