summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2023-06-02 19:28:07 +0800
committer杨威 <[email protected]>2023-06-02 19:33:44 +0800
commite79b9357ac1c2a1d1fdc86f1b4eca100dece51d2 (patch)
treeab2c121f95f2f4e1ff710e188f9b8ce315a7fd90
parent1d4a4ec70b580d49342ec2d87a0ae12c5d88c8e7 (diff)
TSG-15325: 流复用时stream_strace_id未置0导致控制报文中的session id与mrbuff metadata中的session id不一致
-rw-r--r--src/dealpkt/deal_tcp.c6
-rw-r--r--src/dealpkt/deal_udp.c3
-rw-r--r--src/dealpkt/plug_support.c3
-rw-r--r--src/dealpkt/stream_manage.c1
4 files changed, 10 insertions, 3 deletions
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c
index f15813d..00880b4 100644
--- a/src/dealpkt/deal_tcp.c
+++ b/src/dealpkt/deal_tcp.c
@@ -674,7 +674,7 @@ static struct streamindex *tcp_add_new_stream_bysyn(struct streamindex *pindex,
copy_ipport_union_addr(pstream, &pindex->stream.stream_public, need_reverse);
- hash_add_stream(pindex_tcp);
+ hash_add_stream(pindex_tcp);
pstream_pr->pfather_pr = copy_stream_info_to_heap(SAPP_MEM_DYN_TCP_STREAM, (struct streaminfo_private *)pindex->stream.pfather_pr, need_reverse);
pstream->pfather = (struct streaminfo *)pstream_pr->pfather_pr;
@@ -742,7 +742,8 @@ static struct streamindex *tcp_add_new_stream_bysyn(struct streamindex *pindex,
pdetail_pr->drop_stream_flag = 0;
/* ���Ӹ���, ��������һ���µ�streamid */
- pindex_tcp->stream.global_stream_id = get_global_stream_id(threadnum);
+ pindex_tcp->stream.global_stream_id = get_global_stream_id(threadnum);
+ pindex_tcp->stream.stream_trace_id=0;
pdetail->createtime=g_CurrentTime;
pstream_pr->stream_create_timestamp_ms=sapp_global_val->individual_volatile->current_time_ms;
@@ -989,6 +990,7 @@ static struct streamindex *tcp_add_new_stream_bydata(struct streamindex *pindex,
pstream_pr->stream_killed_flag = 0;
/* ���Ӹ���, ��������һ���µ�streamid */
pindex_tcp->stream.global_stream_id = get_global_stream_id(threadnum);
+ pindex_tcp->stream.stream_trace_id=0;
/* ���Ӹ���, �����ж�һ��ddos ״̬ */
if(pstream_pr->create_dir_by_well_known_port != 1)
diff --git a/src/dealpkt/deal_udp.c b/src/dealpkt/deal_udp.c
index ccb7880..6a58691 100644
--- a/src/dealpkt/deal_udp.c
+++ b/src/dealpkt/deal_udp.c
@@ -221,6 +221,7 @@ static struct streamindex *udp_add_new_stream(struct streamindex *pindex,
pstream_udp->pktstate=OP_STATE_PENDING;
pdetail->createtime=g_CurrentTime;
pstream_udp_pr->global_stream_id = get_global_stream_id(threadnum);
+ pstream_udp_pr->stream_trace_id=0;
pstream_udp_pr->stream_create_timestamp_ms=sapp_global_val->individual_volatile->current_time_ms;
pdetail->lastmtime=g_CurrentTime;
@@ -435,6 +436,7 @@ static int udp_reset_stream_bytime(struct streamindex *pindex)
pdetail->createtime=g_CurrentTime;
pstream_pr->global_stream_id = get_global_stream_id(threadnum);
+ pstream_pr->stream_trace_id=0;
pstream_pr->stream_create_timestamp_ms=sapp_global_val->individual_volatile->current_time_ms;
plist=&(G_MESA_GLOBAL_STREAM[threadnum]->udpList[UDP_ONE_STATE]);
pstream->stream_state=UDP_ONE_STATE;
@@ -629,6 +631,7 @@ int dealipv4udppkt(struct streamindex *pindex, const struct mesa_ip4_hdr * this_
pdetail->createtime = g_CurrentTime;
pstream_pr->global_stream_id = get_global_stream_id(thread_num);
+ pstream_pr->stream_trace_id=0;
pstream_pr->stream_create_timestamp_ms=sapp_global_val->individual_volatile->current_time_ms;
pdetail->datalen = datalen;
pdetail->pdata = (char *)udph + sizeof (struct udphdr);
diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c
index 7baa319..179e6eb 100644
--- a/src/dealpkt/plug_support.c
+++ b/src/dealpkt/plug_support.c
@@ -1035,10 +1035,11 @@ int MESA_set_stream_opt(const struct streaminfo *pstream, enum MESA_stream_opt o
struct streaminfo_private *pstream_pr=(struct streaminfo_private *)pstream;
if(pstream_pr->stream_trace_id>0)
{
+ ret = -1;
break;
}
pstream_pr->stream_trace_id=*((unsigned long long *)opt_val);
-
+ ret=0;
}
break;
default:
diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c
index f959b50..74a5fc5 100644
--- a/src/dealpkt/stream_manage.c
+++ b/src/dealpkt/stream_manage.c
@@ -1485,6 +1485,7 @@ void hash_add_stream(struct streamindex *pindex)
}
pindex->stream.global_stream_id = get_global_stream_id(threadnum);
+ pindex->stream.stream_trace_id=0;
}