From d20b3f8b33e960317ac3fa4be87d0a46191bf103 Mon Sep 17 00:00:00 2001 From: wangmenglan Date: Tue, 19 Mar 2024 17:53:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A7=A3=E6=9E=90GTP-U?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/packet.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 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: - return parse_gtpv1_u(handler, layer->pld_ptr, layer->pld_len); - default: - return layer->pld_ptr; } + + // 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); + } + + return layer->pld_ptr; + } static inline const char *parse_tcp(struct packet *handler, const char *data, uint16_t len)