summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-04-09 17:04:29 +0800
committeryangwei <[email protected]>2024-04-09 17:04:29 +0800
commita5aa6dbcffe729265571bfa2ee073c822172e318 (patch)
treedb9c5a9a07b132c8f6642d747cbf80af1f49f09e
parent1e2e0d7afdc8682f3fa2926dfb245fce018ed098 (diff)
✨ feat(gtp entry): gtp stream donot cache rawpkt
-rw-r--r--src/dealpkt/deal_gprs_tunnel.c2
-rw-r--r--src/dealpkt/deal_udp.c16
-rw-r--r--src/sapp_dev/sapp_init.c2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/dealpkt/deal_gprs_tunnel.c b/src/dealpkt/deal_gprs_tunnel.c
index ca25428..4b1e7fe 100644
--- a/src/dealpkt/deal_gprs_tunnel.c
+++ b/src/dealpkt/deal_gprs_tunnel.c
@@ -204,7 +204,7 @@ int gtp_entry(struct streaminfo_private *pfstream_pr,void *this_layer_data,int t
}
//��ʶ��GTP-UЭ�飬���ڽ�����������
-static int identify_gtp(const struct streaminfo *pstream,const char *payload, unsigned int udp_payload_len)
+int identify_gtp(const struct streaminfo *pstream,const char *payload, unsigned int udp_payload_len)
{
if (udp_payload_len >= sizeof(struct gtp_hdr))
{
diff --git a/src/dealpkt/deal_udp.c b/src/dealpkt/deal_udp.c
index fae7d5d..1799770 100644
--- a/src/dealpkt/deal_udp.c
+++ b/src/dealpkt/deal_udp.c
@@ -244,8 +244,20 @@ static struct streamindex *udp_add_new_stream(struct streamindex *pindex,
project_req_add_struct(pstream_udp, G_UDP_FLOW_STAT_PROJECT_ID, pdetail_pr->flow_stat);
}
- save_polling_inject_context(SAPP_MEM_DYN_UDP_POLLING_RAW_PKT, pstream_udp_pr, raw_pkt);
- if(createdir==DIR_C2S){
+ extern int identify_gtp(const struct streaminfo *pstream, const char *payload, unsigned int udp_payload_len);
+ if (1 == identify_gtp(pstream_udp, (char *)this_udphdr + sizeof(struct mesa_udp_hdr),
+ pstream_udp_pr->raw_pkt->raw_pkt_len -
+ ((const char *)this_udphdr - (const char *)pstream_udp_pr->raw_pkt->raw_pkt_data) -
+ sizeof(struct mesa_udp_hdr)))
+ {
+ pstream_udp_pr->stream_carry_up_layer_tunnel_type |= STREAM_TUNNEL_GPRS_TUNNEL;
+ }
+ else
+ {
+ save_polling_inject_context(SAPP_MEM_DYN_UDP_POLLING_RAW_PKT, pstream_udp_pr, raw_pkt);
+ }
+
+ if(createdir==DIR_C2S){
pstream_udp_pr->stream_c2s_route_dir = raw_pkt->route_dir;
}else{
pstream_udp_pr->stream_c2s_route_dir = raw_pkt->route_dir ^ 1;
diff --git a/src/sapp_dev/sapp_init.c b/src/sapp_dev/sapp_init.c
index 0ef8f0f..9b1f3c6 100644
--- a/src/sapp_dev/sapp_init.c
+++ b/src/sapp_dev/sapp_init.c
@@ -228,7 +228,7 @@ int MESA_platform_init(int argc, char *argv[])
/* ƽ̨���ù̶������IJ�� */
stream_register_udp_raw(udp_teredo_identify_entry);
- stream_register_udp_raw(udp_gtp_identify_entry);
+ //stream_register_udp_raw(udp_gtp_identify_entry);
stream_register_udp(udp_l2tp_identify_entry);
/* 2020-12-23 lijia add, vxlan���������� */