summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-06-26 16:27:38 +0800
committeryangwei <[email protected]>2024-06-26 16:27:38 +0800
commit307c8e30481c29faae0b686e57c9d90c093441c7 (patch)
treea093b0df977e07f23f8d0af9076916a975c5728c
parentc5b96a48f94604a0382c75363379c7d54bc06d36 (diff)
✨ feat(fast close tcp no use): default set 0
-rw-r--r--benchmark/sapp_default_config/etc/sapp.toml2
-rw-r--r--bin/etc/sapp.toml2
-rw-r--r--include/private/sapp_global_val.h2
-rw-r--r--src/config/config_parse.cpp136
-rw-r--r--src/dealpkt/stream_manage.c370
5 files changed, 256 insertions, 256 deletions
diff --git a/benchmark/sapp_default_config/etc/sapp.toml b/benchmark/sapp_default_config/etc/sapp.toml
index 2805521..b63ec9c 100644
--- a/benchmark/sapp_default_config/etc/sapp.toml
+++ b/benchmark/sapp_default_config/etc/sapp.toml
@@ -149,7 +149,7 @@
analyse_option_enabled=1
tuple4_reuse_time_interval=30
- #nouse_set_special_timeout=1
+ #fast_close_nouse=0
reorder_on_closing=0
#max_opening_per_sec=5000
#max_timeouts_per_sec=5000
diff --git a/bin/etc/sapp.toml b/bin/etc/sapp.toml
index da58b5e..b9ef6ed 100644
--- a/bin/etc/sapp.toml
+++ b/bin/etc/sapp.toml
@@ -149,7 +149,7 @@
analyse_option_enabled=1
tuple4_reuse_time_interval=30
- #nouse_set_special_timeout=1
+ #fast_close_nouse=0
reorder_on_closing=0
#max_opening_per_sec=5000
#max_timeouts_per_sec=5000
diff --git a/include/private/sapp_global_val.h b/include/private/sapp_global_val.h
index 80caa54..236b9ec 100644
--- a/include/private/sapp_global_val.h
+++ b/include/private/sapp_global_val.h
@@ -108,7 +108,7 @@ typedef struct{
int max_timeouts_per_sec;
int max_opening_per_sec;
int reorder_on_closing;
- int nouse_set_special_timeout;
+ int fast_close_nouse;
}sapp_config_stream_tcp_t;
diff --git a/src/config/config_parse.cpp b/src/config/config_parse.cpp
index 337520e..f6679a0 100644
--- a/src/config/config_parse.cpp
+++ b/src/config/config_parse.cpp
@@ -13,10 +13,10 @@ extern "C" {
extern int g_overlay_layer_set[__ADDR_TYPE_MAX][SAPP_SUPPORT_LAYER_NUM_MAX];
/*
- ˵��:
- _sapp_toml_sample_file_image����, _sapp_toml_sample_file_image_len�����ǿ�����xxd -i �Զ����ɵ�,
- �����ڶ�̬�������ļ�sapp.toml.hex.array.c��,
- ���ļ��������git�ֿ�.
+ ˵��:
+ _sapp_toml_sample_file_image����, _sapp_toml_sample_file_image_len�����ǿ�����xxd -i �Զ����ɵ�,
+ �����ڶ�̬�������ļ�sapp.toml.hex.array.c��,
+ ���ļ��������git�ֿ�.
*/
extern const unsigned char _sapp_toml_sample_file_image[];
extern const int _sapp_toml_sample_file_image_len;
@@ -24,14 +24,14 @@ extern const int _sapp_toml_sample_file_image_len;
#define SAPP_CFG_OBSOLETE_FLAG 99999999
typedef struct __sapp_config_check{
int global_id;
- int depend_id; /* 1:����IJ���, ��������������, Ҳ����ȱʧ; 0:��ѡ��, ����û��, ��Ӱ��sapp���幦��; >=1000:����δ����, ȡ�����������ò����Ƿ���, ����transparentģʽ��������packet_io.external.interface */
- int err_log_level; /* 10,20,30, ������־�ȼ� */
+ int depend_id; /* 1:����IJ���, ��������������, Ҳ����ȱʧ; 0:��ѡ��, ����û��, ��Ӱ��sapp���幦��; >=1000:����δ����, ȡ�����������ò����Ƿ���, ����transparentģʽ��������packet_io.external.interface */
+ int err_log_level; /* 10,20,30, ������־�ȼ� */
const char *section;
const char *cfg_key;
- const char *depend_cfg_value; /* ����depend_id>1000ʱ��Ч, ��ʾ����������ֵ����Ԥ�ȶ���ʱ, �ż�鵱ǰ�����Ƿ�Ϸ�, ����mirroģʽ�¸�������Ҫ��� packet_io.external.interface */
+ const char *depend_cfg_value; /* ����depend_id>1000ʱ��Ч, ��ʾ����������ֵ����Ԥ�ȶ���ʱ, �ż�鵱ǰ�����Ƿ�Ϸ�, ����mirroģʽ�¸�������Ҫ��� packet_io.external.interface */
int (*cfg_value_check_fun)(const struct __sapp_config_check *sapp_cfg_check_attr, int this_cfg_id, int depend_cfg_id, const char *cfg_value, const void *range_array, int array_num);
char *cfg_value; /* NULL is not found */
- const void *expect_range_array; /* ���ڼ�����ֵ�Ŀ�ѡ��Χ����, �������͵IJ�ͬ������int *, ������char **���� */
+ const void *expect_range_array; /* ���ڼ�����ֵ�Ŀ�ѡ��Χ����, �������͵IJ�ͬ������int *, ������char **���� */
int expect_array_num;
}sapp_config_check_t;
@@ -46,7 +46,7 @@ static const char *sapp_cfg_get_value_from_attr_by_id(const sapp_config_check_t
static const char *sapp_cfg_get_value_from_attr_by_section_key(const sapp_config_check_t *sapp_cfg_check_attr, const char *section, const char *key);
static int cfg_value_check_inject_mode(const sapp_config_check_t *sapp_cfg_check_attr,int this_cfg_id,int depend_cfg_id, const char *raw_cfg_value, const void *expect_range_array, int array_num);
-static int g_interger_range_array[65536]; /* һ��int�͵�����, ��ֵ�±����ֵһ��, �� g_interger_range_array[0]=0, g_interger_range_array[1]=1, �����ж���ֵ������Χ�Ϸ��� */
+static int g_interger_range_array[65536]; /* һ��int�͵�����, ��ֵ�±����ֵһ��, �� g_interger_range_array[0]=0, g_interger_range_array[1]=1, �����ж���ֵ������Χ�Ϸ��� */
static int cfg_value_check_integer_range(const sapp_config_check_t *sapp_cfg_check_attr,int this_cfg_id,int depend_cfg_id, const char *raw_cfg_value, const void *expect_range_array, int array_num)
@@ -127,11 +127,11 @@ static int cfg_value_check_bind_mask(const sapp_config_check_t *sapp_cfg_check_a
long bind_mask_array[SAPP_MAX_THREADS];
int ret;
- /* ��ʱû��ֱ�ӽ���raw_cfg_value�ĺ���, �˴��ٶ�ȡһ�������ļ� */
+ /* ��ʱû��ֱ�ӽ���raw_cfg_value�ĺ���, �˴��ٶ�ȡһ�������ļ� */
ret = tomlc99_wrap_load_long_array(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask", bind_mask_array, &bind_mask_array_num);
if(ret < 0){
unsigned int load_profile_array[SAPP_MAX_THREADS];
- /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
+ /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
ret = MESA_load_profile_uint_range(
ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask",
SAPP_MAX_THREADS, (unsigned int *)load_profile_array);
@@ -143,7 +143,7 @@ static int cfg_value_check_bind_mask(const sapp_config_check_t *sapp_cfg_check_a
}
if(0 == bind_mask_array_num){
- return 0; /* ����������, ������CPU,������� */
+ return 0; /* ����������, ������CPU,������� */
}
const char *raw_cfg_worker_threads_value = sapp_cfg_get_value_from_attr_by_id(sapp_cfg_check_attr, depend_cfg_id);
@@ -173,7 +173,7 @@ static int cfg_value_check_stream_id_base_time(const sapp_config_check_t *sapp_c
struct tm local_tm;
if(NULL == raw_cfg_value || strlen(raw_cfg_value) == 0){
- return 0; /* ����ΪNULL,������� */
+ return 0; /* ����ΪNULL,������� */
}
if(strptime(raw_cfg_value, "%Y-%m-%d %H:%M:%S", &local_tm) == NULL){
@@ -207,7 +207,7 @@ static const sapp_config_check_t g_sapp_cfg_check_attr[] =
{2002,0,RLOG_LV_DEBUG, "CPU", "send_only_threads_max", NULL,NULL, NULL, NULL, 0},
{2003,2001,RLOG_LV_FATAL,"CPU", "bind_mask", "",cfg_value_check_bind_mask, NULL, NULL, 0},
- {3001,0, RLOG_LV_INFO,"MEM", "dictator_enable", NULL,cfg_value_check_integer_range, NULL, g_interger_range_array, 2}, /* ֻ����0��1, ���Ծ���ǰ2��Ԫ�� */
+ {3001,0, RLOG_LV_INFO,"MEM", "dictator_enable", NULL,cfg_value_check_integer_range, NULL, g_interger_range_array, 2}, /* ֻ����0��1, ���Ծ���ǰ2��Ԫ�� */
{4000,0,RLOG_LV_DEBUG,"PACKET_IO", NULL, NULL, NULL,NULL, NULL, 0},
@@ -352,7 +352,7 @@ static const sapp_config_check_t g_sapp_cfg_check_attr[] =
{9201,0,RLOG_LV_INFO, "LIBRARY_LINK", "marsio_library_path", NULL,NULL, NULL, NULL, 0},
/******************************************************************************************************************/
- /*********** ��������ʷ���������ֹ�������, Ҳ�������,Ҳ���㲻֧��,����澯��Ϣ��ʾ���������� *********************/
+ /*********** ��������ʷ���������ֹ�������, Ҳ�������,Ҳ���㲻֧��,����澯��Ϣ��ʾ���������� *********************/
/******************************************************************************************************************/
{SAPP_CFG_OBSOLETE_FLAG,0,RLOG_LV_INFO,"overlay_tunnel_definition","stream_compare_layer_cfg_file",NULL, NULL, NULL,NULL, 0},
{SAPP_CFG_OBSOLETE_FLAG,0,RLOG_LV_INFO,"overlay_tunnel_definition","vlan_flipping_cfg_file",NULL, NULL, NULL,NULL, 0},
@@ -437,7 +437,7 @@ static int cfg_value_check_inject_mode(const sapp_config_check_t *sapp_cfg_check
depend_cfg_index = cfg_get_index_by_depend_id(depend_cfg_id);
depend_cfg_value = sapp_cfg_check_attr[depend_cfg_index].cfg_value;
- /* raw_cfg_value������NULL, ��ʱӦ�����ж�depend_cfg_value, �������������, ��̫�����ǿ� */
+ /* raw_cfg_value������NULL, ��ʱӦ�����ж�depend_cfg_value, �������������, ��̫�����ǿ� */
if(strncasecmp(depend_cfg_value, "vxlan_by_inline_device", strlen("vxlan_by_inline_device")) == 0){
expect_cfg_index = cfg_get_index_by_key_name("inject_mode_inline_device_sport");
@@ -526,7 +526,7 @@ static inline int is_file_exist(const char *filename)
static void update_overlay_vxlan_layer_set(void);
-/* ������ͬ���͵�����, �����в�������, ����sapp.toml�е����� */
+/* ������ͬ���͵�����, �����в�������, ����sapp.toml�е����� */
void sapp_cla_override_cfg_file(void)
{
char *cmd_args;
@@ -537,7 +537,7 @@ void sapp_cla_override_cfg_file(void)
}
if (sapp_get_cla_raw("dumpfile", &cmd_args) >= 0)
- { /* dumpfileģʽ�Զ�����interface���� */
+ { /* dumpfileģʽ�Զ�����interface���� */
strncpy(pconfig->packet_io.deployment_mode_str, "dumpfile", NAME_MAX);
pconfig->packet_io.deployment_mode_bin = DEPLOYMENT_MODE_MIRROR;
sapp_global_val->individual_fixed.deployment_mode_private = NET_CONN_PARALLEL;
@@ -627,7 +627,7 @@ static int parse_vlan_flipping_map_config(void)
fp = fopen(ABBR_VLAN_FLIPPING_CONF_FILE, "r");
if(NULL == fp){
sapp_log(RLOG_LV_INFO, ~0, ~0, "[warning]can't open vlan_flipping_cfg_file:%s", ABBR_VLAN_FLIPPING_CONF_FILE);
- /* ��ǰ����, ����ļ�������, ������� */
+ /* ��ǰ����, ����ļ�������, ������� */
return 0;
}
@@ -796,7 +796,7 @@ static int parse_asymmetric_addr_layer_config(void)
fp = fopen(ABBR_ASYM_LAYER_ADDR_CONF_FILE, "r");
if(NULL == fp){
sapp_log(RLOG_LV_INFO, ~0, ~0, "[Warning]can't open asymmetric_addr_layer_cfg_file:%s", ABBR_ASYM_LAYER_ADDR_CONF_FILE);
- /* ��ǰ����, ����ļ�������, ������� */
+ /* ��ǰ����, ����ļ�������, ������� */
return 0;
}
@@ -869,7 +869,7 @@ static int parse_stream_compare_layer_config(void)
fp = fopen(ABBR_STREAM_CMP_LAYER_CONF_FILE, "r");
if(NULL == fp){
sapp_log(RLOG_LV_INFO, ~0, ~0, "[Warning]can't open stream compare layer cfg_file:%s", ABBR_STREAM_CMP_LAYER_CONF_FILE);
- /* ��ǰ����, ����ļ�������, ������� */
+ /* ��ǰ����, ����ļ�������, ������� */
return 0;
}
@@ -913,7 +913,7 @@ static void update_overlay_vxlan_layer_set(void)
g_overlay_layer_set[ADDR_TYPE_MAC][0] = 1;
g_overlay_layer_set[ADDR_TYPE_IPV4][1] = 1;
g_overlay_layer_set[__ADDR_TYPE_IP_PAIR_V4][1] = 1;
- g_overlay_layer_set[ADDR_TYPE_UDP][1] = 1; /* IP��udp�ϲ���Ϊһ��, ���Դ˴�������1 */
+ g_overlay_layer_set[ADDR_TYPE_UDP][1] = 1; /* IP��udp�ϲ���Ϊһ��, ���Դ˴�������1 */
g_overlay_layer_set[ADDR_TYPE_VXLAN][2] = 1;
}
@@ -941,7 +941,7 @@ static int parse_well_known_port_config(void)
{
FILE *fp;
char line_buf[256];
- int last_section_proto = -1; /* �����ʶ: TCP or UDP */
+ int last_section_proto = -1; /* �����ʶ: TCP or UDP */
unsigned short *port_array = NULL;
int port_array_num = 0;
int tmpnum;
@@ -949,7 +949,7 @@ static int parse_well_known_port_config(void)
fp = fopen(ABBR_WELL_KNOWN_PORT_CONF_FILE, "r");
if(NULL == fp){
- return 0; /* û�д��ļ�, ������� */
+ return 0; /* û�д��ļ�, ������� */
}
while(fgets(line_buf, sizeof(line_buf), fp)){
@@ -959,9 +959,9 @@ static int parse_well_known_port_config(void)
sapp_memmove_for_blank_table(line_buf, sizeof(line_buf));
del_last_rn(line_buf, sizeof(line_buf));
- if('[' == line_buf[0]){ /* [] һ���������ʼ */
+ if('[' == line_buf[0]){ /* [] һ���������ʼ */
if(port_array != NULL){
- /* ��һ������ս��� */
+ /* ��һ������ս��� */
update_well_known_port_array(last_section_proto, port_array, port_array_num);
port_array = NULL;
port_array_num = 0;
@@ -1053,7 +1053,7 @@ static int parse_extract_linkdir_from_mac_cfg(void)
return 0;
}
-/* ���ø�ʽת��, ���ַ�������תΪint����,���ڳ����� */
+/* ���ø�ʽת��, ���ַ�������תΪint����,���ڳ����� */
static int config_expression_convert(void)
{
sapp_config_t *pconfig;
@@ -1296,9 +1296,9 @@ static inline void old_config_file_detect(const char *old_filename, const char *
/*
- �����ļ��Ϸ��ԡ�����Լ��.
+ �����ļ��Ϸ��ԡ�����Լ��.
- TODO: ������������ g_sapp_cfg_check_attr[] ���ϲ�, ijЩ������⹦�����ظ���!!!
+ TODO: ������������ g_sapp_cfg_check_attr[] ���ϲ�, ijЩ������⹦�����ظ���!!!
return value:
0: succ;
@@ -1313,7 +1313,7 @@ static int config_sanity_check(void)
struct streaminfo_private phony_stream_pr;
phony_stream_pr.layer_index = 0xF;
- assert(SAPP_SUPPORT_LAYER_NUM_MAX == phony_stream_pr.layer_index); /* �����ж��������޸���layer_index��SAPP_SUPPORT_LAYER_NUM_MAX, ����������һ�µ���� */
+ assert(SAPP_SUPPORT_LAYER_NUM_MAX == phony_stream_pr.layer_index); /* �����ж��������޸���layer_index��SAPP_SUPPORT_LAYER_NUM_MAX, ����������һ�µ���� */
if(SAPP_SUPPORT_LAYER_NUM_MAX != phony_stream_pr.layer_index){
sapp_log(RLOG_LV_FATAL, ~0, ~0, "SAPP_SUPPORT_LAYER_NUM_MAX is:%d, but streaminfo_private->layer_index max is:%d", SAPP_SUPPORT_LAYER_NUM_MAX, phony_stream_pr.layer_index);
return -1;
@@ -1461,7 +1461,7 @@ static int config_sanity_check(void)
/*
- ֧�ֶ�д����ģʽ, ���¸��������ļ�·��, ���������ļ�·��.
+ ֧�ֶ�д����ģʽ, ���¸��������ļ�·��, ���������ļ�·��.
*/
int sapp_get_secondary_file_path(void)
{
@@ -1634,7 +1634,7 @@ int sapp_get_secondary_file_path(void)
}
-/* ��ȡ�����ļ�sapp.toml, ������ֻLoad, ���������ʹ����� */
+/* ��ȡ�����ļ�sapp.toml, ������ֻLoad, ���������ʹ����� */
int sapp_parse_config(void)
{
int ret;
@@ -1656,7 +1656,7 @@ int sapp_parse_config(void)
/******************************* SYSTEM *********************************/
ret = tomlc99_wrap_load_string_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"SYSTEM", (char *)"instance_name", pconfig->system.instance_name, NAME_MAX, "sapp_v4.2");
if(TOMLC99_RET_PATTERN_ERROR == ret){
- /* �״ν����ж������PATTERN_ERROR, ˵��toml��ʽ������, ���ټ������� */
+ /* �״ν����ж������PATTERN_ERROR, ˵��toml��ʽ������, ���ټ������� */
sapp_log(30, ~0, ~0, "parse config file %s error!", ABBR_CFG_FILE_MAIN_ENTRY);
exit(1);
}
@@ -1679,7 +1679,7 @@ int sapp_parse_config(void)
tomlc99_wrap_load_long_array(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask", pconfig->cpu.bind_mask_array, &pconfig->cpu.bind_mask_array_num);
- /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
+ /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
int tmp_bind_mask[SAPP_MAX_THREADS] = {};
ret = MESA_load_profile_uint_range(
ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask",
@@ -1752,7 +1752,7 @@ int sapp_parse_config(void)
/******************************* packet_io.under_ddos ******************************/
- tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"stream_bypass_enabled", &pconfig->packet_io.under_ddos_config.enabled, 0); //��ǰ����, Ĭ�ϲ�����
+ tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"stream_bypass_enabled", &pconfig->packet_io.under_ddos_config.enabled, 0); //��ǰ����, Ĭ�ϲ�����
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"get_cpu_usage_interval", &pconfig->packet_io.under_ddos_config.get_cpu_usage_interval, 500);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"smooth_avg_window", &pconfig->packet_io.under_ddos_config.smooth_avg_window, 2);
@@ -1778,7 +1778,7 @@ int sapp_parse_config(void)
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"syn_mandatory", (int *)&pconfig->stream.tcp.syn_mandatory, 1);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"reorder_pkt_max", (int *)&pconfig->stream.tcp.reorder_pkt_max, 5);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"reorder_on_closing", (int *)&pconfig->stream.tcp.reorder_on_closing, 0);
- tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"nouse_set_special_timeout", (int *)&pconfig->stream.tcp.nouse_set_special_timeout, 1);
+ tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"fast_close_nouse", (int *)&pconfig->stream.tcp.fast_close_nouse, 0);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"analyse_option_enabled", (int *)&pconfig->stream.tcp.analyse_option_enabled, 1);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"tuple4_reuse_time_interval", (int *)&pconfig->stream.tcp.tuple4_reuse_time_interval, 30);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"meaningful_statistics_minimum_pkt", (int *)&pconfig->stream.tcp.meaningful_statistics_minimum_pkt, 3);
@@ -1933,9 +1933,9 @@ int sapp_parse_config(void)
}
/*
- 0: ����ʶ�����ļ��е�key-value;
- 1: ʶ�𲢴洢�����ļ��е�key-value;
- 2: ����ijЩ�Ѿ��������IJ���.
+ 0: ����ʶ�����ļ��е�key-value;
+ 1: ʶ�𲢴洢�����ļ��е�key-value;
+ 2: ����ijЩ�Ѿ��������IJ���.
*/
static int sapp_config_check_update_option(sapp_config_check_t *local_cfg_check_attr, const char *section, const char *key, const char *value)
{
@@ -1944,7 +1944,7 @@ static int sapp_config_check_update_option(sapp_config_check_t *local_cfg_check_
int found_cfg = 0;
for(i = 0; local_cfg_check_attr[i].global_id != -1; i++){
- if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����û��key */
+ if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����û��key */
continue;
}
section_max_len = SAPP_MAX(strlen(local_cfg_check_attr[i].section), strlen(section));
@@ -1956,7 +1956,7 @@ static int sapp_config_check_update_option(sapp_config_check_t *local_cfg_check_
return 2;
}else{
if(NULL == value){
- local_cfg_check_attr[i].cfg_value = sapp_strdup(""); /* û�����������ֵ, ����bpf��������Ϊ��, ����key�Ǵ��ڵ�, Ҳ�������ҵ��� */
+ local_cfg_check_attr[i].cfg_value = sapp_strdup(""); /* û�����������ֵ, ����bpf��������Ϊ��, ����key�Ǵ��ڵ�, Ҳ�������ҵ��� */
}else{
local_cfg_check_attr[i].cfg_value = sapp_strdup(value);
}
@@ -1975,7 +1975,7 @@ extern char *sapp_memmove_for_blank_table(char *data, int max_len);
/*
- �Ƿ���Ҫ��鵱ǰ���õĺϷ���.
+ �Ƿ���Ҫ��鵱ǰ���õĺϷ���.
*/
static int cfg_value_need_be_check(const sapp_config_check_t *local_cfg_check_array, const sapp_config_check_t *this_cfg_check_attr)
{
@@ -1984,7 +1984,7 @@ static int cfg_value_need_be_check(const sapp_config_check_t *local_cfg_check_ar
if(1 == this_cfg_check_attr->depend_id){
return 1;
}
- if(0 == this_cfg_check_attr->depend_id){ /* ��ѡ������Ҳ��� */
+ if(0 == this_cfg_check_attr->depend_id){ /* ��ѡ������Ҳ��� */
return 1;
}
@@ -2002,11 +2002,11 @@ static int cfg_value_need_be_check(const sapp_config_check_t *local_cfg_check_ar
}
/*
- ��ȫ����һ�鵱ǰ��sapp.toml, ����Ƿ��в���ʶ������, �����˵��:
- 1)sapp��sapp.toml�İ汾��;
- 2)ijЩ��ʷ�ϵIJ����Ѿ�������, ����sapp.toml������;
+ ��ȫ����һ�鵱ǰ��sapp.toml, ����Ƿ��в���ʶ������, �����˵��:
+ 1)sapp��sapp.toml�İ汾��;
+ 2)ijЩ��ʷ�ϵIJ����Ѿ�������, ����sapp.toml������;
- �˴�����prof_load����������fgets���ж�ȡ, ��Ϊ���Ȳ�֪��Ҫ��ȡʲô, Ҫ�����е��ж�����һ��.
+ �˴�����prof_load����������fgets���ж�ȡ, ��Ϊ���Ȳ�֪��Ҫ��ȡʲô, Ҫ�����е��ж�����һ��.
*/
static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2016,7 +2016,7 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
char section_string[128] = {};
char *cfg_key;
char *cfg_value;
- const char *kname_delim = "="; /* ������ֵֻ����=�ָ�, ������key��ֵ��Ŀո�\tɾ��, ����bpf filter */
+ const char *kname_delim = "="; /* ������ֵֻ����=�ָ�, ������key��ֵ��Ŀո�\tɾ��, ����bpf filter */
const char *section_delim = "[] \t";
char *key_save_ptr, *section_save_ptr;
FILE *fp;
@@ -2034,12 +2034,12 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
if('#' == raw_config_line[0]){
continue;
}
- if('\0' == raw_config_line[0]){ /* ������ */
+ if('\0' == raw_config_line[0]){ /* ������ */
continue;
}
memcpy(config_line, raw_config_line, sizeof(raw_config_line));
- if('[' == raw_config_line[0]){ /* ��[��ͷ��ʾ��section���俪ʼ */
+ if('[' == raw_config_line[0]){ /* ��[��ͷ��ʾ��section���俪ʼ */
char *pure_sesion_str = strtok_r(config_line, section_delim, &section_save_ptr);
strncpy(section_string, pure_sesion_str, sizeof(section_string));
while(strtok_r(NULL, section_delim, &section_save_ptr));
@@ -2062,7 +2062,7 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
sapp_memmove_for_blank_table(cfg_value, strlen(cfg_value));
- const char *kkvalue_delim = "\"'"; /* ������ֵ���ܱ�˫���ű�����, ��ʱֻ��ȥ�����ŵ��Dz������ÿո�\t�ָ���, ����bpf_filter */
+ const char *kkvalue_delim = "\"'"; /* ������ֵ���ܱ�˫���ű�����, ��ʱֻ��ȥ�����ŵ��Dz������ÿո�\t�ָ���, ����bpf_filter */
char *pure_cfg_value_save_ptr;
char *pure_cfg_value = strtok_r(cfg_value, kkvalue_delim, &pure_cfg_value_save_ptr);
ret = sapp_config_check_update_option(local_cfg_check_attr, section_string, cfg_key, pure_cfg_value);
@@ -2080,8 +2080,8 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
}
/*
- ��������֪�IJ�����sapp.toml���ȡһ��, ����Ƿ��в����ڵ�����, �����:
- 1)sapp��sapp.toml�İ汾��;
+ ��������֪�IJ�����sapp.toml���ȡһ��, ����Ƿ��в����ڵ�����, �����:
+ 1)sapp��sapp.toml�İ汾��;
*/
static int sapp_config_check_missing(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2091,10 +2091,10 @@ static int sapp_config_check_missing(sapp_config_check_t *local_cfg_check_attr)
int fun_ret = 0;
for(i = 0; local_cfg_check_attr[i].global_id != -1; i++){
- if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����Ϊ�����ʶ, ����û��key */
+ if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����Ϊ�����ʶ, ����û��key */
continue;
}
- if(SAPP_CFG_OBSOLETE_FLAG == local_cfg_check_attr[i].global_id){ /* �Ѿ�����������, �����ڼ��missing */
+ if(SAPP_CFG_OBSOLETE_FLAG == local_cfg_check_attr[i].global_id){ /* �Ѿ�����������, �����ڼ��missing */
continue;
}
if(cfg_value_need_be_check(local_cfg_check_attr, &local_cfg_check_attr[i]) == 0){
@@ -2102,24 +2102,24 @@ static int sapp_config_check_missing(sapp_config_check_t *local_cfg_check_attr)
}
ret1 = MESA_load_profile_string_nodef(ABBR_CFG_FILE_MAIN_ENTRY, local_cfg_check_attr[i].section, local_cfg_check_attr[i].cfg_key, cfg_value, sizeof(cfg_value));
if(ret1 < 0){
- /* ��profile�ӿڶ�ȡ�����п�����toml��ʽ������, ����toml���鳢�Խ���һ�� */
+ /* ��profile�ӿڶ�ȡ�����п�����toml��ʽ������, ����toml���鳢�Խ���һ�� */
array_num = 1024;
ret2 = tomlc99_wrap_load_int_array(ABBR_CFG_FILE_MAIN_ENTRY, local_cfg_check_attr[i].section, (char *)local_cfg_check_attr[i].cfg_key, cfg_array, &array_num);
if(ret2 < 0){
- /* ʹ��toml����Ҳû�ж�ȡ������, ����Ƿ��������������� */
+ /* ʹ��toml����Ҳû�ж�ȡ������, ����Ƿ��������������� */
if((local_cfg_check_attr[i].depend_id != 0) && (local_cfg_check_attr[i].cfg_value_check_fun != NULL)){
ret3 = local_cfg_check_attr[i].cfg_value_check_fun(local_cfg_check_attr, local_cfg_check_attr[i].global_id, local_cfg_check_attr[i].depend_id,
local_cfg_check_attr[i].cfg_value, local_cfg_check_attr[i].expect_range_array, local_cfg_check_attr[i].expect_array_num);
if(ret3 != 0){
fun_ret = SAPP_MAX(local_cfg_check_attr[i].err_log_level, fun_ret);
sapp_printf_colorful(fun_ret, "missing sapp.toml config: [%s] -> %s\n", local_cfg_check_attr[i].section, local_cfg_check_attr[i].cfg_key);
- /* ע��: �˴���Ҫbreak, ������е������ļ����� */
+ /* ע��: �˴���Ҫbreak, ������е������ļ����� */
}
}else{
fun_ret = SAPP_MAX(local_cfg_check_attr[i].err_log_level, fun_ret);
sapp_printf_colorful(fun_ret, "missing sapp.toml config: [%s] -> %s\n", local_cfg_check_attr[i].section, local_cfg_check_attr[i].cfg_key);
- /* ע��: �˴���Ҫbreak, ������е������ļ����� */
+ /* ע��: �˴���Ҫbreak, ������е������ļ����� */
}
}
}
@@ -2133,7 +2133,7 @@ static int sapp_config_check_missing_and_unsupport(sapp_config_check_t *local_cf
{
int ret;
- /* ע��: check_unsupport����ǰ��, ��Ϊ���и���������, ���ǰ��������õ�ֵ��ȡ��ȫ�ֱ���: g_sapp_cfg_check_attr ��*/
+ /* ע��: check_unsupport����ǰ��, ��Ϊ���и���������, ���ǰ��������õ�ֵ��ȡ��ȫ�ֱ���: g_sapp_cfg_check_attr ��*/
ret = sapp_config_check_unsupport(local_cfg_check_attr);
if(ret != 0){
sapp_printf_colorful(ret, "maybe a typo, maybe some config is obsolete, or sapp is older than sapp.toml version!\n");
@@ -2150,7 +2150,7 @@ static int sapp_config_check_missing_and_unsupport(sapp_config_check_t *local_cf
}
/*
- ���ÿ�����������ĺϷ���, ֻ�ǵ�����������ֵ�ϲ��Ϸ�, ���������Լ��.
+ ���ÿ�����������ĺϷ���, ֻ�ǵ�����������ֵ�ϲ��Ϸ�, ���������Լ��.
*/
static int sapp_config_check_single_validity(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2178,9 +2178,9 @@ static int sapp_config_check_single_validity(sapp_config_check_t *local_cfg_chec
}
/*
- ����Ӳ���֮��Ĺ����Լ��,
- ��������Ϊtransparentģʽ, ���뿪��packet_io.external.interface;
- ���翪����prometheus_enabled, ������prometheus_port��prometheus_url_path;
+ ����Ӳ���֮��Ĺ����Լ��,
+ ��������Ϊtransparentģʽ, ���뿪��packet_io.external.interface;
+ ���翪����prometheus_enabled, ������prometheus_port��prometheus_url_path;
*/
static int sapp_config_check_sanity(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2194,15 +2194,15 @@ static int sapp_config_check_sanity(sapp_config_check_t *local_cfg_check_attr)
/*
check_level:
- t1: ֻ���֧�ֵIJ����ڲ���, �Ƿ��в�֧�ֵ��²���;
- t2: ���ÿ��������ֵ�Ƿ�Ϸ�, ����packet_io.mode ����mirror, inline, tansparent��;
- t3: ������鵥������, �����ܵļ�����в������������������, ����transparentģʽû������external����;
+ t1: ֻ���֧�ֵIJ����ڲ���, �Ƿ��в�֧�ֵ��²���;
+ t2: ���ÿ��������ֵ�Ƿ�Ϸ�, ����packet_io.mode ����mirror, inline, tansparent��;
+ t3: ������鵥������, �����ܵļ�����в������������������, ����transparentģʽû������external����;
*/
int sapp_config_check(void)
{
int i, ret1, ret2, final_ret = 0;
- /* ȫ�ֱ������й̶����������, Ҳ�ж�̬�������ļ���ȡ������, ���Դ˴�copyһ����ʱ���� */
+ /* ȫ�ֱ������й̶����������, Ҳ�ж�̬�������ļ���ȡ������, ���Դ˴�copyһ����ʱ���� */
sapp_config_check_t *local_cfg_check_attr = (sapp_config_check_t *)sapp_mem_calloc(SAPP_MEM_FIX_GLOBAL_VAL, MEM_STAT_GLOBAL_THREAD_ID,sizeof(g_sapp_cfg_check_attr));
memcpy(local_cfg_check_attr, g_sapp_cfg_check_attr, sizeof(g_sapp_cfg_check_attr));
diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c
index 8969e86..5b95cf6 100644
--- a/src/dealpkt/stream_manage.c
+++ b/src/dealpkt/stream_manage.c
@@ -1,27 +1,27 @@
/*
*********************************************
-1. 20130803 ������
-1) ԭ����������hash����������Ĺ���ͬһkeyֵ�ϣ�
- �޸�Ϊ������Ԫ��Ĵ�С��������hash����ͬһ�������ϣ�
-2) ͨ���� findandsethashindex ����ʱԤ��Ҫ������������������ٲ���ʱ�����²��
+1. 20130803 ������
+1) ԭ����������hash����������Ĺ���ͬһkeyֵ�ϣ�
+ �޸�Ϊ������Ԫ��Ĵ�С��������hash����ͬһ�������ϣ�
+2) ͨ���� findandsethashindex ����ʱԤ��Ҫ������������������ٲ���ʱ�����²��
2 . adjust by lqy 20130917 streamaddlist
-1) ��������̭֮����Ҫ���¼���Ҫ�����λ��
-2) ÿ����̭��������ĿΪ��������Ŀ��2%
+1) ��������̭֮����Ҫ���¼���Ҫ�����λ��
+2) ÿ����̭��������ĿΪ��������Ŀ��2%
3 . adjust by lqy 20140810
-1) ������̭ʱ����󲻳���100��
+1) ������̭ʱ����󲻳���100��
4. adjust by lqy 20141203
-1)lruʱ����������һ���Ƿ�ʱ����ʱ������̭
+1)lruʱ����������һ���Ƿ�ʱ����ʱ������̭
5.adjust by lqy 20141212
-1)Ϊÿ��������ȫ��Ψһ����stream_index ����ͨ���������
-2)�Ƿ�֧��ȫ���ӿ��ɿ����趨
-3)ÿ�����Ӿ�����lru
-4) fix hash��ͻʱ�������������
+1)Ϊÿ��������ȫ��Ψһ����stream_index ����ͨ���������
+2)�Ƿ�֧��ȫ���ӿ��ɿ����趨
+3)ÿ�����Ӿ�����lru
+4) fix hash��ͻʱ�������������
*/
#include "sapp_api.h"
#include "sapp_private_api.h"
@@ -38,7 +38,7 @@ extern "C" {
int sapp_version_v4_20191119;
/*
- ����İ汾������packet_io_libУ��, ��ֹƽ̨��dl.so��ƥ�䵼�������쳣, �����޸���BUGδ����.
+ ����İ汾������packet_io_libУ��, ��ֹƽ̨��dl.so��ƥ�䵼�������쳣, �����޸���BUGδ����.
*/
#if IOMODE_PCAP
int sapp_packet_io_v = 20210907;
@@ -128,12 +128,12 @@ static int init_stream_detail(struct global_stream *g_stream)
g_stream->udpList[i].timeout_ratelimiter = g_stream->udp_timeout_ratelimiter;
}
- //Ԥ�ȷ���hashָ��
+ //Ԥ�ȷ���hashָ��
g_stream->tcp_stream_table = (struct streamindex **)sapp_mem_malloc(SAPP_MEM_FIX_GLOBAL_STREAM, -1, tcp_stream_table_size * sizeof(char *));
memset(g_stream->tcp_stream_table, 0, tcp_stream_table_size * sizeof(char *));
g_stream->udp_stream_table = (struct streamindex **)sapp_mem_malloc(SAPP_MEM_FIX_GLOBAL_STREAM, -1, udp_stream_table_size * sizeof(char *));
memset(g_stream->udp_stream_table, 0, udp_stream_table_size * sizeof(char *));
- //��¼hash��״̬
+ //��¼hash��״̬
g_stream->tcp_stream_talbe_hash_count = (unsigned short *)sapp_mem_malloc(SAPP_MEM_FIX_GLOBAL_STREAM, -1, tcp_stream_table_size * sizeof(short));
memset(g_stream->tcp_stream_talbe_hash_count, 0, tcp_stream_table_size * sizeof(short));
g_stream->udp_stream_talbe_hash_count = (unsigned short *)sapp_mem_malloc(SAPP_MEM_FIX_GLOBAL_STREAM, -1, udp_stream_table_size * sizeof(short));
@@ -141,7 +141,7 @@ static int init_stream_detail(struct global_stream *g_stream)
int max_cnt = tcp_stream_table_size + udp_stream_table_size;
- //Ԥ�ȷ���stream_index��
+ //Ԥ�ȷ���stream_index��
STAILQ_INIT(&g_stream->freeList);
g_stream->__freeList_real_head = (struct stream_index_list_item *)sapp_mem_malloc(SAPP_MEM_FIX_GLOBAL_STREAM, -1, (max_cnt) * sizeof(struct stream_index_list_item));
memset(g_stream->__freeList_real_head, 0, (max_cnt) * sizeof(struct stream_index_list_item));
@@ -168,7 +168,7 @@ int tcp_set_creatlink_model(int model)
tcp_creatlink_model=model;
return 0;
}
-//�����Ƿ���tcpallģʽ
+//�����Ƿ���tcpallģʽ
int tcp_set_support_tcpall_model(int model)
{
tcp_support_all=model;
@@ -180,7 +180,7 @@ int tcp_set_default_unorder_num(unsigned short max_unorder)
return 0;
}
-int tcp_set_max_unorder(int max_unorder) //2014-12-25 lijia add, ���ݾ�ƽ̨, xj_fd
+int tcp_set_max_unorder(int max_unorder) //2014-12-25 lijia add, ���ݾ�ƽ̨, xj_fd
{
tcp_default_unorder=max_unorder;
return 0;
@@ -230,11 +230,11 @@ static void stream_timeout_shift_lrulist(struct streamindex *pindex, unsigned sh
/*
NOTE:
- �����õij�ʱʱ������ȫ�ֱ�׼timeoutֵ��!!
- ��Ϊȫ����������ֻ��һ��LRU_time����,
- ������ֵ�ܴ�, ���Խ���ǰ����LRUĩβ�����ʵ�λ��,
- �������ǰֵ��ȫ�ֱ�׼С, ������Ҫ��LRU������tail����ѯ�ܶ���������ҵ��ʵ�λ��,
- ���µ�����ʱ̫��.
+ �����õij�ʱʱ������ȫ�ֱ�׼timeoutֵ��!!
+ ��Ϊȫ����������ֻ��һ��LRU_time����,
+ ������ֵ�ܴ�, ���Խ���ǰ����LRUĩβ�����ʵ�λ��,
+ �������ǰֵ��ȫ�ֱ�׼С, ������Ҫ��LRU������tail����ѯ�ܶ���������ҵ��ʵ�λ��,
+ ���µ�����ʱ̫��.
*/
int stream_set_single_stream_timeout(const struct streaminfo *pstream,unsigned short timeout)
{
@@ -242,7 +242,7 @@ int stream_set_single_stream_timeout(const struct streaminfo *pstream,unsigned s
struct streaminfo_private *pstream_pr=(struct streaminfo_private *)pstream;
struct streamindex *pindex;
- if(OP_STATE_CLOSE == pstream->opstate && OP_STATE_CLOSE == pstream->pktstate){/* ��ǰ���ѽ���, ���賬ʱҲû�������� */
+ if(OP_STATE_CLOSE == pstream->opstate && OP_STATE_CLOSE == pstream->pktstate){/* ��ǰ���ѽ���, ���賬ʱҲû�������� */
return -1;
}
@@ -251,7 +251,7 @@ int stream_set_single_stream_timeout(const struct streaminfo *pstream,unsigned s
{
if (pstream_pr->set_special_timeout == 0)
{
- /* �������������ó�ʱʱ��, ��ǰ����һ�����ó�ʱʱ���¼���� */
+ /* �������������ó�ʱʱ��, ��ǰ����һ�����ó�ʱʱ���¼���� */
sapp_global_mthread[pstream->threadnum].udp_stream_special_timeout_num++;
}
}
@@ -259,13 +259,13 @@ int stream_set_single_stream_timeout(const struct streaminfo *pstream,unsigned s
{
if (pstream_pr->set_special_timeout == 0)
{
- /* �������������ó�ʱʱ��, ��ǰ����һ�����ó�ʱʱ���¼���� */
+ /* �������������ó�ʱʱ��, ��ǰ����һ�����ó�ʱʱ���¼���� */
sapp_global_mthread[pstream->threadnum].tcp_stream_special_timeout_num++;
}
}
else
{
- goto err; /* ��֧��TCP��UDP�� */
+ goto err; /* ��֧��TCP��UDP�� */
}
if(pstream_pr->plugin_process_context != 0)
{
@@ -386,9 +386,9 @@ void streamaddlist(struct streamindex *pindex,struct stream_list *plist)
next_timeout_ms = tcp_opening_timeout * 1000 + g_CurrentTime_ms;
}
else if ((pstream->stream_state == TCP_NOUSE_STATE && pstream->type == STREAM_TYPE_TCP) &&
- (pstream_pr->set_special_timeout == 0 || sapp_global_val->config.stream.tcp.nouse_set_special_timeout == 0))
+ (sapp_global_val->config.stream.tcp.fast_close_nouse == 1))
{
- if(pstream->opstate == OP_STATE_CLOSE && pstream->pktstate == OP_STATE_CLOSE)
+ if(pstream_pr->set_special_timeout==0)
{
next_timeout_ms = tcp_closing_timeout * 1000 + g_CurrentTime_ms;
}
@@ -439,7 +439,7 @@ struct streamindex *malloc_and_copy_streamindex(int threadnum, struct streaminde
pindex->stream.stream_carry_up_layer_tunnel_type = 0;
pindex->stream.stream_low_layer_tunnel_type = 0;
- //pindex->stream.global_stream_id = get_global_stream_id(threadnum);//�ƶ���streamaddlist,��Ԫ������ʱ���ᱻ����.
+ //pindex->stream.global_stream_id = get_global_stream_id(threadnum);//�ƶ���streamaddlist,��Ԫ������ʱ���ᱻ����.
return pindex;
@@ -463,15 +463,15 @@ void free_streamindex(int threadnum,struct streamindex *pindex)
extern int call_streamentry(struct streaminfo *a_stream, const void *this_iphdr, const void *transport_hdr, const void *raw_pkt, StreamFunInfo *pFunInfo);
//add by lqy 20141203
-//�������β�������һ�������Ƿ�ʱ�������ʱ����̭֮
+//�������β�������һ�������Ƿ�ʱ�������ʱ����̭֮
-/* 2015-06-10 lijia add arg "current_drive_index", ��ʾ��ǰ���ṹָ��
+/* 2015-06-10 lijia add arg "current_drive_index", ��ʾ��ǰ���ṹָ��
return value:
0: normal;
1: del self by time.
modify by lqy 20150612
- ��ʱɾ��������ͷ����ʼ��һ��ɾ��
+ ��ʱɾ��������ͷ����ʼ��һ��ɾ��
*/
enum del_stream_by_time_returen_code
@@ -516,10 +516,10 @@ int del_stream_by_time(struct stream_list *plist, const struct streamindex *curr
struct streaminfo *pstream = &(pstream_pr->stream_public);
if (pindex == current_drive_index)
- { /* ��ǰ�����ڵ�����ʱ, ˵��֮ǰ�ܳ�ʱ��û�а�����, ��ʱ����free, ���Ƿ���1, �ٵ���reset */
+ { /* ��ǰ�����ڵ�����ʱ, ˵��֮ǰ�ܳ�ʱ��û�а�����, ��ʱ����free, ���Ƿ���1, �ٵ���reset */
if (STREAM_TYPE_TCP == pstream->type)
{
- /* 2016-12-15 lijia add, ��ʱreset֮ǰ, ��Ҫ����link_state */
+ /* 2016-12-15 lijia add, ��ʱreset֮ǰ, ��Ҫ����link_state */
((struct tcpdetail_private *)(pstream->pdetail))->link_state = STREAM_LINK_TIMEOUT;
}
ret = DEL_STREAM_BY_TIME_RET_DEL_SELF;
@@ -611,9 +611,9 @@ int lrustream(struct streamindex *pindex)
timeouts_add(plist->streamindex_timer, &pindex->timeout, tcp_opening_timeout * 1000 + g_CurrentTime_ms);
}
else if (pstream->stream_state == TCP_NOUSE_STATE && pstream->type == STREAM_TYPE_TCP &&
- (pstream_pr->set_special_timeout == 0 || sapp_global_val->config.stream.tcp.nouse_set_special_timeout == 0))
+ (sapp_global_val->config.stream.tcp.fast_close_nouse == 1))
{
- if(pstream->opstate == OP_STATE_CLOSE && pstream->pktstate == OP_STATE_CLOSE)
+ if(pstream_pr->set_special_timeout==0)
{
timeouts_add(plist->streamindex_timer, &pindex->timeout, tcp_closing_timeout * 1000 + g_CurrentTime_ms);
}
@@ -634,9 +634,9 @@ int lrustream(struct streamindex *pindex)
}
/*
- MPLS���ַ����ipv4,ipv6,tcp,udp����, �յ�����һ���������ƶ���һ��ĵ�ַ,
- MPLS��ַ�ǵ����, �������п����Dz��Գƴ��ڵ�, ��һ���ж���һ��û��.
- ����, �Ƚϵ�ַ���ַ���.
+ MPLS���ַ����ipv4,ipv6,tcp,udp����, �յ�����һ���������ƶ���һ��ĵ�ַ,
+ MPLS��ַ�ǵ����, �������п����Dz��Գƴ��ڵ�, ��һ���ж���һ��û��.
+ ����, �Ƚϵ�ַ���ַ���.
*/
static int cmpaddr_mpls(const struct layer_addr_mpls *addr_heap, const struct layer_addr_mpls *addr_stack)
{
@@ -644,19 +644,19 @@ static int cmpaddr_mpls(const struct layer_addr_mpls *addr_heap, const struct la
int same_dir_diff = 0, reverse_dir_diff = 0;
if(0 == addr_stack->c2s_layer_num){
- return 0; /* �����İ�mpls�ǿղ�, ���ñȽ� */
+ return 0; /* �����İ�mpls�ǿղ�, ���ñȽ� */
}
if((addr_heap->c2s_layer_num == 0) || (addr_heap->s2c_layer_num == 0)){
- /* �������ĵ�ַijһ����0, Ҳ���ǵ�����, ����û�յ����Բ�����;
- Ҳ����ijһ���ǿղ�, ������û��mpls,
- ��ʱû���ж���һ�����Բ����ݰ��״ε���, ���Ǹ�������һ����������һ�������״ε���,
- �Ȳ��Ƚϵ�ַ��.
+ /* �������ĵ�ַijһ����0, Ҳ���ǵ�����, ����û�յ����Բ�����;
+ Ҳ����ijһ���ǿղ�, ������û��mpls,
+ ��ʱû���ж���һ�����Բ����ݰ��״ε���, ���Ǹ�������һ����������һ�������״ε���,
+ �Ȳ��Ƚϵ�ַ��.
*/
return 0;
}
- /* ����Ƚϵ�ַ */
+ /* ����Ƚϵ�ַ */
if(addr_heap->c2s_layer_num != addr_stack->c2s_layer_num){
same_dir_diff = 1;
}else{
@@ -668,7 +668,7 @@ static int cmpaddr_mpls(const struct layer_addr_mpls *addr_heap, const struct la
}
}
- /* ����Ƚϵ�ַ */
+ /* ����Ƚϵ�ַ */
if(addr_heap->s2c_layer_num != addr_stack->c2s_layer_num){
reverse_dir_diff = 1;
}else{
@@ -680,7 +680,7 @@ static int cmpaddr_mpls(const struct layer_addr_mpls *addr_heap, const struct la
}
}
- if(same_dir_diff && reverse_dir_diff){ /* ���������ַ����һ�� */
+ if(same_dir_diff && reverse_dir_diff){ /* ���������ַ����һ�� */
return -1;
}
@@ -689,9 +689,9 @@ static int cmpaddr_mpls(const struct layer_addr_mpls *addr_heap, const struct la
static int cmpaddr_gtp(const struct layer_addr_gtp *addr_heap, const struct layer_addr_gtp *addr_stack)
{
- /* stack �ĵ�ַ�̶��洢��c2s����
- gtp��ַ�Ƚ�ʱ, ���ַ���, �����ⷽ���teid����ͬ, ����Ϊ��һ��������
- ֮ǰ��pcap���з�������ַ��ijһ���teid���仯�����.
+ /* stack �ĵ�ַ�̶��洢��c2s����
+ gtp��ַ�Ƚ�ʱ, ���ַ���, �����ⷽ���teid����ͬ, ����Ϊ��һ��������
+ ֮ǰ��pcap���з�������ַ��ijһ���teid���仯�����.
*/
if(0 != addr_heap->teid_c2s){
if(addr_heap->teid_c2s == addr_stack->teid_c2s){
@@ -715,11 +715,11 @@ static int cmpaddr_positive(void *addr_heap, void *addr_stack, UCHAR addrtype,
switch(addrtype){
case ADDR_TYPE_IPV4:
{
- /* 2015-07-14 lijia modify, ��Ҫ�Ƚ϶˿� */
+ /* 2015-07-14 lijia modify, ��Ҫ�Ƚ϶˿� */
struct stream_tuple4_v4 *ip4_addr_heap = (struct stream_tuple4_v4 *)addr_heap;
struct stream_tuple4_v4 *ip4_addr_stack = (struct stream_tuple4_v4 *)addr_stack;
- /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
+ /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
ret = (int)ip4_addr_heap->source - (int)ip4_addr_stack->source;
if(ret != 0){
return ret;
@@ -743,7 +743,7 @@ static int cmpaddr_positive(void *addr_heap, void *addr_stack, UCHAR addrtype,
{
struct stream_tuple4_v6 *ip6_addr_heap = (struct stream_tuple4_v6 *)addr_heap;
struct stream_tuple4_v6 *ip6_addr_stack = (struct stream_tuple4_v6 *)addr_stack;
- /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
+ /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
ret = (int)ip6_addr_heap->source - (int)ip6_addr_stack->source;
if(ret != 0){
return ret;
@@ -804,7 +804,7 @@ static int cmpaddr_positive(void *addr_heap, void *addr_stack, UCHAR addrtype,
break;
default:
- /* ������ַ����, ��VLAN, L2TP��, �޷���������, ����ת��, ֱ�ӱȽϼ��� */
+ /* ������ַ����, ��VLAN, L2TP��, �޷���������, ����ת��, ֱ�ӱȽϼ��� */
ret = memcmp(addr_heap, addr_stack, addrlen);
}
@@ -817,11 +817,11 @@ static int cmpaddr_reverse(void *addr_heap, void *addr_stack, UCHAR addrtype, U
switch(addrtype){
case ADDR_TYPE_IPV4:
{
- /* 2015-07-14 lijia modify, ��Ҫ�Ƚ϶˿� */
+ /* 2015-07-14 lijia modify, ��Ҫ�Ƚ϶˿� */
struct stream_tuple4_v4 *ip4_addr_heap = (struct stream_tuple4_v4 *)addr_heap;
struct stream_tuple4_v4 *ip4_addr_stack = (struct stream_tuple4_v4 *)addr_stack;
- /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
+ /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
ret = (int)ip4_addr_heap->source - (int)ip4_addr_stack->dest;
if(ret != 0){
return ret;
@@ -845,7 +845,7 @@ static int cmpaddr_reverse(void *addr_heap, void *addr_stack, UCHAR addrtype, U
{
struct stream_tuple4_v6 *ip6_addr_heap = (struct stream_tuple4_v6 *)addr_heap;
struct stream_tuple4_v6 *ip6_addr_stack = (struct stream_tuple4_v6 *)addr_stack;
- /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
+ /* 2015-07-15 lijia modify, ����ܲ�һ���ı���������ǰ��Ƚ� */
ret = (int)ip6_addr_heap->source - (int)ip6_addr_stack->dest;
if(ret != 0){
return ret;
@@ -906,7 +906,7 @@ static int cmpaddr_reverse(void *addr_heap, void *addr_stack, UCHAR addrtype, U
break;
default:
- /* ������ַ����, ��VLAN, L2TP��, �޷���������, ����ת�� */
+ /* ������ַ����, ��VLAN, L2TP��, �޷���������, ����ת�� */
ret = memcmp(addr_heap, addr_stack, addrlen);
}
@@ -930,7 +930,7 @@ static int cmpaddr_new(struct streaminfo_private *pheap_stream_pr,
ret = cmpaddr_positive(heap_addr->paddr, stack_addr->paddr,
heap_addr->addrtype, heap_addr->addrlen);
}else{
- /* 2015-03-04 lijia add, �����ַ�Ƚ�, ������COPY.*/
+ /* 2015-03-04 lijia add, �����ַ�Ƚ�, ������COPY.*/
ret = cmpaddr_reverse(heap_addr->paddr, stack_addr->paddr,
heap_addr->addrtype, heap_addr->addrlen);
}
@@ -945,8 +945,8 @@ static int cmpaddr_new(struct streaminfo_private *pheap_stream_pr,
/*
- GTP�Ķ˿ڿ������඼��һ��, ��asymmetric addr,
- �˴����¶˿������һ��ip��teid�ı�İ�Ϊ׼.
+ GTP�Ķ˿ڿ������඼��һ��, ��asymmetric addr,
+ �˴����¶˿������һ��ip��teid�ı�İ�Ϊ׼.
*/
static void update_outer_ipv4addr_for_gtp_tunnel(const struct streaminfo_private *top_stream_pr,
struct streaminfo_private *pheap_gtp_stream_pr, struct streaminfo_private *pstack_gtp_stream_pr,
@@ -982,7 +982,7 @@ static void update_outer_ipv4addr_for_gtp_tunnel(const struct streaminfo_private
return;
}
- /******** for debug log, Ҫ���ڵ�ַ���µ�ǰ��, ����ԭʼ��Ϣ�ͱ������� ********/
+ /******** for debug log, Ҫ���ڵ�ַ���µ�ǰ��, ����ԭʼ��Ϣ�ͱ������� ********/
if(MESA_handle_runtime_log_level_enabled(ABBR_SAPP_LOG_HANDLE, RLOG_LV_DEBUG)){
char ip_before_src_str[INET_ADDRSTRLEN], ip_before_dst_str[INET_ADDRSTRLEN];
char ip_after_src_str[INET_ADDRSTRLEN], ip_after_dst_str[INET_ADDRSTRLEN];
@@ -997,7 +997,7 @@ static void update_outer_ipv4addr_for_gtp_tunnel(const struct streaminfo_private
after_teid_c2s = ntohl(pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s);
after_teid_s2c = before_teid_s2c;
}else{
- after_teid_s2c = ntohl(pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s); /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
+ after_teid_s2c = ntohl(pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s); /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
after_teid_c2s = before_teid_c2s;
}
@@ -1024,7 +1024,7 @@ static void update_outer_ipv4addr_for_gtp_tunnel(const struct streaminfo_private
heap_tuple4addr->daddr = stack_tuple4addr->saddr;
heap_tuple4addr->source = stack_tuple4addr->dest;
heap_tuple4addr->dest = stack_tuple4addr->source;
- pheap_gtp_stream_pr->stream_public.addr.gtp->teid_s2c = pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s; /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
+ pheap_gtp_stream_pr->stream_public.addr.gtp->teid_s2c = pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s; /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
}
return;
@@ -1064,7 +1064,7 @@ static void update_outer_ipv6addr_for_gtp_tunnel(const struct streaminfo_private
return;
}
- /******** for debug log, Ҫ���ڵ�ַ���µ�ǰ��, ����ԭʼ��Ϣ�ͱ������� ********/
+ /******** for debug log, Ҫ���ڵ�ַ���µ�ǰ��, ����ԭʼ��Ϣ�ͱ������� ********/
if( MESA_handle_runtime_log_level_enabled(ABBR_SAPP_LOG_HANDLE, RLOG_LV_DEBUG)){
char ip_before_src_str[INET_ADDRSTRLEN], ip_before_dst_str[INET_ADDRSTRLEN];
char ip_after_src_str[INET_ADDRSTRLEN], ip_after_dst_str[INET_ADDRSTRLEN];
@@ -1079,7 +1079,7 @@ static void update_outer_ipv6addr_for_gtp_tunnel(const struct streaminfo_private
after_teid_c2s = ntohl(pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s);
after_teid_s2c = before_teid_s2c;
}else{
- after_teid_s2c = ntohl(pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s); /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
+ after_teid_s2c = ntohl(pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s); /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
after_teid_c2s = before_teid_c2s;
}
@@ -1111,16 +1111,16 @@ static void update_outer_ipv6addr_for_gtp_tunnel(const struct streaminfo_private
memcpy(heap_tuple6addr->daddr, stack_tuple6addr->saddr, IPV6_ADDR_LEN);
heap_tuple6addr->source = stack_tuple6addr->dest;
heap_tuple6addr->dest = stack_tuple6addr->source;
- pheap_gtp_stream_pr->stream_public.addr.gtp->teid_s2c = pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s; /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
+ pheap_gtp_stream_pr->stream_public.addr.gtp->teid_s2c = pstack_gtp_stream_pr->stream_public.addr.gtp->teid_c2s; /* �˴����DZ���!! stack����ʱջ�ռ�, teid�̶�����c2s������ */
}
return;
}
/*
- GTP���������IP��Ԫ��, ���վ��Ǩ��, ���IP���ܱ仯.
+ GTP���������IP��Ԫ��, ���վ��Ǩ��, ���IP���ܱ仯.
- pheap_stream_pr, pstack_stream_prָ��GTP��һ���ip/udp��.
+ pheap_stream_pr, pstack_stream_prָ��GTP��һ���ip/udp��.
*/
static int checkstreamorder_for_gtp_tunnel(const struct streaminfo_private *top_stream_pr,
struct streaminfo_private *pheap_gtp_stream_pr, struct streaminfo_private *pstack_gtp_stream_pr,
@@ -1145,8 +1145,8 @@ static int checkstreamorder_for_gtp_tunnel(const struct streaminfo_private *top_
}
}
- /* ���ip��ַ��仯, ���ĸ�ip�����ܶ���һ��, �����ⷽ���ַ��ͬ, ������Ϊ������ͬһ��GTP����
- TODO, �˴���ҪͬGTP-C���� ??
+ /* ���ip��ַ��仯, ���ĸ�ip�����ܶ���һ��, �����ⷽ���ַ��ͬ, ������Ϊ������ͬһ��GTP����
+ TODO, �˴���ҪͬGTP-C���� ??
*/
if (pheap_stream->addr.addrtype == pstack_stream->addr.addrtype && pheap_stream->addr.addrlen == pstack_stream->addr.addrlen)
{
@@ -1214,18 +1214,18 @@ static int checkstreamorder_for_gtp_tunnel(const struct streaminfo_private *top_
pstack_stream->addr.addrlen);
}
- if(0 == this_layer_is_same){ /* �����ַȫ��һ��, ��Ϊ��������һ������, ֱ�ӷ��ش��� */
+ if(0 == this_layer_is_same){ /* �����ַȫ��һ��, ��Ϊ��������һ������, ֱ�ӷ��ش��� */
return -1;
}
- /* �����Ƚ���һ���ַ */
+ /* �����Ƚ���һ���ַ */
ret=checkstreamorder(top_stream_pr, (struct streaminfo_private *)(pheap_ip_stream_pr->pfather_pr),
(struct streaminfo_private *)(pstack_ip_stream_pr->pfather_pr),
heap_streaminfo_skip_layer_num, stack_streaminfo_skip_layer_num);
if(0 == ret){
- /* ִ�е���, ���е�ַ����ͬ, �����Dz����ڵ�ַ�Ƚ�, ˵����ǰ��pheap_stream_pr,pstack_stream_pr��ͬ����һ���ϲ�TCP/UDP��,
- ���Ը�������ipv4/udp����Ϣ.
+ /* ִ�е���, ���е�ַ����ͬ, �����Dz����ڵ�ַ�Ƚ�, ˵����ǰ��pheap_stream_pr,pstack_stream_pr��ͬ����һ���ϲ�TCP/UDP��,
+ ���Ը�������ipv4/udp����Ϣ.
*/
if(pheap_stream->addr.addrtype == ADDR_TYPE_IPV4)
@@ -1242,9 +1242,9 @@ static int checkstreamorder_for_gtp_tunnel(const struct streaminfo_private *top_
}
-/*�Ƚ��������ṹ���С */
-//adjust 20140324 �Ƚ��������ṹ�Ƿ���ͬ������pfather �ڵ���ȫ��ͬ,
-//�ݹ�Ƚ��������ĸ��������
+/*�Ƚ��������ṹ���С */
+//adjust 20140324 �Ƚ��������ṹ�Ƿ���ͬ������pfather �ڵ���ȫ��ͬ,
+//�ݹ�Ƚ��������ĸ��������
/*
return value:
0 : found, success;
@@ -1289,9 +1289,9 @@ int checkstreamorder(const struct streaminfo_private *top_stream_pr, struct stre
pstack_stream = &pstack_stream_pr->stream_public;
- /* GTP��TEID��仯, ���ܼ򵥵ıȽ�addr����, ���Ա���addr_use_as_hash=0,
- ���Ի�����gtp���Ƚ��²��ip/udp, ��������ip�Ͷ˿ڿ��ܻ�Ư��, Ҳ���ܰ����淽ʽ�Ƚ�ip��port,
- ����GTP��һ�����⴦��.
+ /* GTP��TEID��仯, ���ܼ򵥵ıȽ�addr����, ���Ա���addr_use_as_hash=0,
+ ���Ի�����gtp���Ƚ��²��ip/udp, ��������ip�Ͷ˿ڿ��ܻ�Ư��, Ҳ���ܰ����淽ʽ�Ƚ�ip��port,
+ ����GTP��һ�����⴦��.
*/
switch(pstack_stream->addr.addrtype){
case ADDR_TYPE_GPRS_TUNNEL:
@@ -1322,7 +1322,7 @@ int checkstreamorder(const struct streaminfo_private *top_stream_pr, struct stre
if(0 != ret){
return ret;
}else{
- /* 2015-03-11 lijia add, ��Ҫ����ǰ��IP��İ���Ϣ���ݵ�����Ϣ */
+ /* 2015-03-11 lijia add, ��Ҫ����ǰ��IP��İ���Ϣ���ݵ�����Ϣ */
pheap_stream_pr->stream_public.addr.pktipfragtype = pstack_stream_pr->stream_public.addr.pktipfragtype;
}
@@ -1339,14 +1339,14 @@ int checkstreamorder(const struct streaminfo_private *top_stream_pr, struct stre
}
/*
- ���ڷǶԳ�Э������Ķ�׼.
+ ���ڷǶԳ�Э������Ķ�׼.
- ����:
+ ����:
heap stream : tuple4->eth,
stack stream: tuple4->mpls->eth,
- ���������, ������Ϊ�ڲ�tcp��ͬ����һ����.
+ ���������, ������Ϊ�ڲ�tcp��ͬ����һ����.
- ��׼֮��:
+ ��׼֮��:
heap stream : tuple4->mpls->eth
*/
static void streaminfo_layer_alignment(const struct streaminfo *top_stream, struct streaminfo_private *heap_stream_pr, struct streaminfo_private *stack_stream_pr)
@@ -1364,14 +1364,14 @@ static void streaminfo_layer_alignment(const struct streaminfo *top_stream, stru
if(heap_stream_pr->pfather_pr->stream_public.addr.addrtype != stack_stream_pr->pfather_pr->stream_public.addr.addrtype){
/*
- new_heap_tmp��ʱִ��mpls��
+ new_heap_tmp��ʱִ��mpls��
*/
if(STREAM_TYPE_TCP == top_stream->type){
mem_used_type = SAPP_MEM_DYN_TCP_STREAM;
}else{
mem_used_type = SAPP_MEM_DYN_UDP_STREAM;
}
- new_heap_tmp = copy_stream_info_to_heap_single_layer(mem_used_type, stack_stream_pr->pfather_pr, 1); /* ����׼ʱ, �϶��ǶԲ�����, ����copy, ��Ϊͬ��Ͳ����ڲ�����һ����, reverse�̶�Ϊ1 */
+ new_heap_tmp = copy_stream_info_to_heap_single_layer(mem_used_type, stack_stream_pr->pfather_pr, 1); /* ����׼ʱ, �϶��ǶԲ�����, ����copy, ��Ϊͬ��Ͳ����ڲ�����һ����, reverse�̶�Ϊ1 */
new_heap_tmp->pfather_pr = heap_stream_pr->pfather_pr;
new_heap_tmp->stream_public.pfather = &heap_stream_pr->pfather_pr->stream_public;
@@ -1386,8 +1386,8 @@ static void streaminfo_layer_alignment(const struct streaminfo *top_stream, stru
}
/*
- plinkhead: �Ѵ���������htable��ij��slot�ĵ�һ���ڵ�;
- pinsert : ��ǰ��������ʱջ�ռ�����ַ.
+ plinkhead: �Ѵ���������htable��ij��slot�ĵ�һ���ڵ�;
+ pinsert : ��ǰ��������ʱջ�ռ�����ַ.
*/
static struct streamindex * findandsethashindex_lru(struct streamindex *plinkhead, struct streamindex *pinsert)
{
@@ -1399,12 +1399,12 @@ static struct streamindex * findandsethashindex_lru(struct streamindex *plinkhea
unsigned long hash_list_num = 0;
UCHAR threadnum = psinsert_pr->stream_public.threadnum;
sapp_gval_mthread_sys_stat_t *local_sys_stat = &sapp_global_val->mthread_volatile[threadnum]->sys_stat;
- int stack_streaminfo_skip_layer_num = 0, heap_streaminfo_skip_layer_num = 0; /* ����Ҫ��ַ�Ƚϲ������ */
+ int stack_streaminfo_skip_layer_num = 0, heap_streaminfo_skip_layer_num = 0; /* ����Ҫ��ַ�Ƚϲ������ */
while(phead!=NULL)
{
pshead_pr=&(phead->stream);
- /* 2015-12-14 lijia add, ��ͨ���ڶ���HASHֵԤ���ж��Ƿ����, ���HASH��ͬ, ��ַ�϶���ͬ */
+ /* 2015-12-14 lijia add, ��ͨ���ڶ���HASHֵԤ���ж��Ƿ����, ���HASH��ͬ, ��ַ�϶���ͬ */
if(pshead_pr->hash_slave != psinsert_pr->hash_slave){
phead=phead->phashnext;
hash_list_num++;
@@ -1443,9 +1443,9 @@ static struct streamindex * findandsethashindex_lru(struct streamindex *plinkhea
/*
-//�����������˵�����
-//1) �ж��Ƿ������
-//2) �������ķ�����Ϣ ,dir ,curdir ,routdir
+//�����������˵�����
+//1) �ж��Ƿ������
+//2) �������ķ�����Ϣ ,dir ,curdir ,routdir
*/
struct streamindex *findstreamindex(struct streamindex *pindex, const raw_pkt_t *raw_pkt)
{
@@ -1493,8 +1493,8 @@ struct streamindex *findstreamindex(struct streamindex *pindex, const raw_pkt_t
elemcount=this_thread_stream->tcp_stream_talbe_hash_count[hash_index];
}
- if(0 == elemcount){ /* 2015-12-14 lijia add, HASH����ǰSLOT��û����, ֱ�ӷ��� */
- ptmp->hash_index = hash_index; /* �������õ���HASHֵ */
+ if(0 == elemcount){ /* 2015-12-14 lijia add, HASH����ǰSLOT��û����, ֱ�ӷ��� */
+ ptmp->hash_index = hash_index; /* �������õ���HASHֵ */
return NULL;
}
@@ -1505,11 +1505,11 @@ struct streamindex *findstreamindex(struct streamindex *pindex, const raw_pkt_t
/*
2015-12-14 lijia add
NOTE:
- �����ǰ������N�ζ�����HASH_SLOT�ĵ�һλ, ���ƶ�����һλ, �ƶ����������,
- �´β��ҿ�������,
- ͬʱ��ֹ����һ��SLOT�ļ�������Ƶ���а��������, ָ��Ƶ�������ƶ�, ������������.
+ �����ǰ������N�ζ�����HASH_SLOT�ĵ�һλ, ���ƶ�����һλ, �ƶ����������,
+ �´β��ҿ�������,
+ ͬʱ��ֹ����һ��SLOT�ļ�������Ƶ���а��������, ָ��Ƶ�������ƶ�, ������������.
- Ŀ�����ĸ��������ݰ��϶�, ˭�;�����SLOT��һλ.
+ Ŀ�����ĸ��������ݰ��϶�, ˭�;�����SLOT��һλ.
*/
if((a_index != phashstream[hash_index]) && (a_index->stream.hash_not_head_times++ > 5)){
if(a_index->phashnext){
@@ -1580,7 +1580,7 @@ void hash_add_stream(struct streamindex *pindex)
}
- /* ����HASH-Slot��һ��λ�� */
+ /* ����HASH-Slot��һ��λ�� */
if(phashstream[hash_index]!=NULL)
phashstream[hash_index]->phashprev=pindex;
pindex->phashnext=phashstream[hash_index];
@@ -1588,8 +1588,8 @@ void hash_add_stream(struct streamindex *pindex)
pelementcount[hash_index]++;
- /* TCP, UDP�½���ʱ������ô˺���, ���԰�ddos���ŵ��˴�,
- �����мDz�Ҫ�ŵ�streamaddlist()����, ��Ϊͬһ�����л���ͬ״̬ʱ, ���ܻ����streamaddlist()�ü���.
+ /* TCP, UDP�½���ʱ������ô˺���, ���԰�ddos���ŵ��˴�,
+ �����мDz�Ҫ�ŵ�streamaddlist()����, ��Ϊͬһ�����л���ͬ״̬ʱ, ���ܻ����streamaddlist()�ü���.
*/
if(pindex->stream.create_dir_by_well_known_port != 1)
{
@@ -1879,7 +1879,7 @@ int addr_dir_relation(void *addr, int addrtype)
break;
default:
- /* ������ַ�����޷���������, Ĭ��Ϊ0 */
+ /* ������ַ�����޷���������, Ĭ��Ϊ0 */
relation = 0;
break;
}
@@ -1887,7 +1887,7 @@ int addr_dir_relation(void *addr, int addrtype)
return relation;
}
-/* ��addr��ַ���� */
+/* ��addr��ַ���� */
void reverse_addr(void *addr, int addrtype)
{
UINT16 tmp_ushort;
@@ -1951,14 +1951,14 @@ void reverse_addr(void *addr, int addrtype)
/* TODO 1:PPTP-addr */
default:
- /* ������ַ����, ��VLAN, L2TP��, �޷���������, ����ת�� */
+ /* ������ַ����, ��VLAN, L2TP��, �޷���������, ����ת�� */
return;
}
return;
}
-/* �����ַcopy */
+/* �����ַcopy */
void addr_reverse_memcpy(const struct streaminfo_private *stack_stream_pr, void *daddr, const void *saddr, int addrtype, int addrlen)
{
switch(addrtype){
@@ -1984,42 +1984,42 @@ void addr_reverse_memcpy(const struct streaminfo_private *stack_stream_pr, void
}
break;
- case ADDR_TYPE_MAC: /* 2015-06-15 lijia add, ľ������豸���� */
+ case ADDR_TYPE_MAC: /* 2015-06-15 lijia add, ľ������豸���� */
{
const struct layer_addr_mac *cur_stack_mac_saddr = (const struct layer_addr_mac *) saddr;
struct layer_addr_mac *heap_stream_mac_daddr = (struct layer_addr_mac *) daddr;
- //if (1 == sapp_global_val->config.protocol_feature.reverse_ethernet_addr_enabled) //2018-12-07 yw add, mac��ַ�а�����Ϣʱ���跭ת
+ //if (1 == sapp_global_val->config.protocol_feature.reverse_ethernet_addr_enabled) //2018-12-07 yw add, mac��ַ�а�����Ϣʱ���跭ת
if(g_asymmetric_addr_layer_set.layer_type_index[ADDR_TYPE_MAC][stack_stream_pr->layer_index] == 0){
- /* �������ǶԳƵ�ַ����ʱ, ethernet��ip,tcpһ��, �ߵ�Դ��Ŀ�ĵ�ַ����,˫���ַ���洢��src_addr */
+ /* �������ǶԳƵ�ַ����ʱ, ethernet��ip,tcpһ��, �ߵ�Դ��Ŀ�ĵ�ַ����,˫���ַ���洢��src_addr */
memcpy(heap_stream_mac_daddr->src_addr.h_source, cur_stack_mac_saddr->src_addr.h_dest, ETH_ALEN);
memcpy(heap_stream_mac_daddr->src_addr.h_dest, cur_stack_mac_saddr->src_addr.h_source, ETH_ALEN);
}else{
- /* �����ǶԳƵ�ַ����ʱ,������������ĸ�mac��ַ,��ʱҪ����copy 14���ֽ�, ��ջ�е�src_addr����heap��dst_addr��, ����struct ethhdr�еĵ�ַ�����ܱ� */
+ /* �����ǶԳƵ�ַ����ʱ,������������ĸ�mac��ַ,��ʱҪ����copy 14���ֽ�, ��ջ�е�src_addr����heap��dst_addr��, ����struct ethhdr�еĵ�ַ�����ܱ� */
memcpy(&heap_stream_mac_daddr->dst_addr, &cur_stack_mac_saddr->src_addr, sizeof(struct ethhdr));
}
}
break;
- case __ADDR_TYPE_IP_PAIR_V4: /* ��IPv4��, ͨ���ǻ�������ģʽ */
+ case __ADDR_TYPE_IP_PAIR_V4: /* ��IPv4��, ͨ���ǻ�������ģʽ */
{
const struct layer_addr_ipv4 *ip4_saddr = (const struct layer_addr_ipv4 *)saddr;
struct layer_addr_ipv4 *ip4_daddr = (struct layer_addr_ipv4 *)daddr;
ip4_daddr->saddr = ip4_saddr->daddr;
- ip4_daddr->daddr = ip4_saddr->saddr; /* ֻ��IP��ַ */
- /* Note: ��IP��Ķ˿�ֵһ��Ҫ��Ϊ0, �����ʹ��δ��ʼ�����ڴ�, �ں�������ԭ��cmpaddr()������, ���ܻᵼ�����Ƚϵ�ַ��һ�����Ҳ��� */
+ ip4_daddr->daddr = ip4_saddr->saddr; /* ֻ��IP��ַ */
+ /* Note: ��IP��Ķ˿�ֵһ��Ҫ��Ϊ0, �����ʹ��δ��ʼ�����ڴ�, �ں�������ԭ��cmpaddr()������, ���ܻᵼ�����Ƚϵ�ַ��һ�����Ҳ��� */
ip4_daddr->source = 0;
ip4_daddr->dest = 0;
}
break;
- case __ADDR_TYPE_IP_PAIR_V6: /* ��IPv6��, ͨ���ǻ�������ģʽ */
+ case __ADDR_TYPE_IP_PAIR_V6: /* ��IPv6��, ͨ���ǻ�������ģʽ */
{
const struct layer_addr_ipv6 *ip6_saddr = (const struct layer_addr_ipv6 *)saddr;
struct layer_addr_ipv6 *ip6_daddr = (struct layer_addr_ipv6 *)daddr;
memcpy(ip6_daddr->saddr, ip6_saddr->daddr, IPV6_ADDR_LEN);
memcpy(ip6_daddr->daddr, ip6_saddr->saddr, IPV6_ADDR_LEN);
- /* Note: ��IP��Ķ˿�ֵһ��Ҫ��Ϊ0, �����ʹ��δ��ʼ�����ڴ�, �ں�������ԭ��cmpaddr()������, ���ܻᵼ�����Ƚϵ�ַ��һ�����Ҳ��� */
+ /* Note: ��IP��Ķ˿�ֵһ��Ҫ��Ϊ0, �����ʹ��δ��ʼ�����ڴ�, �ں�������ԭ��cmpaddr()������, ���ܻᵼ�����Ƚϵ�ַ��һ�����Ҳ��� */
ip6_daddr->source = 0;
ip6_daddr->dest = 0;
}
@@ -2031,7 +2031,7 @@ void addr_reverse_memcpy(const struct streaminfo_private *stack_stream_pr, void
struct layer_addr_vlan *dst_vlan = (struct layer_addr_vlan *)daddr;
memset(dst_vlan, 0, sizeof(struct layer_addr_vlan));
- /* ��ǰstack��İ���ַ��Ϣ�̶��洢��src����, ����copy�ǽ�stack��ַ����������ĵ�ַ */
+ /* ��ǰstack��İ���ַ��Ϣ�̶��洢��src����, ����copy�ǽ�stack��ַ����������ĵ�ַ */
memcpy(dst_vlan->s2c_addr_array, src_vlan->c2s_addr_array, sizeof(src_vlan->c2s_addr_array));
dst_vlan->s2c_layer_num = src_vlan->c2s_layer_num;
}
@@ -2052,7 +2052,7 @@ void addr_reverse_memcpy(const struct streaminfo_private *stack_stream_pr, void
struct layer_addr_mpls *dst_mpls = (struct layer_addr_mpls *)daddr;
memset(dst_mpls, 0, sizeof(struct layer_addr_mpls));
- /* ��ǰstack��İ���ַ��Ϣ�̶��洢��src����, ����copy�ǽ�stack��ַ����������ĵ�ַ */
+ /* ��ǰstack��İ���ַ��Ϣ�̶��洢��src����, ����copy�ǽ�stack��ַ����������ĵ�ַ */
memcpy(dst_mpls->s2c_addr_array, current_stack_addr->c2s_addr_array, sizeof(current_stack_addr->c2s_addr_array));
dst_mpls->s2c_layer_num = current_stack_addr->c2s_layer_num;
if(current_stack_addr->c2s_has_ctrl_word){
@@ -2085,7 +2085,7 @@ void addr_reverse_memcpy(const struct streaminfo_private *stack_stream_pr, void
break;
default:
- /* ������ַ����, �޷���������,ֱ��copy */
+ /* ������ַ����, �޷���������,ֱ��copy */
memcpy(daddr, saddr, addrlen);
return;
}
@@ -2094,9 +2094,9 @@ void addr_reverse_memcpy(const struct streaminfo_private *stack_stream_pr, void
}
/*
- ��ΪԤ�ȷ�����һЩstreamindex�ṹ, ÿ�δ�����ʱ, ��Ԥ�ȷ�����ڴ��л�ȡ,
- ��malloc_and_copy_streamindex()����, ֻcopy streamindex�ṹ, û��addr.paddr,
- ��Ҫ����ַ��ϢҲcopy������.
+ ��ΪԤ�ȷ�����һЩstreamindex�ṹ, ÿ�δ�����ʱ, ��Ԥ�ȷ�����ڴ��л�ȡ,
+ ��malloc_and_copy_streamindex()����, ֻcopy streamindex�ṹ, û��addr.paddr,
+ ��Ҫ����ַ��ϢҲcopy������.
*/
int copy_ipport_union_addr(struct streaminfo *pstream_heap, struct streaminfo *pstream_stack, int reverse)
{
@@ -2185,16 +2185,16 @@ void free_heap_stream_info(int mem_used_type, struct streaminfo *heap_stream, in
pfather_pr = heap_stream_pr->pfather_pr;
addr = &heap_stream->addr;
- /* Ϊ�˽�ʡ�ռ�, ��ַ����ADDR_TYPE_IPV4/6ʵ�ʴ洢����һ���IP��, ����free */
+ /* Ϊ�˽�ʡ�ռ�, ��ַ����ADDR_TYPE_IPV4/6ʵ�ʴ洢����һ���IP��, ����free */
if(addr->paddr){
sapp_mem_free(SAPP_MEM_DYN_PADDR, heap_stream->threadnum, addr->paddr);
addr->paddr = NULL;
}
if(layer != 0){
- /* ���ṹ�����ڲ㼴��0��, ʵ����ͨ��malloc_and_copy_streamindex()��ȡ��Ԥ�ȷ�����ڴ�,
- ����free,
- pfatherָ���streaminfo�ṹ����ͨ��copy_stream_info_to_heap()��̬malloc��.
+ /* ���ṹ�����ڲ㼴��0��, ʵ����ͨ��malloc_and_copy_streamindex()��ȡ��Ԥ�ȷ�����ڴ�,
+ ����free,
+ pfatherָ���streaminfo�ṹ����ͨ��copy_stream_info_to_heap()��̬malloc��.
*/
sapp_mem_free((sapp_mem_type_t)mem_used_type, heap_stream->threadnum, heap_stream);
}
@@ -2241,9 +2241,9 @@ static inline void update_stream_status(UCHAR threadnum, UCHAR stream_type, UCHA
/*
- ���ں�tilera�ܹ��µ��ڴ�����Ϊlocal��sharedģʽ,
- ԭ�������߳̽�����ȫ���ڴ�һ�����������ģʽ������,
- ��Ϊÿ�������߳��Լ���ʼ��.
+ ���ں�tilera�ܹ��µ��ڴ�����Ϊlocal��sharedģʽ,
+ ԭ�������߳̽�����ȫ���ڴ�һ�����������ģʽ������,
+ ��Ϊÿ�������߳��Լ���ʼ��.
*/
int thread_self_init(int thread_seq)
{
@@ -2262,19 +2262,19 @@ int get_stream_carry_tunnel_type(const struct streaminfo *this_stream,
*tunnel_type = STREAM_TUNNLE_NON;
}
- /* ������ָ��, ע��: sapp_online���sapp_ip_port_union�治һ�� */
+ /* ������ָ��, ע��: sapp_online���sapp_ip_port_union�治һ�� */
const struct streaminfo *pfather = this_stream->pfather;
switch(this_stream->addr.addrtype){
case ADDR_TYPE_MAC:
pfather = this_stream->pfather; //
if(pfather != NULL){
- //mac in mac����������, ֻ��һ��overlay�ķ�ʽ.
+ //mac in mac����������, ֻ��һ��overlay�ķ�ʽ.
}
break;
case ADDR_TYPE_IPV4:
- pfather = this_stream->pfather; /* IP-TCP/UDP����Ϊ��һ������, ����pfatherָ�� */
+ pfather = this_stream->pfather; /* IP-TCP/UDP����Ϊ��һ������, ����pfatherָ�� */
if(pfather != NULL){
if(__ADDR_TYPE_IP_PAIR_V4 == pfather->addr.addrtype){
*tunnel_type |= (unsigned short)STREAM_TUNNLE_IP_IN_IP;
@@ -2303,7 +2303,7 @@ int get_stream_carry_tunnel_type(const struct streaminfo *this_stream,
break;
case ADDR_TYPE_IPV6:
- pfather = this_stream->pfather; /* IP-TCP/UDP����Ϊ��һ������, ����pfatherָ�� */
+ pfather = this_stream->pfather; /* IP-TCP/UDP����Ϊ��һ������, ����pfatherָ�� */
if(pfather != NULL){
if(__ADDR_TYPE_IP_PAIR_V4 == pfather->addr.addrtype){
*tunnel_type |= (unsigned short)STREAM_TUNNLE_6OVER4;
@@ -2326,22 +2326,22 @@ int get_stream_carry_tunnel_type(const struct streaminfo *this_stream,
break;
case ADDR_TYPE_PPTP:
- /* pptp_entry()�������Ѿ�����ַ����ΪADDR_TYPE_PPTP, �϶�����PPTP���� */
+ /* pptp_entry()�������Ѿ�����ַ����ΪADDR_TYPE_PPTP, �϶�����PPTP���� */
*tunnel_type |= (unsigned short)STREAM_TUNNLE_PPTP;
break;
case ADDR_TYPE_L2TP:
- /* l2tp_entry()�������Ѿ�����ַ����ΪADDR_TYPE_L2TP, �϶�����L2TP���� */
+ /* l2tp_entry()�������Ѿ�����ַ����ΪADDR_TYPE_L2TP, �϶�����L2TP���� */
*tunnel_type |= (unsigned short)STREAM_TUNNLE_L2TP;
break;
case ADDR_TYPE_GPRS_TUNNEL:
- /* gtp_entry()�������Ѿ�����ַ����ΪADDR_TYPE_GTP, �϶�����GTP���� */
+ /* gtp_entry()�������Ѿ�����ַ����ΪADDR_TYPE_GTP, �϶�����GTP���� */
*tunnel_type |= (unsigned short)STREAM_TUNNEL_GPRS_TUNNEL;
break;
}
- /* 2021-01-11, �˴����Բ�����vxlan�ȷ�װ��, ֱ����pfather */
+ /* 2021-01-11, �˴����Բ�����vxlan�ȷ�װ��, ֱ����pfather */
return get_stream_carry_tunnel_type(pfather, this_stream, tunnel_type);
}
@@ -2358,15 +2358,15 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
switch(p_stack->stream_public.addr.addrtype)
{
case ADDR_TYPE_GPRS_TUNNEL:
- /* GTP��ַC2S, S2C�������, �޷�����ǰ����ַ����dir, ÿ��ջ��ı������洢��source����, ��C2S����,
- ������ʱ, �Ѿ��������ڲ�TCP, UDP��������, ��GTP�ĵ�ַ����source��dest,
- �˺����Ǹ��µĶԶ�ȱʧ�ĵ�ַ, �������ڲ��cur_dir��ʾ��Ҫ�����ĸ�����ĵ�ַ, �̶��ӵ�ǰ��p_stack��source����.
+ /* GTP��ַC2S, S2C�������, �޷�����ǰ����ַ����dir, ÿ��ջ��ı������洢��source����, ��C2S����,
+ ������ʱ, �Ѿ��������ڲ�TCP, UDP��������, ��GTP�ĵ�ַ����source��dest,
+ �˺����Ǹ��µĶԶ�ȱʧ�ĵ�ַ, �������ڲ��cur_dir��ʾ��Ҫ�����ĸ�����ĵ�ַ, �̶��ӵ�ǰ��p_stack��source����.
*/
if(cur_dir == DIR_C2S){
- pstream_pr->stream_public.addr.gtp->teid_c2s = p_stack->stream_public.addr.gtp->teid_c2s;/* ע��: �˴����DZ���, ����C2S */
+ pstream_pr->stream_public.addr.gtp->teid_c2s = p_stack->stream_public.addr.gtp->teid_c2s;/* ע��: �˴����DZ���, ����C2S */
}
else{
- pstream_pr->stream_public.addr.gtp->teid_s2c = p_stack->stream_public.addr.gtp->teid_c2s;/* ע��: �˴����DZ���, ����C2S */
+ pstream_pr->stream_public.addr.gtp->teid_s2c = p_stack->stream_public.addr.gtp->teid_c2s;/* ע��: �˴����DZ���, ����C2S */
}
break;
@@ -2377,7 +2377,7 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
p_stack->stream_public.addr.mpls->c2s_addr_array,
sizeof(p_stack->stream_public.addr.mpls->c2s_addr_array));
pstream_pr->stream_public.addr.mpls->c2s_layer_num = p_stack->stream_public.addr.mpls->c2s_layer_num;
- if(p_stack->stream_public.addr.mpls->c2s_has_ctrl_word){//ע��, ����̶��ж�src����!!
+ if(p_stack->stream_public.addr.mpls->c2s_has_ctrl_word){//ע��, ����̶��ж�src����!!
pstream_pr->stream_public.addr.mpls->c2s_mpls_ctrl_word = p_stack->stream_public.addr.mpls->c2s_mpls_ctrl_word;
pstream_pr->stream_public.addr.mpls->c2s_has_ctrl_word = 1;
}
@@ -2390,7 +2390,7 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
p_stack->stream_public.addr.mpls->c2s_addr_array,
sizeof(p_stack->stream_public.addr.mpls->c2s_addr_array));
pstream_pr->stream_public.addr.mpls->s2c_layer_num = p_stack->stream_public.addr.mpls->c2s_layer_num;
- if(p_stack->stream_public.addr.mpls->c2s_has_ctrl_word){ //ע��, ����̶��ж�src����!!
+ if(p_stack->stream_public.addr.mpls->c2s_has_ctrl_word){ //ע��, ����̶��ж�src����!!
pstream_pr->stream_public.addr.mpls->s2c_mpls_ctrl_word = p_stack->stream_public.addr.mpls->c2s_mpls_ctrl_word;
pstream_pr->stream_public.addr.mpls->s2c_has_ctrl_word = 1;
}
@@ -2413,9 +2413,9 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
}
else{
memcpy(pstream_pr->stream_public.addr.vlan->s2c_addr_array,
- p_stack->stream_public.addr.vlan->c2s_addr_array, //ע��, ����̶���src����!!
+ p_stack->stream_public.addr.vlan->c2s_addr_array, //ע��, ����̶���src����!!
sizeof(p_stack->stream_public.addr.vlan->s2c_addr_array));
- pstream_pr->stream_public.addr.vlan->s2c_layer_num = p_stack->stream_public.addr.vlan->c2s_layer_num; //ע��, ����̶���src����!!
+ pstream_pr->stream_public.addr.vlan->s2c_layer_num = p_stack->stream_public.addr.vlan->c2s_layer_num; //ע��, ����̶���src����!!
}
}else{
sapp_runtime_log(RLOG_LV_INFO, "update_opposite_addr_info() error, current addrtype is vlan, but pstream->addrtype is not vlan!");
@@ -2432,11 +2432,11 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
}
else{
memcpy(&pstream_pr->stream_public.addr.mac->dst_addr,
- &p_stack->stream_public.addr.mac->src_addr, //ע��, ����̶���src����!!
+ &p_stack->stream_public.addr.mac->src_addr, //ע��, ����̶���src����!!
sizeof(struct ethhdr));
}
}else{
- /* �����ڶ���streaminfo�ṹ�ϲ��� */
+ /* �����ڶ���streaminfo�ṹ�ϲ��� */
return update_opposite_addr_info(top_stream_pr, (struct streaminfo_private *) pstream_pr->pfather_pr,
(struct streaminfo_private *) p_stack, cur_dir);
}
@@ -2448,17 +2448,17 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
const struct layer_addr_l2tp *p_stack_addr = p_stack->stream_public.addr.l2tp;
struct layer_addr_l2tp *p_stream_addr = pstream_pr->stream_public.addr.l2tp;
- /* L2TP��ַC2S, S2C�������, �޷�����ǰ����ַ����dir, ÿ��ջ��ı������洢��source����, ��C2S����,
- ������ʱ, �Ѿ��������ڲ�TCP, UDP��������, ��GTP�ĵ�ַ����source��dest,
- �˺����Ǹ��µĶԶ�ȱʧ�ĵ�ַ, �������ڲ��cur_dir��ʾ��Ҫ�����ĸ�����ĵ�ַ, �̶��ӵ�ǰ��p_stack��source����.
+ /* L2TP��ַC2S, S2C�������, �޷�����ǰ����ַ����dir, ÿ��ջ��ı������洢��source����, ��C2S����,
+ ������ʱ, �Ѿ��������ڲ�TCP, UDP��������, ��GTP�ĵ�ַ����source��dest,
+ �˺����Ǹ��µĶԶ�ȱʧ�ĵ�ַ, �������ڲ��cur_dir��ʾ��Ҫ�����ĸ�����ĵ�ַ, �̶��ӵ�ǰ��p_stack��source����.
*/
if(cur_dir == DIR_C2S){
p_stream_addr->l2tpun.l2tp_addr_v2.tunnelid_C2S = p_stack_addr->l2tpun.l2tp_addr_v2.tunnelid_C2S;
p_stream_addr->l2tpun.l2tp_addr_v2.sessionid_C2S = p_stack_addr->l2tpun.l2tp_addr_v2.sessionid_C2S;
p_stream_addr->l2tpun.l2tp_addr_v2.seq_present_C2S = p_stack_addr->l2tpun.l2tp_addr_v2.seq_present_C2S;
}else{
- p_stream_addr->l2tpun.l2tp_addr_v2.tunnelid_S2C = p_stack_addr->l2tpun.l2tp_addr_v2.tunnelid_C2S; /* ע��: �˴����DZ���, ����C2S */
- p_stream_addr->l2tpun.l2tp_addr_v2.sessionid_S2C = p_stack_addr->l2tpun.l2tp_addr_v2.sessionid_C2S; /* ע��: �˴����DZ���, ����C2S */
+ p_stream_addr->l2tpun.l2tp_addr_v2.tunnelid_S2C = p_stack_addr->l2tpun.l2tp_addr_v2.tunnelid_C2S; /* ע��: �˴����DZ���, ����C2S */
+ p_stream_addr->l2tpun.l2tp_addr_v2.sessionid_S2C = p_stack_addr->l2tpun.l2tp_addr_v2.sessionid_C2S; /* ע��: �˴����DZ���, ����C2S */
p_stream_addr->l2tpun.l2tp_addr_v2.seq_present_S2C = p_stack_addr->l2tpun.l2tp_addr_v2.seq_present_C2S;
}
}
@@ -2474,7 +2474,7 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
}
else{
memcpy(&pstream_pr->stream_public.addr.vxlan->S2C_vxlan_addr,
- &p_stack->stream_public.addr.vxlan->C2S_vxlan_addr, //ע��, ����̶���src����!!
+ &p_stack->stream_public.addr.vxlan->C2S_vxlan_addr, //ע��, ����̶���src����!!
sizeof(p_stack->stream_public.addr.vxlan->S2C_vxlan_addr));
}
}else{
@@ -2485,7 +2485,7 @@ void update_opposite_addr_info(struct streaminfo_private *top_stream_pr, struct
break;
default:
- /* ����Э��㲻�漰C2S, S2C���������ַ�ǶԳ����� */
+ /* ����Э��㲻�漰C2S, S2C���������ַ�ǶԳ����� */
break;
}
}
@@ -2505,7 +2505,7 @@ static inline raw_pkt_t *sapp_raw_pkt_dup(int mem_used_type, int thread_index, c
new_raw_pkt->__lib_raw_pkt_data = sapp_mem_malloc((sapp_mem_type_t)mem_used_type, thread_index, raw_pkt->__lib_raw_pkt_len);
memcpy((void *)(new_raw_pkt->__lib_raw_pkt_data), raw_pkt->__lib_raw_pkt_data, raw_pkt->__lib_raw_pkt_len);
- /* ����raw_pkt_dataָ�� */
+ /* ����raw_pkt_dataָ�� */
hdr_offset = (char *)raw_pkt->raw_pkt_data - (char *)raw_pkt->__lib_raw_pkt_data;
assert(hdr_offset <= 2048);
new_raw_pkt->raw_pkt_data = (char *)new_raw_pkt->__lib_raw_pkt_data + hdr_offset;
@@ -2527,7 +2527,7 @@ int update_polling_inject_context(int mem_used_type,struct streaminfo_private *p
}
thread_index = pstream_pr->stream_public.threadnum;
- /* ���浱ǰ��C2S, S2C����ĵ�һ���� */
+ /* ���浱ǰ��C2S, S2C����ĵ�һ���� */
if(pstream_pr->stream_public.curdir == DIR_C2S)
{
if(NULL == pstream_pr->polling_inject_context->raw_pkt_stream_dir[DIR_C2S-1]){
@@ -2559,9 +2559,9 @@ int save_polling_inject_context(int mem_used_type, struct streaminfo_private *ps
memset(pstream_pr->polling_inject_context, 0, sizeof(polling_inject_context_t));
/* TODO:
- �˴���ÿ������ĵ�һ������������, ������Ƕ���̫���ڴ���, Ҳ��CPU,
- �������flood�����͸�������!!
- ����������IJ���������private�ṹ��, ��������ԭʼ�� */
+ �˴���ÿ������ĵ�һ������������, ������Ƕ���̫���ڴ���, Ҳ��CPU,
+ �������flood�����͸�������!!
+ ����������IJ���������private�ṹ��, ��������ԭʼ�� */
if (pstream_pr->stream_public.curdir == DIR_C2S)
{
pstream_pr->polling_inject_context->raw_pkt_stream_dir[DIR_C2S - 1] =
@@ -2622,8 +2622,8 @@ void free_polling_inject_context(int mem_used_type, struct streaminfo_private *p
/*
- ȫ����id, stream_index��ʷ���Ѿ���ʾ������Ψһid, �˴�Ҫ��֤��Ⱥ���л������ظ�,
- ��λ --- ��λ
+ ȫ����id, stream_index��ʷ���Ѿ���ʾ������Ψһid, �˴�Ҫ��֤��Ⱥ���л������ظ�,
+ ��λ --- ��λ
1 | 12bit device_id | 8bit thread_id | 28bit timestamp in sec | 15bit sequence per thread
*/
unsigned long long get_global_stream_id(unsigned long long thread_seq)
@@ -2659,20 +2659,20 @@ struct streaminfo_private *copy_stream_info_to_heap_single_layer(int mem_used_ty
memcpy(heap_stream_pr, stack_stream_pr, sizeof(struct streaminfo_private));
heap_stream = &(heap_stream_pr->stream_public);
- /* ����streaminfo, pfatherӦ�����ⲿ�����ߴ���, �˴�����ΪNULL */
+ /* ����streaminfo, pfatherӦ�����ⲿ�����ߴ���, �˴�����ΪNULL */
heap_stream_pr->pfather_pr = NULL;
heap_stream_pr->stream_public.pfather = NULL;
heap_addr = sapp_mem_malloc(SAPP_MEM_DYN_PADDR, stack_stream->threadnum, stack_stream->addr.addrlen);
memset(heap_addr, 0, stack_stream->addr.addrlen);
- /* �ϲ��ַ��ת, �Ҳ���overlay��,���ܷ���copy��ַ */
+ /* �ϲ��ַ��ת, �Ҳ���overlay��,���ܷ���copy��ַ */
if(reverse){
heap_stream_pr->dirreverse=1;
- heap_stream_pr->stream_dir = 1 ^ heap_stream_pr->layer_dir; /* lijia comment, ��"src>=dst"Ĭ�Ϲ���һ�� */
+ heap_stream_pr->stream_dir = 1 ^ heap_stream_pr->layer_dir; /* lijia comment, ��"src>=dst"Ĭ�Ϲ���һ�� */
heap_stream_pr->stream_c2s_route_dir = 1 ^ heap_stream_pr->stream_c2s_route_dir;
//reverse_addr_new(heap_addr, heap_stream->addr.addrtype);
- /* ��ַCOPYʱ, �����Ҫ��ת, ֱ�ӷ���COPY, ��Ҫ��memcpy, �ٽ�����ַԴ��Ŀ�ĵ�˳�� */
+ /* ��ַCOPYʱ, �����Ҫ��ת, ֱ�ӷ���COPY, ��Ҫ��memcpy, �ٽ�����ַԴ��Ŀ�ĵ�˳�� */
addr_reverse_memcpy(stack_stream_pr, heap_addr, stack_stream->addr.paddr, stack_stream->addr.addrtype, stack_stream->addr.addrlen);
}else{
heap_stream_pr->stream_dir = heap_stream_pr->layer_dir;
@@ -2689,12 +2689,12 @@ struct streaminfo_private *copy_stream_info_to_heap_single_layer(int mem_used_ty
/*
2014-04-08 LiJia add,
- ÿ�����ĵ�ַ��Ϣ��ʱ����ջ�ռ�, �������غ�˿��ڴ��ַ����Ч��,
- ��������ʱ, ��copy��malloc�Ķѿռ���, �����Ժ�ĵ�ַ�ȶ�.
+ ÿ�����ĵ�ַ��Ϣ��ʱ����ջ�ռ�, �������غ�˿��ڴ��ַ����Ч��,
+ ��������ʱ, ��copy��malloc�Ķѿռ���, �����Ժ�ĵ�ַ�ȶ�.
2014-04-08 LiJia add new arg stream_c2s_route_dir,
- ��Ϊ֮ǰ��reverse�Ķ�����ʵ�о�����, ��ʾ��ǰ���ַ��'���ַ�ǿͻ���'�����Ƿ�һ��, �Ƿ���Ҫ��ת,
- ����mpls, gtp��Э���ַ�ǵ����, reverse�Ĺ��򲻺�ʹ.
+ ��Ϊ֮ǰ��reverse�Ķ�����ʵ�о�����, ��ʾ��ǰ���ַ��'���ַ�ǿͻ���'�����Ƿ�һ��, �Ƿ���Ҫ��ת,
+ ����mpls, gtp��Э���ַ�ǵ����, reverse�Ĺ��򲻺�ʹ.
*/
struct streaminfo_private *copy_stream_info_to_heap(int mem_used_type,const struct streaminfo_private *stack_stream_pr, int reverse)
{
@@ -2713,7 +2713,7 @@ struct streaminfo_private *copy_stream_info_to_heap(int mem_used_type,const stru
pfather_pr = stack_stream_pr->pfather_pr;
if((pfather_pr != NULL)
&& (DEPLOYMENT_MODE_INLINE == sapp_global_val->config.packet_io.deployment_mode_bin)
- && (g_overlay_layer_set[pfather_pr->stream_public.addr.addrtype][pfather_pr->layer_index] != 0)){ /* 2021-01-11 lijia add, overlay���pfather��ΪNULL, ������ɼ� */
+ && (g_overlay_layer_set[pfather_pr->stream_public.addr.addrtype][pfather_pr->layer_index] != 0)){ /* 2021-01-11 lijia add, overlay���pfather��ΪNULL, ������ɼ� */
heap_stream->pfather = NULL;
}else{
heap_stream->pfather = (struct streaminfo *)heap_stream_pr->pfather_pr;
@@ -2729,7 +2729,7 @@ int sapp_is_overlay_layer(const struct streaminfo_private *stream_pr, const raw_
}
if((rawpkt->vlan_flipping_couple[0] && rawpkt->vlan_flipping_couple[1]) != 0){
- /* vlan flipping��ADC�Լ켰A�����豸���е�һ��ģʽ, ������overlay�� */
+ /* vlan flipping��ADC�Լ켰A�����豸���е�һ��ģʽ, ������overlay�� */
return 0;
}
@@ -2738,16 +2738,16 @@ int sapp_is_overlay_layer(const struct streaminfo_private *stream_pr, const raw_
return 1;
}
- /* TODO, Ŀǰ��ʱֻ��vxlanһ��overlayģʽ,���������ϵĶ�����overlay */
+ /* TODO, Ŀǰ��ʱֻ��vxlanһ��overlayģʽ,���������ϵĶ�����overlay */
return 0;
}
/*
- �ײ����������ݰ�ʱ, ������Щ��̭����, ����Ŀ��:
- 1) ʵ���ް���ʱ��̭����, ����ȷ;
- 2) �����ݰ�ʱ��ǰ��֮ǰ�ľ�������, �����ǿ������ݰ�����ʱ����̭����, ��������һЩ�������ܺͽ��Ͱ�������ʱ.
+ �ײ����������ݰ�ʱ, ������Щ��̭����, ����Ŀ��:
+ 1) ʵ���ް���ʱ��̭����, ����ȷ;
+ 2) �����ݰ�ʱ��ǰ��֮ǰ�ľ�������, �����ǿ������ݰ�����ʱ����̭����, ��������һЩ�������ܺͽ��Ͱ�������ʱ.
*/
int polling_stream_timeout(int tid)
{
@@ -2772,7 +2772,7 @@ int polling_stream_timeout(int tid)
{
plist = &(G_MESA_GLOBAL_STREAM[tid]->tcpList[i]);
if (plist->cnt > 0)
- { /* polling�׶ο��ܻ�û����, ����û�д�״̬����, plist����ΪNULL */
+ { /* polling�׶ο��ܻ�û����, ����û�д�״̬����, plist����ΪNULL */
ret = del_stream_by_time(plist, NULL, tid, STREAM_TYPE_TCP);
if (ret > 0)
{
@@ -2787,7 +2787,7 @@ int polling_stream_timeout(int tid)
/*
- ���ڲ��ͨ����Ԫ���ҵ���ǰ�̵߳�streaminfo�ṹ, �˽ӿڽ������ڲ�������Ƕ�ײ�Ĵ�IPv4, IPv6��ַ!
+ ���ڲ��ͨ����Ԫ���ҵ���ǰ�̵߳�streaminfo�ṹ, �˽ӿڽ������ڲ�������Ƕ�ײ�Ĵ�IPv4, IPv6��ַ!
*/
int find_streaminfo_by_addrv4(int thread_index, const struct stream_tuple4_v4 *tuplev4, enum stream_type_t streamtype, struct streaminfo *streaminfo_array[], int array_max_num)
{
@@ -2795,7 +2795,7 @@ int find_streaminfo_by_addrv4(int thread_index, const struct stream_tuple4_v4 *t
struct streamindex **phashstream=NULL;
struct streamindex *stream_hash_head = NULL;
unsigned int hash_index, hash_max;
- int ret, match_layer_dir; /* �������Ԫ�����˿���ΪԴ�Ĺ���һ�� */
+ int ret, match_layer_dir; /* �������Ԫ�����˿���ΪԴ�Ĺ���һ�� */
int tot_found_stream_num = 0;
if((NULL == streaminfo_array) || (array_max_num <= 0)){
@@ -2821,7 +2821,7 @@ int find_streaminfo_by_addrv4(int thread_index, const struct stream_tuple4_v4 *t
#if USE_LINUX_KERNEL_HASH_ALGO
unsigned int a,b;
unsigned short c,d;
- /* �˴��ο�����: set_transport_addr() ,��˿���Ϊ�ͻ��� */
+ /* �˴��ο�����: set_transport_addr() ,��˿���Ϊ�ͻ��� */
if(ntohs(tuplev4->source) > ntohs(tuplev4->dest)){
a = tuplev4->saddr;
b = tuplev4->daddr;
@@ -2898,7 +2898,7 @@ int find_streaminfo_by_addrv6(int thread_index, const struct stream_tuple4_v6 *t
struct streamindex **phashstream=NULL;
unsigned int hash_index, hash_max;
struct streamindex *stream_hash_head = NULL;
- int ret, match_layer_dir; /* �������Ԫ�����˿���ΪԴ�Ĺ���һ�� */
+ int ret, match_layer_dir; /* �������Ԫ�����˿���ΪԴ�Ĺ���һ�� */
int tot_found_stream_num = 0;
if (STREAM_TYPE_TCP == streamtype)
@@ -2918,7 +2918,7 @@ int find_streaminfo_by_addrv6(int thread_index, const struct stream_tuple4_v6 *t
#if USE_LINUX_KERNEL_HASH_ALGO
unsigned int a,b,c,d;
unsigned int no_use_slave_hash;
- /* �˴��ο�����: set_transport_addr() ,��˿���Ϊ�ͻ��� */
+ /* �˴��ο�����: set_transport_addr() ,��˿���Ϊ�ͻ��� */
if(ntohs(tuple4_v6->source) > ntohs(tuple4_v6->dest)){
memcpy(&a, &tuple4_v6->saddr[12], sizeof(int));
memcpy(&b, &tuple4_v6->daddr[12], sizeof(int));
@@ -3011,7 +3011,7 @@ int init_stream_manage(int threadcount)
init_stream_detail(G_MESA_GLOBAL_STREAM[i]);
}
- //add 20140626 ��ʼ��procject�ӿ�
+ //add 20140626 ��ʼ��procject�ӿ�
project_requirement_global_init();
if(stream_bridge_init() < 0){