diff options
| author | lijia <[email protected]> | 2021-09-15 21:08:40 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2021-09-15 21:08:40 +0800 |
| commit | c3abf201a555b51fd99b3b1bd19c0ca70506b7d4 (patch) | |
| tree | c181245ac04632a06b587c4fb96131da6572b207 | |
| parent | a2c7c57d258c6af4648021f24377f305631a769c (diff) | |
TSG-7787, 如果某个流超时了, 而且又被自身的包reset, 而且凑巧还被设成了bypass状态, 在tcp_reset_stream()之后,又调用tcp_processallpkt(),导致coredump;v4.2.54
TSG-7791, sapp启动时输出进程id, 线程LWP,线程thread_index,CPU绑核之间的关系
| -rw-r--r-- | src/dealpkt/deal_tcp.c | 11 | ||||
| -rw-r--r-- | src/packet_io/packet_io_marsio.c | 10 | ||||
| -rw-r--r-- | src/packet_io/packet_io_pcap.c | 5 | ||||
| -rw-r--r-- | src/project/project_requirement.c | 9 |
4 files changed, 33 insertions, 2 deletions
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c index 153e30c..1e33aa9 100644 --- a/src/dealpkt/deal_tcp.c +++ b/src/dealpkt/deal_tcp.c @@ -2881,6 +2881,10 @@ static int deal_tcp_stream(struct streamindex *pindex, const void *this_iphdr, s if(0 == ret){ return PASS; } + /* �����tcp_reset_stream()�½���ʱ, ��������bypass��־, �˴�ֱ�ӷ���, �����ٵ���tcp_processallpkt */ + if(pstream_pr->under_ddos_bypass){ + return PASS; + } ret = tcp_processallpkt(pstream, this_iphdr, this_tcphdr, tcplen, raw_pkt); if(DROP == ret){ return DROP; @@ -2933,6 +2937,13 @@ static int deal_tcp_stream(struct streamindex *pindex, const void *this_iphdr, s } } + /* �����tcp_deal_nouse_stream(),tcp_deal_data_stream()������, ���ù�tcp_reset_stream()���õ�ǰ��ʱ, + ���ɱ�������bypass��־, �˴�Ҫֱ�ӷ���, �����ٵ���stream_process_tcp_allpkt() + */ + if(pstream_pr->under_ddos_bypass){ + return ret; + } + //adjust by lqy 20150107 Ϊ�˷�ֹSYN�ؽ�����ʱSYN�ڵ�һ�������� if((0 == call_tcpall_after_reset) && pindex_tcp && (pstream->pktstate!=OP_STATE_CLOSE)) { diff --git a/src/packet_io/packet_io_marsio.c b/src/packet_io/packet_io_marsio.c index 49411e1..e1cb25d 100644 --- a/src/packet_io/packet_io_marsio.c +++ b/src/packet_io/packet_io_marsio.c @@ -811,9 +811,15 @@ static void *marsio4_worker(void *arg) if(sapp_global_val->config.cpu.bind_mask_array_num > 0){ ptr_marsio_thread_init(sapp_marsio4_instance); - sapp_global_val->individual_fixed.cpu_bind_core_id_per_thread[tseq] = get_current_thread_cpu_affinity_id(); - sapp_global_val->individual_fixed.thread_tid[tseq] = syscall(SYS_gettid); + sapp_global_val->individual_fixed.cpu_bind_core_id_per_thread[tseq] = get_current_thread_cpu_affinity_id(); } + sapp_global_val->individual_fixed.thread_tid[tseq] = syscall(SYS_gettid); + + sapp_runtime_log(RLOG_LV_FATAL, "pid:%d, thread_index:%d, TID(LWP):%ld, PSR:%d", + getpid(), tseq, + sapp_global_val->individual_fixed.thread_tid[tseq], + sapp_global_val->individual_fixed.cpu_bind_core_id_per_thread[tseq]); + memset(&raw_pkt, 0, sizeof(raw_pkt_t)); /* �̶�����IJ���Ԥ������ */ diff --git a/src/packet_io/packet_io_pcap.c b/src/packet_io/packet_io_pcap.c index cfaa38d..1c41aac 100644 --- a/src/packet_io/packet_io_pcap.c +++ b/src/packet_io/packet_io_pcap.c @@ -790,6 +790,11 @@ static void *__pcap_work_thread(void *arg) sapp_global_val->individual_fixed.cpu_bind_core_id_per_thread[thread_num] = get_current_thread_cpu_affinity_id();
sapp_global_val->individual_fixed.thread_tid[thread_num] = syscall(SYS_gettid);
+ sapp_runtime_log(RLOG_LV_FATAL, "pid:%d, thread_index:%d, TID(LWP):%ld, PSR:%d",
+ getpid(), thread_num,
+ sapp_global_val->individual_fixed.thread_tid[thread_num],
+ sapp_global_val->individual_fixed.cpu_bind_core_id_per_thread[thread_num]);
+
while(SAPP_STATE_PROCESSING != sapp_get_current_state()){
sapp_usleep(1000);
}
diff --git a/src/project/project_requirement.c b/src/project/project_requirement.c index 153cc14..809bbba 100644 --- a/src/project/project_requirement.c +++ b/src/project/project_requirement.c @@ -288,6 +288,10 @@ static int __project_req_add(struct streaminfo *stream, int project_req_id, long stream_pr = (struct streaminfo_private *)stream;
pinfo = (project_req_info_t *)(stream_pr->pproject);
+ if(NULL == pinfo){
+ sapp_runtime_log(RLOG_LV_FATAL, "project add error, id=%d, value is:%lld, pproject is NULL!", project_req_id, project_req_value);
+ return -1;
+ }
pinfo[project_req_id].value = project_req_value;
pinfo[project_req_id].valid_flag = 1;
@@ -359,6 +363,11 @@ static long long __project_req_get(const struct streaminfo *stream, int project_ pinfo = (project_req_info_t *)(stream_pr->pproject);
+ if(NULL == pinfo){
+ sapp_runtime_log(RLOG_LV_FATAL, "project get error, id=%d, pproject is NULL!", project_req_id);
+ return -1;
+ }
+
if(0 == pinfo[project_req_id].valid_flag){ /* ������δ���ù�, ����-1������errno */
errno = ERANGE;
return -1;
|
