✨ feat(max thread index): extend from 64 to 128
This commit is contained in:
@@ -44,12 +44,13 @@
|
|||||||
#define MESA_DUMP (1)
|
#define MESA_DUMP (1)
|
||||||
#if MESA_DUMP
|
#if MESA_DUMP
|
||||||
#include "mesa_pkt_dump.h"
|
#include "mesa_pkt_dump.h"
|
||||||
|
#define MAX_THRAD_NUM 128
|
||||||
int tcpdump_data_offset = 0; /* 用于跳过某些底层数据, 如vxlan, 可以直接获取或设置过滤条件看vxlan的内层数据包内容 */
|
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;
|
int tcpdump_thread_index_array_num = 0;
|
||||||
const char *tcpdump_thread_index_str;
|
const char *tcpdump_thread_index_str;
|
||||||
int tcpdump_perceptive_flag = 0;
|
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 greedy_seek_flag = 0; /* 偏移到最内层IP, 便于隧道模式下查找BUG */
|
||||||
static int dump_to_file_flag = 0; /* 是否有-w 参数, 原有标准的WFileName变量是main()的局部变量, 不方便使用, 使用此变量表示是否写文件 */
|
static int dump_to_file_flag = 0; /* 是否有-w 参数, 原有标准的WFileName变量是main()的局部变量, 不方便使用, 使用此变量表示是否写文件 */
|
||||||
static int has_device_flag = 0; /* 是否有-i, -r参数, 原有标准的device变量是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))){ /* 无逗号分隔, 仅有一个, 无多线程 */
|
if(NULL == memchr(index_str, ',', strlen(raw_index_str))){ /* 无逗号分隔, 仅有一个, 无多线程 */
|
||||||
tcpdump_thread_index_array[0] = atoi(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;
|
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);
|
section = strtok_r(index_str, delim, &save_ptr);
|
||||||
if(section){
|
if(section){
|
||||||
tcpdump_thread_index_array[index] = atoi(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;
|
goto err;
|
||||||
}
|
}
|
||||||
index++;
|
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))){
|
while((section = strtok_r(NULL, delim, &save_ptr))){
|
||||||
tcpdump_thread_index_array[index] = atoi(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;
|
goto err;
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
@@ -1458,7 +1459,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
#if MESA_DUMP
|
#if MESA_DUMP
|
||||||
unsigned short sapp_cmd_port = 12345;
|
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;
|
tcpdump_thread_index_array[i] = 255;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user