diff options
| author | lijia <[email protected]> | 2019-12-18 11:25:47 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2019-12-18 11:25:47 +0800 |
| commit | 422766471efa716d82f8d50f6041bb5944cd1d1a (patch) | |
| tree | 8c99bc4baa5a91b212d7fadf07a51939dc1072e9 | |
| parent | c3d16eed7e4ea689225cae69f3288b3918987570 (diff) | |
配置文件增加PROTOCOL_FEATURE, 用于指定某些协议解析细节选项;v4.0.7
增加sapp_platform_opt选项, 用于支持插件获取平台内部计数.
| -rw-r--r-- | bin/etc/sapp.toml | 6 | ||||
| -rw-r--r-- | include/private/sapp_declaration.h | 5 | ||||
| -rw-r--r-- | include/private/sapp_global_val.h | 11 | ||||
| -rw-r--r-- | include/private/sapp_pkt_stat.h | 9 | ||||
| -rw-r--r-- | include/public/stream_inc/stream_control.h | 9 | ||||
| -rw-r--r-- | src/config/config_parse.cpp | 6 | ||||
| -rw-r--r-- | src/dealpkt/callapp.c | 6 | ||||
| -rw-r--r-- | src/dealpkt/deal_ethernet.c | 2 | ||||
| -rw-r--r-- | src/dealpkt/deal_ipv6.c | 3 | ||||
| -rw-r--r-- | src/dealpkt/deal_tcp.c | 4 | ||||
| -rw-r--r-- | src/entry/sapp_init.c | 14 | ||||
| -rw-r--r-- | src/inner_plug/sapp_assistant.cpp | 92 | ||||
| -rw-r--r-- | src/packet_io/packet_io.c | 22 | ||||
| -rw-r--r-- | src/packet_io/sendpacket.c | 8 | ||||
| -rw-r--r-- | version.txt | 14 |
15 files changed, 158 insertions, 53 deletions
diff --git a/bin/etc/sapp.toml b/bin/etc/sapp.toml index 8d2e5fd..1a761fd 100644 --- a/bin/etc/sapp.toml +++ b/bin/etc/sapp.toml @@ -57,6 +57,12 @@ BSD_packet_filter="" max=10000 timeout=60 +[PROTOCOL_FEATURE] + ipv6_decapsulation_enabled=1 + ipv6_send_packet_enabled=1 + tcp_drop_pure_ack_pkt=0 + tcp_syn_option_parse_enabled=1 + [PROFILING] [profiling.pkt_latency] enabled=0 diff --git a/include/private/sapp_declaration.h b/include/private/sapp_declaration.h index 8c17498..62151c3 100644 --- a/include/private/sapp_declaration.h +++ b/include/private/sapp_declaration.h @@ -54,6 +54,11 @@ extern sapp_global_t *sapp_global_val; #define g_packet_io_cap_mode sapp_global_val->config.packet_io.internal.interface.type_bin #define g_packet_io_cap_level sapp_global_val->individual_fixed.packet_io_cap_level #define g_timestamp_record_sw sapp_global_val->config.profiling.pkt_latency_enabled +#define g_discard_ack_sw sapp_global_val->config.protocol_feature.tcp_drop_pure_ack_pkt +#define g_tcp_syn_option_parse_enabled sapp_global_val->config.protocol_feature.tcp_syn_option_parse_enabled +#define g_ipv6_decapsulation_enabled sapp_global_val->config.protocol_feature.ipv6_decapsulation_enabled +#define g_ipv6_send_packet_enabled sapp_global_val->config.protocol_feature.ipv6_send_packet_enabled + #define sapp_runtime_log(log_level, format, args...) do{if(log_level>=ABBR_SAPP_LOG_LEVEL){MESA_handle_runtime_log(ABBR_SAPP_LOG_HANDLE, log_level, "sapp", format, ##args);}}while(0) diff --git a/include/private/sapp_global_val.h b/include/private/sapp_global_val.h index 22b0c0f..46c8899 100644 --- a/include/private/sapp_global_val.h +++ b/include/private/sapp_global_val.h @@ -170,12 +170,21 @@ typedef struct{ }sapp_config_special_link_t; typedef struct{ + int ipv6_decapsulation_enabled; /* �Ƿ����ipv6���ݰ� */ + int ipv6_send_packet_enabled; /* �Ƿ�֧�ַ���ipv6���ݰ�, ��������ϵͳipv6�ں�ģ���Ƿ���� */ + int tcp_drop_pure_ack_pkt; /* ����û�и��صĴ�ack��, ���Խ�Լһ��������ѯ, ����ҵ���������� */ + int tcp_syn_option_parse_enabled; /* �Ƿ����tcp syn��ͷ��ѡ�� */ +}sapp_protocol_feature_t; + + +typedef struct{ sapp_config_cpu_t cpu; sapp_config_tools_t tools; sapp_config_system_t system; sapp_config_stream_t stream; sapp_config_profiling_t profiling; sapp_config_packet_io_t packet_io; + sapp_protocol_feature_t protocol_feature; sapp_config_special_link_t special_conf_link; }sapp_config_t; @@ -210,7 +219,7 @@ typedef struct{ typedef struct{ sapp_gval_mthread_sys_stat_t sys_stat; unsigned short stream_seq_per_thread; - char __padding[46]; + char __padding[28]; }sapp_gval_mthread_t; /* for multi-thread, must 64byte alignment */ diff --git a/include/private/sapp_pkt_stat.h b/include/private/sapp_pkt_stat.h index bdc0a95..f9e3f3c 100644 --- a/include/private/sapp_pkt_stat.h +++ b/include/private/sapp_pkt_stat.h @@ -7,7 +7,7 @@ ���±��뼴��! */ -enum __sapp_sys_stat_type{ +typedef enum __sapp_sys_stat_type{ /************* receive packet ****************/ SAPP_STAT_RCV_ETHERNET, SAPP_STAT_RCV_IPV4, /* ������SAPP_STAT_RCV_IPV4_FRAG */ @@ -20,7 +20,10 @@ enum __sapp_sys_stat_type{ SAPP_STAT_RCV_UNKNOWN, /************* send packet *******************/ - SAPP_STAT_SND_ETHERNET, + + SAPP_STAT_ETH_EGRESS, /* ����ģʽ�µĻ�������, �����Ϻ�SAPP_STAT_RCV_ETHERNET���, �����в������DROPPKT */ + + SAPP_STAT_SND_ETHERNET, /* ����������͵�����, ������������������ */ SAPP_STAT_SND_IPV4, SAPP_STAT_SND_IPV6, SAPP_STAT_SND_TCP, @@ -75,7 +78,7 @@ enum __sapp_sys_stat_type{ /************** Maximum Value Definition *******/ SAPP_STAT_NUM_MAX, -}; +}sapp_sys_stat_type_t; #endif diff --git a/include/public/stream_inc/stream_control.h b/include/public/stream_inc/stream_control.h index 85ed6f8..d039d74 100644 --- a/include/public/stream_inc/stream_control.h +++ b/include/public/stream_inc/stream_control.h @@ -5,7 +5,7 @@ extern "C" {
#endif
-#define STREAM_CONTROL_H_VERSION (20191202)
+#define STREAM_CONTROL_H_VERSION (20191218)
#define TCP_CTEAT_LINK_BYSYN 0x01 /* for MESA_stream_opt->MSO_TCP_CREATE_LINK_MODE */
#define TCP_CTEAT_LINK_BYDATA 0x02 /* for MESA_stream_opt->MSO_TCP_CREATE_LINK_MODE */
@@ -63,7 +63,12 @@ enum sapp_platform_opt{ SPO_RAND_NUMBER, /* get a rand number, opt_val type must be long long */
SPO_FIELD_STAT_HANDLE, /* field stat output handle, opt_val type must be void * */
SPO_INDEPENDENT_THREAD_ID, /* plug independent thread which is created by pthread_create(), opt_val type must be int */
- SPO_DEPLOYMENT_MODE_STR, /* opt_val type is char[], optional value is:["mirror", "inline", "transparent", "dumpfile"] */
+ SPO_DEPLOYMENT_MODE_STR, /* opt_val type is char[], optional value is:["mirror", "inline", "transparent"] */
+ SPO_TOTAL_EGRESS_PKT, /* total egress packet number, effective in inline or transparent mode, opt_val type must be unsigned long long */
+ SPO_TOTAL_EGRESS_BYTE, /* total egress packet byte, effective in inline or transparent mode, opt_val type must be unsigned long long */
+ SPO_TCP_STREAM_NEW, /* total created tcp streams from start, opt_val type must be unsigned long long */
+ SPO_TCP_STREAM_CLOSE, /* total closed tcp streams from start, opt_val type must be unsigned long long */
+ SPO_TCP_STREAM_LIVE, /* realtime established tcp streams, opt_val type must be unsigned long long */
};
diff --git a/src/config/config_parse.cpp b/src/config/config_parse.cpp index 91c1bb6..fdcff12 100644 --- a/src/config/config_parse.cpp +++ b/src/config/config_parse.cpp @@ -658,6 +658,12 @@ int sapp_parse_config(void) return -1; } #endif + /************************ PROTOCOL_FEATURE **********************************/ + tomlc99_wrap_load_int_def(default_config_file, (char *)"PROTOCOL_FEATURE", (char *)"ipv6_decapsulation_enabled", (int *)&pconfig->protocol_feature.ipv6_decapsulation_enabled, 1); + tomlc99_wrap_load_int_def(default_config_file, (char *)"PROTOCOL_FEATURE", (char *)"ipv6_send_packet_enabled", (int *)&pconfig->protocol_feature.ipv6_send_packet_enabled, 1); + tomlc99_wrap_load_int_def(default_config_file, (char *)"PROTOCOL_FEATURE", (char *)"tcp_drop_pure_ack_pkt", (int *)&pconfig->protocol_feature.tcp_drop_pure_ack_pkt, 0); + tomlc99_wrap_load_int_def(default_config_file, (char *)"PROTOCOL_FEATURE", (char *)"tcp_syn_option_parse_enabled", (int *)&pconfig->protocol_feature.tcp_syn_option_parse_enabled, 1); + /******************************* TOOLS **********************************/ tomlc99_wrap_load_int_def(default_config_file, (char *)"tools.pkt_dump", (char *)"enabled", (int *)&pconfig->tools.pkt_dump.enabled, 0); tomlc99_wrap_load_string_def(default_config_file, (char *)"tools.pkt_dump", (char *)"mode", pconfig->tools.pkt_dump.mode_str, NAME_MAX, "udp_socket"); diff --git a/src/dealpkt/callapp.c b/src/dealpkt/callapp.c index 55de908..dd2ed50 100644 --- a/src/dealpkt/callapp.c +++ b/src/dealpkt/callapp.c @@ -1140,8 +1140,6 @@ static int judge_pure_ipv4_stack(const struct streaminfo *pstream, const void *a }
#endif
- int g_packet_io_ipv6_switch = 0;
- extern int g_discard_ack_sw;
int app_function_rationality_check(void)
{
/* 2015-01-12 lijia add, for error message */
@@ -1150,8 +1148,8 @@ static int judge_pure_ipv4_stack(const struct streaminfo *pstream, const void *a sleep(1);
}
- if((0 == g_packet_io_ipv6_switch) && (g_Ipv6FunNum != 0)){
- printf("\033[33m[Warning]You have registered 'IPV6' plugin, but 'IPv6_module_enable' in main.conf is disable! \033[0m\n");
+ if((0 == g_ipv6_decapsulation_enabled) && (g_Ipv6FunNum != 0)){
+ printf("\033[33m[Warning]You have registered 'IPV6' plugin, but 'sapp.toml->ipv6_decapsulation_enabled' is disable! \033[0m\n");
sleep(1);
}
diff --git a/src/dealpkt/deal_ethernet.c b/src/dealpkt/deal_ethernet.c index f136c8c..73c1906 100644 --- a/src/dealpkt/deal_ethernet.c +++ b/src/dealpkt/deal_ethernet.c @@ -25,7 +25,7 @@ static inline void set_mac_addr(struct layer_addr_mac *addr, const struct mesa_e int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr,int thread_num,
unsigned char dir, const raw_pkt_t *raw_pkt, int offset_to_raw_pkt_hdr)
{
- int ret;
+ int ret = PASS;
const unsigned char *next_layer_data = (const unsigned char *)this_layer_hdr + sizeof(struct mesa_ethernet_hdr);
const struct mesa_ethernet_hdr *p_eth_hdr = (const struct mesa_ethernet_hdr *)this_layer_hdr;
//unsigned short eth_type = ntohs(p_eth_hdr->ether_type);
diff --git a/src/dealpkt/deal_ipv6.c b/src/dealpkt/deal_ipv6.c index 4fd86ca..c65cb3e 100644 --- a/src/dealpkt/deal_ipv6.c +++ b/src/dealpkt/deal_ipv6.c @@ -16,7 +16,6 @@ extern "C" { static struct frag_manage *g_ipv6_frag_manage = NULL;
static unsigned int FRAG_IP6_RANDOM;
-extern int g_packet_io_ipv6_switch;
//extern int g_packet_io_thread_num;
extern void raw_frags_list_free_one(int thread_seq, void *project_req_value);
int update_global_ip_frag_list(raw_ipfrag_list_t *list_head, int thread_num, int type);
@@ -768,7 +767,7 @@ int ipv6_entry(struct streaminfo_private *pfstream_pr, const void *this_layer_hd static unsigned int ipv6_frag_reassemble_num = 0;
#endif
- if(0 == g_packet_io_ipv6_switch){
+ if(0 == g_ipv6_decapsulation_enabled){
static int __print_flag = 1; /* ����ֻ��ӡһ��, ����ˢ�� */
if(__print_flag){
printf("\033[41m[Warning]recv a IPv6 packet, but IPv6 module is not enable!\033[0m\n");
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c index a723f38..72d16a0 100644 --- a/src/dealpkt/deal_tcp.c +++ b/src/dealpkt/deal_tcp.c @@ -56,9 +56,7 @@ int copy_ipport_union_addr(struct streaminfo *pstream_heap, struct streaminfo *p void iterate_stream_list(const struct streaminfo *stream); int del_stream_by_time(struct stream_list *plist, const struct streamindex *current_drive_index); -int g_discard_ack_sw = 0; /* 2016-06-15 lijia add, �Ƿ�����TCP-ACK�� */ //int g_kill_tcp_remedy_sw = 0; /* 2016-06-21 lijia add, �Ƿ����FD���� */ -int g_analyse_tcp_opt_sw = 1; int G_TCP_FLOW_STAT_PROJECT_ID = -1; /* 2016-07-14 lijia copy from sapp */ int G_TCP_DEDUCE_FLOW_STAT_PROJECT_ID = -1; /* ������, ����ACK����ƶϳ��ĶԶ����۽��յ����ݳ��� */ @@ -513,7 +511,7 @@ static inline void tcp_parse_opts(struct streaminfo_private *pstream_pr, char di int ret; struct tcp_option local_tmp_opt_array[MAX_TCP_OPT_NUM]; - if(g_analyse_tcp_opt_sw){ + if(g_tcp_syn_option_parse_enabled){ ret = MESA_get_tcp_pkt_opts((const struct tcphdr *)tcphdr, local_tmp_opt_array, MAX_TCP_OPT_NUM); if(ret > 0){ tcp_store_syn_state_opts(pstream_pr, dir, local_tmp_opt_array, ret); diff --git a/src/entry/sapp_init.c b/src/entry/sapp_init.c index b79169e..c0f39e4 100644 --- a/src/entry/sapp_init.c +++ b/src/entry/sapp_init.c @@ -33,9 +33,7 @@ extern int g_use_MESA_sleep_sw; extern int g_raw_pkt_broken_check; extern int g_skip_ethernet_layer_sw; int g_reverse_ethernet_addr_sw; -extern int g_discard_ack_sw; //extern int g_kill_tcp_remedy_sw; -extern int g_analyse_tcp_opt_sw; extern int g_encapsulate_with_ddp; extern int g_encapsulate_with_L2E; /* ʹ��DDPЭ���װ��x27ԭʼIP�� */ extern int G_DICTATOR_SW; @@ -151,10 +149,10 @@ int MESA_platform_init(int argc, char *argv[]) tcp_set_support_tcpall_model(TcpAllEnable); #if (0 == HIGH_PERF) - MESA_load_profile_int_def("conf/main.conf","Module", "discard_ack",&g_discard_ack_sw, 0); + //MESA_load_profile_int_def("conf/main.conf","Module", "discard_ack",&g_discard_ack_sw, 0); #else - g_discard_ack_sw = 1; - printf("\033[33m in high-perf mode, 'discard_ack' is auto enable!\n"); + //g_discard_ack_sw = 1; + //printf("\033[33m in high-perf mode, 'discard_ack' is auto enable!\n"); #endif //MESA_load_profile_int_def("conf/main.conf","Module", "kill_tcp_remedy",&g_kill_tcp_remedy_sw, 0); @@ -173,9 +171,9 @@ int MESA_platform_init(int argc, char *argv[]) ipv4_frag_init(g_iThreadNum, 1024 * 512); //MESA_load_profile_int_def("conf/main.conf","Module", "IPv6_module_enable", &ipv6_switch, 1); - packet_io_set_ipv6_module_enable(1); + //packet_io_set_ipv6_module_enable(1); //MESA_load_profile_int_def("conf/main.conf","Module", "IPv6_raw_socket", &ipv6_switch, 0); /* Ϊ�˱��ڲ���, ����Ĭ�Ϲر� */ - packet_io_set_ipv6_raw_socket_enable(1); + //packet_io_set_ipv6_raw_socket_enable(1); ipv6_frag_init(g_iThreadNum, 1024 * 256); //tcp_set_creatlink_model(create_link_mode); @@ -204,8 +202,6 @@ int MESA_platform_init(int argc, char *argv[]) MESA_load_profile_int_def("conf/main.conf","Module", "use_MESAsleep", &g_use_MESA_sleep_sw, 0); - //MESA_load_profile_int_def("conf/main.conf","Module", "analyse_tcp_option", &g_analyse_tcp_opt_sw, 1); - MESA_load_profile_int_def("conf/main.conf","Module", "encapsulate_with_ddp", &g_encapsulate_with_ddp, 0); if(g_encapsulate_with_ddp != 0){ printf("\033[32m[Notice] '%s' is enable!\033[0m\n", "encapsulate_with_ddp"); diff --git a/src/inner_plug/sapp_assistant.cpp b/src/inner_plug/sapp_assistant.cpp index d5d273f..88d4dcb 100644 --- a/src/inner_plug/sapp_assistant.cpp +++ b/src/inner_plug/sapp_assistant.cpp @@ -101,6 +101,28 @@ int sapp_identify_broad_multicast_pkt(const void *this_layer_data, const raw_pkt return 0; } + +/* + ctype: + 'c':count; + 'l':length; +*/ +static unsigned long long __get_platform_opt_traffic(int ctype, sapp_sys_stat_type_t index) +{ + int i; + unsigned long long tmp_long = 0; + + for(i = 0; i < g_packet_io_thread_num; i++){ + if('c' == ctype){ + tmp_long += sapp_global_val->mthread_volatile[i]->sys_stat.count[index]; + }else{ + tmp_long += sapp_global_val->mthread_volatile[i]->sys_stat.length[index]; + } + } + + return tmp_long; +} + /* 2017-09-04 lijia add, for ��������, �����ȡƽ̨�ڲ����� */ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_val_len) { @@ -120,11 +142,7 @@ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_va break; } unsigned long long *tot_pkt = (unsigned long long *)opt_val; - tmp_long = 0; - for(i = 0; i < g_packet_io_thread_num; i++){ - tmp_long += g_SysInputInfo[i][PKT_ETHERNET]; - } - *tot_pkt = tmp_long; + *tot_pkt = __get_platform_opt_traffic('c', SAPP_STAT_RCV_ETHERNET); } break; @@ -136,13 +154,69 @@ int sapp_get_platform_opt(enum sapp_platform_opt opt, void *opt_val, int *opt_va break; } unsigned long long *tot_byte = (unsigned long long *)opt_val; - tmp_long = 0; - for(i = 0; i < g_packet_io_thread_num; i++){ - tmp_long += g_SysInputInfo[i][PKT_ETHERNET_LEN]; + *tot_byte = *tot_byte = __get_platform_opt_traffic('l', SAPP_STAT_RCV_ETHERNET);; + } + break; + + case SPO_TOTAL_EGRESS_PKT: + { + if(*opt_val_len != sizeof(long long)){ + ret = -1; + sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len); + break; } - *tot_byte = tmp_long; + unsigned long long *tot_byte = (unsigned long long *)opt_val; + *tot_byte = *tot_byte = __get_platform_opt_traffic('c', SAPP_STAT_ETH_EGRESS);; } break; + + case SPO_TOTAL_EGRESS_BYTE: + { + if(*opt_val_len != sizeof(long long)){ + ret = -1; + sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len); + break; + } + unsigned long long *tot_byte = (unsigned long long *)opt_val; + *tot_byte = *tot_byte = __get_platform_opt_traffic('l', SAPP_STAT_ETH_EGRESS);; + } + break; + + case SPO_TCP_STREAM_NEW: + { + if(*opt_val_len != sizeof(long long)){ + ret = -1; + sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len); + break; + } + unsigned long long *tot_byte = (unsigned long long *)opt_val; + *tot_byte = *tot_byte = __get_platform_opt_traffic('c', SAPP_STAT_TCP_STREAM_NEW); + } + break; + + case SPO_TCP_STREAM_LIVE: + { + if(*opt_val_len != sizeof(long long)){ + ret = -1; + sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len); + break; + } + unsigned long long *tot_byte = (unsigned long long *)opt_val; + *tot_byte = *tot_byte = __get_platform_opt_traffic('c', SAPP_STAT_TCP_STREAM_DATA); + } + break; + + case SPO_TCP_STREAM_CLOSE: + { + if(*opt_val_len != sizeof(long long)){ + ret = -1; + sapp_runtime_log(RLOG_LV_DEBUG, "sapp_get_platform_opt() error:opt_val_len:%d is invalid!\n", *opt_val_len); + break; + } + unsigned long long *tot_byte = (unsigned long long *)opt_val; + *tot_byte = *tot_byte = __get_platform_opt_traffic('c', SAPP_STAT_TCP_STREAM_DEL); + } + break; case SPO_THREAD_COUNT: { diff --git a/src/packet_io/packet_io.c b/src/packet_io/packet_io.c index 5df71e2..07d6b97 100644 --- a/src/packet_io/packet_io.c +++ b/src/packet_io/packet_io.c @@ -53,8 +53,6 @@ char g_down_dev_name[DEV_NAME_STR_LEN]; ///int g_packet_io_cap_level = CAP_LEVEL_MAC; /* ������ʼλ��,Ĭ��MAC�� */ //int g_packet_io_thread_num = 1; int g_app_send_rst_type; -extern int g_packet_io_ipv6_switch; -int g_packet_io_ipv6_raw_socket = 0; /* ���ڷ��ʹ�Ipv6 rst�� */ //extern int g_timestamp_record_sw; int g_encapsulate_with_ddp = 0; /* ʹ��DDPЭ���װ��ԭʼ�� */ int g_encapsulate_with_L2E = 0; /* ʹ��DDPЭ���װ��x27ԭʼIP�� */ @@ -110,13 +108,13 @@ static const unsigned char phony_feedback_eth_hdr_ip6[ETHERNET_HDR_LEN] = int packet_io_set_ipv6_module_enable(int op_switch) { - g_packet_io_ipv6_switch = op_switch; + g_ipv6_decapsulation_enabled = op_switch; return 0; } int packet_io_set_ipv6_raw_socket_enable(int op_switch) { - g_packet_io_ipv6_raw_socket = op_switch; + g_ipv6_send_packet_enabled = op_switch; return 0; } @@ -645,6 +643,11 @@ static int mesa_default_pkt_cb(const raw_pkt_t *p_raw_pkt, unsigned char dir, in ret = g_platform_action_cb_fun(sapp_global_val->config.packet_io.depolyment_mode_bin, ret); } + if((PASS == ret) && (g_topology_mode & __NET_CONN_SERIAL)){ + sapp_global_val->mthread_volatile[thread_num]->sys_stat.count[SAPP_STAT_ETH_EGRESS]++; + sapp_global_val->mthread_volatile[thread_num]->sys_stat.length[SAPP_STAT_ETH_EGRESS]+= p_raw_pkt->raw_pkt_len; + } + return ret; } @@ -897,9 +900,9 @@ static int packet_io_send_by_sys_routev6(MESA_send_handle *send_handle,int datal int offset; sapp_gval_mthread_sys_stat_t *local_sys_stat = &sapp_global_val->mthread_volatile[send_handle->threadnum]->sys_stat; - if(0 == g_packet_io_ipv6_raw_socket){ - printf("IPv6 module is not support! Please check 'main.conf->IPv6_raw_socket'.\n"); - sapp_runtime_log(RLOG_LV_FATAL, "%s:%d: IPv6 module is not support! Please check 'main.conf->IPv6_raw_socket'.\n", __FILE__, __LINE__); + if(0 == g_ipv6_send_packet_enabled){ + printf("IPv6 module is not support! Please check 'sapp.toml->ipv6_send_packet_enabled'.\n"); + sapp_runtime_log(RLOG_LV_FATAL, "%s:%d: IPv6 module is not support! Please check 'sapp.toml->ipv6_send_packet_enabled'.\n", __FILE__, __LINE__); return -1; } @@ -1083,6 +1086,11 @@ int packet_io_send_fake_pkt(MESA_send_handle *send_handle,int datalen,int send_t thread_num); } + if(ret >= 0){ + sapp_global_val->mthread_volatile[thread_num]->sys_stat.count[SAPP_STAT_ETH_EGRESS]++; + sapp_global_val->mthread_volatile[thread_num]->sys_stat.length[SAPP_STAT_ETH_EGRESS] += datalen; + } + return ret; } diff --git a/src/packet_io/sendpacket.c b/src/packet_io/sendpacket.c index f2f42c7..13f2b36 100644 --- a/src/packet_io/sendpacket.c +++ b/src/packet_io/sendpacket.c @@ -59,8 +59,6 @@ static tcp_rst_finger_mark_t g_tcp_rst_finger[MAX_THREAD_NUM]; extern void *g_packet_dl_send_handle[MAX_THREAD_NUM]; extern dl_io_fun_list_t dl_io_fun_list; extern char g_send_dev_name[DEV_NAME_STR_LEN]; -extern int g_packet_io_ipv6_switch; -extern int g_packet_io_ipv6_raw_socket; extern int g_app_send_rst_type ; extern int calc_l2tp_hdr_len(const struct l2tp_hdr_v2 *l2tp_hdr); extern int packet_io_send_fake_pkt(MESA_send_handle *send_handle,int datalen,int send_type, @@ -1607,8 +1605,8 @@ static int build_net_layer_ipv6(struct streaminfo_private *stream_pr, int carry_ UINT8 hop = (UINT8)MESA_rand_range(64, 128); int threadnum = (int)stream_pr->stream_public.threadnum; - if(0 == g_packet_io_ipv6_switch){ - printf("IPv6 module is not support! Please set 'IPv6_module_enable=1' in main.conf.\n"); + if(0 == g_ipv6_decapsulation_enabled){ + printf("IPv6 module is not support! Please set 'ipv6_decapsulation_enabled=1' in sapp.toml.\n"); return -1; } @@ -3121,7 +3119,7 @@ static int send_handle_init(int tot_thread_num) return -1; } } - if(g_packet_io_ipv6_raw_socket){ + if(g_ipv6_send_packet_enabled){ g_send_handle[i].raw_ipv6_fd = socket(PF_INET6, SOCK_RAW, IPPROTO_RAW); if(g_send_handle[i].raw_ipv6_fd < 0){ printf("socket v6 error, %s\n", strerror(errno)); diff --git a/version.txt b/version.txt index 7c7a31c..8537dee 100644 --- a/version.txt +++ b/version.txt @@ -3,16 +3,16 @@ VCS_TYPE="git" VCS_BASENAME="v4.0" VCS_UUID="efa070923d8398b49f41acda82b839d11eb75230" -VCS_NUM="138" -VCS_DATE="2019-11-27T09:54:50+0800" -VCS_BRANCH="feature_v4.0_rst_tcp" -VCS_TAG="v4.0.4" -VCS_TICK="8" +VCS_NUM="143" +VCS_DATE="2019-12-11T17:59:45+0800" +VCS_BRANCH="sapp_v4" +VCS_TAG="v4.0.6" +VCS_TICK="0" VCS_EXTRA="" VCS_ACTION_STAMP="" -VCS_FULL_HASH="41b7f3445ed48e8654cdc365d88d51fe2b2def3f" -VCS_SHORT_HASH="41b7f34" +VCS_FULL_HASH="c3d16eed7e4ea689225cae69f3288b3918987570" +VCS_SHORT_HASH="c3d16ee" VCS_WC_MODIFIED="1" |
