summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2023-01-31 17:11:58 +0800
committeryangwei <[email protected]>2023-01-31 17:12:57 +0800
commit6ec67f52246adfa95e213bde68919fe400e79afb (patch)
tree399d6f96a9d7351aca29f786b247d1a034768084
parent91900e199b38428cf222902e6d86792f488fd487 (diff)
✨ feat(max thread index): extend from 64 to 128v1.0.13Feature-thread-index-256
-rw-r--r--src/tcpdump.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/tcpdump.c b/src/tcpdump.c
index 84b9a80..8b3eb80 100644
--- a/src/tcpdump.c
+++ b/src/tcpdump.c
@@ -44,12 +44,13 @@
#define MESA_DUMP (1)
#if MESA_DUMP
#include "mesa_pkt_dump.h"
+#define MAX_THRAD_NUM 128
int tcpdump_data_offset = 0; /* 用于跳过某些底层数据, 如vxlan, 可以直接获取或设置过滤条件看vxlan的内层数据包内容 */
-unsigned char tcpdump_thread_index_array[64]; /* 开启捕包线程id数组, 靠长度决定id数量, 每个占1字节, 命令行输入支持逗号分隔 */
+unsigned char tcpdump_thread_index_array[MAX_THRAD_NUM]; /* 开启捕包线程id数组, 靠长度决定id数量, 每个占1字节, 命令行输入支持逗号分隔 */
int tcpdump_thread_index_array_num = 0;
const char *tcpdump_thread_index_str;
int tcpdump_perceptive_flag = 0;
-unsigned int perceptive_pkt_seq[256]; /* 最大支持256个线程 */
+unsigned int perceptive_pkt_seq[MAX_THRAD_NUM]; /* 最大支持256个线程 */
static int greedy_seek_flag = 0; /* 偏移到最内层IP, 便于隧道模式下查找BUG */
static int dump_to_file_flag = 0; /* 是否有-w 参数, 原有标准的WFileName变量是main()的局部变量, 不方便使用, 使用此变量表示是否写文件 */
static int has_device_flag = 0; /* 是否有-i, -r参数, 原有标准的device变量是main()的局部变量, 不方便使用, 使用此变量表示是否从某个网卡捕包 */
@@ -907,7 +908,7 @@ static int MESA_dump_thread_index_convert(const char *raw_index_str)
if(NULL == memchr(index_str, ',', strlen(raw_index_str))){ /* 无逗号分隔, 仅有一个, 无多线程 */
tcpdump_thread_index_array[0] = atoi(raw_index_str);
- if(tcpdump_thread_index_array[0] >= 64){
+ if(tcpdump_thread_index_array[0] >= MAX_THRAD_NUM){
goto err;
}
@@ -918,7 +919,7 @@ static int MESA_dump_thread_index_convert(const char *raw_index_str)
section = strtok_r(index_str, delim, &save_ptr);
if(section){
tcpdump_thread_index_array[index] = atoi(section);
- if(tcpdump_thread_index_array[index] >= 64){
+ if(tcpdump_thread_index_array[index] >= MAX_THRAD_NUM){
goto err;
}
index++;
@@ -926,7 +927,7 @@ static int MESA_dump_thread_index_convert(const char *raw_index_str)
while((section = strtok_r(NULL, delim, &save_ptr))){
tcpdump_thread_index_array[index] = atoi(section);
- if(tcpdump_thread_index_array[index] >= 64){
+ if(tcpdump_thread_index_array[index] >= MAX_THRAD_NUM){
goto err;
}
index++;
@@ -1458,7 +1459,7 @@ main(int argc, char **argv)
#if MESA_DUMP
unsigned short sapp_cmd_port = 12345;
- for(i = 0; i < 64; i++){
+ for(i = 0; i < MAX_THRAD_NUM; i++){
tcpdump_thread_index_array[i] = 255;
}
#endif