diff options
| author | lijia <[email protected]> | 2020-08-23 19:49:42 +0800 |
|---|---|---|
| committer | lijia <[email protected]> | 2020-08-23 19:49:42 +0800 |
| commit | 93841beb9a3763509ca84f4dc801cac0a76def73 (patch) | |
| tree | 246a85104f7627cb3de104e5f2513ab6cc3432e3 | |
| parent | 41c033827bb972e2795c095a4ea2794f6d7d3820 (diff) | |
1.增加Network Link Quality统计, 丢包字节数, 丢包连接数等. 2.恢复v3.0版本main.conf的一些配置项.v4.1.0-rc3
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | CMakeLists.txt | 3 | ||||
| -rw-r--r-- | bin/etc/gdev_block.conf (renamed from bin/conf.bak/gdev_block.conf) | 0 | ||||
| -rw-r--r-- | bin/etc/sapp.toml | 16 | ||||
| -rw-r--r-- | bin/etc/send_gdev.conf | 2 | ||||
| -rw-r--r-- | bin/etc/send_route.conf | 3 | ||||
| -rw-r--r-- | cmake/Package.cmake | 5 | ||||
| -rw-r--r-- | include/private/sapp_global_val.h | 9 | ||||
| -rw-r--r-- | include/private/sapp_pkt_stat.h | 20 | ||||
| -rw-r--r-- | include/private/stream_internal.h | 13 | ||||
| -rw-r--r-- | src/config/config_parse.cpp | 28 | ||||
| -rw-r--r-- | src/dealpkt/deal_ethernet.c | 2 | ||||
| -rw-r--r-- | src/dealpkt/deal_mac_in_mac.c | 2 | ||||
| -rw-r--r-- | src/dealpkt/deal_tcp.c | 9 | ||||
| -rw-r--r-- | src/dealpkt/stream_manage.c | 49 | ||||
| -rw-r--r-- | src/entry/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/entry/sapp_init.c | 17 | ||||
| -rw-r--r-- | src/inner_plug/gdev_block.c | 4 | ||||
| -rw-r--r-- | src/packet_io/packet_io.c | 20 | ||||
| -rw-r--r-- | src/packet_io/packet_io_status.cpp | 76 | ||||
| -rw-r--r-- | src/packet_io/sendpacket.c | 7 |
21 files changed, 218 insertions, 74 deletions
@@ -16,4 +16,5 @@ version.txt GPATH GRTAGS GTAGS -cmake-build*
\ No newline at end of file +cmake-build* +/src/support/breakpad_mini/cmake/changelog.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 73e1d5f..d6fae9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,7 +198,10 @@ install(FILES bin/etc/project_list.conf DESTINATION etc COMPONENT PROFILE) install(FILES bin/etc/plugin.conf DESTINATION etc COMPONENT PROFILE) install(FILES bin/etc/entrylist.conf DESTINATION etc COMPONENT PROFILE) install(FILES bin/etc/gdev.conf DESTINATION etc COMPONENT PROFILE) +install(FILES bin/etc/gdev_block.conf DESTINATION etc COMPONENT PROFILE) install(FILES bin/plug/conflist.inf DESTINATION plug COMPONENT PROFILE) +install(FILES bin/etc/send_gdev.conf DESTINATION etc COMPONENT PROFILE) +install(FILES bin/etc/send_route.conf DESTINATION etc COMPONENT PROFILE) if(NOT ENABLE_STATIC_LINK) diff --git a/bin/conf.bak/gdev_block.conf b/bin/etc/gdev_block.conf index dc5c9e2..dc5c9e2 100644 --- a/bin/conf.bak/gdev_block.conf +++ b/bin/etc/gdev_block.conf diff --git a/bin/etc/sapp.toml b/bin/etc/sapp.toml index faed81f..048f6e6 100644 --- a/bin/etc/sapp.toml +++ b/bin/etc/sapp.toml @@ -30,6 +30,17 @@ dictator_enable=1 ### note, same as tcpdump -Q/-P arg, possible values are `in', `out' and `inout', default is "in" pcap_capture_direction="in" + + create_mpls_anyway=0 + +### note, depolyment.mode options: [sys_route, vxlan_by_inline_device, raw_ethernet] +### sys_route: send ip(ipv6) packet by system route table, default mode in mirror mode; +### vxlan_by_inline_device: encapsulation inject packet with vxlan, and then send to inline device by udp socket. +### raw_ethernet: send layer2 ethernet packet to specific gateway in same broadcast domain. + inject_pkt_mode=sys_route + +### note, this config is valid if inject_pkt_mode==vxlan_by_inline_device, means udp socket src port. + inject_mode_inline_device_sport=54789 ### note, depolyment.mode options: [mirror, inline, transparent] [packet_io.depolyment] @@ -73,11 +84,14 @@ dictator_enable=1 signature_enabled=1 signature_seed1=65535 signature_seed2=13 + remedy_kill_tcp_by_inline_device=1 [stream.udp] max=10000 timeout=60 - + meaningful_statistics_minimum_pkt=3 + meaningful_statistics_minimum_byte=5 + [PROTOCOL_FEATURE] ipv6_decapsulation_enabled=1 ipv6_send_packet_enabled=1 diff --git a/bin/etc/send_gdev.conf b/bin/etc/send_gdev.conf new file mode 100644 index 0000000..54b7a0f --- /dev/null +++ b/bin/etc/send_gdev.conf @@ -0,0 +1,2 @@ +3 10.3.127.1 + diff --git a/bin/etc/send_route.conf b/bin/etc/send_route.conf new file mode 100644 index 0000000..f1186c7 --- /dev/null +++ b/bin/etc/send_route.conf @@ -0,0 +1,3 @@ +#dev_id link_id mac_addr +3 2 00:50:56:f3:59:5c + diff --git a/cmake/Package.cmake b/cmake/Package.cmake index 351dd98..d51f373 100644 --- a/cmake/Package.cmake +++ b/cmake/Package.cmake @@ -59,7 +59,10 @@ set(CPACK_RPM_EXECUTABLE_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFI "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/project_list.conf" "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/plugin.conf" "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/entrylist.conf" - "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/plug/conflist.inf") + "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/plug/conflist.inf" + "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/gdev_block.conf" + "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/send_gdev.conf" + "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/send_route.conf") # Must uninstall the debug package before install release package set(CPACK_RPM_PACKAGE_CONFLICTS ${MY_RPM_NAME_PREFIX}) diff --git a/include/private/sapp_global_val.h b/include/private/sapp_global_val.h index cf8e4aa..6a4d796 100644 --- a/include/private/sapp_global_val.h +++ b/include/private/sapp_global_val.h @@ -55,6 +55,7 @@ typedef struct{ int rst_signature_seed1; int rst_signature_seed2; int link_mss; + int remedy_kill_tcp_by_inline_device; /* ����FD����Чʱ, ����inline device�·�DROP���� */ }sapp_config_stream_tcp_inject_t; @@ -74,6 +75,8 @@ typedef struct{ typedef struct{ int max; /* max stream number per thread */ int timeout; + int meaningful_statistics_minimum_pkt; + int meaningful_statistics_minimum_byte; }sapp_config_stream_udp_t; @@ -175,6 +178,10 @@ typedef struct{ int polling_priority; /* call sapp_recv_pkt every call polling_entry times, ���ö��ٴ�polling�����һ��recv pkt, 1��ʾ�������ȼ���ͬ */ int inbound_route_dir; /* ��ʾ�뾳, I2C�����ֵ��0����1 */ char pcap_capture_direction[NAME_MAX]; /* in, out, inout */ + int create_mpls_anyway; + char inject_pkt_mode_string[NAME_MAX]; + int inject_pkt_mode; /* ��ע�뷽ʽ������ֵ, ���: enum send_fake_packet_mode */ + unsigned short inject_mode_inline_device_sport; /* udp socket�ı���Դ�˿�, host order, ������ */ }sapp_config_packet_io_t; typedef struct{ @@ -239,7 +246,7 @@ typedef struct{ typedef struct{ sapp_gval_mthread_sys_stat_t sys_stat; unsigned short stream_seq_per_thread; - char __padding[12]; + 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 a7feda7..3b31b10 100644 --- a/include/private/sapp_pkt_stat.h +++ b/include/private/sapp_pkt_stat.h @@ -58,9 +58,9 @@ typedef enum __sapp_sys_stat_type{ SAPP_STAT_TCP_STREAM_DATA, SAPP_STAT_TCP_STREAM_NOUSE, - SAPP_STAT_TCP_STREAM_C2S, - SAPP_STAT_TCP_STREAM_S2C, - SAPP_STAT_TCP_STREAM_DOUBLE, + SAPP_STAT_TCP_STREAM_C2S, /* ��������������ͳ�� (total pkt num > m and total byte > n) */ + SAPP_STAT_TCP_STREAM_S2C,/* ��������������ͳ��(total pkt num > m and total byte > n) */ + SAPP_STAT_TCP_STREAM_DOUBLE,/* ��������������ͳ�� (total pkt num > m and total byte > n) */ SAPP_STAT_TCP_STREAM_NEW, SAPP_STAT_TCP_STREAM_DEL, @@ -72,7 +72,21 @@ typedef enum __sapp_sys_stat_type{ SAPP_STAT_UDP_STREAM_NEW, SAPP_STAT_UDP_STREAM_DEL, SAPP_STAT_UDP_STREAM_RESET, + + SAPP_STAT_TCP_STREAM_TOTAL_C2S, /* ȫ��TCP��ͳ�� */ + SAPP_STAT_TCP_STREAM_TOTAL_S2C,/* ȫ��TCP��ͳ�� */ + SAPP_STAT_TCP_STREAM_TOTAL_DOUBLE, /* ȫ��TCP��ͳ�� */ + + SAPP_STAT_TCP_LOST_PKT_STREAM_NUM, /* ���������������� */ + SAPP_STAT_TCP_LOST_PKT, /* �����ֽ��ܼ��� */ + + SAPP_STAT_UDP_STREAM_C2S, /* ��������������ͳ�� (total pkt num > m and total byte > n) */ + SAPP_STAT_UDP_STREAM_S2C,/* ��������������ͳ��(total pkt num > m and total byte > n) */ + SAPP_STAT_UDP_STREAM_DOUBLE,/* ��������������ͳ�� (total pkt num > m and total byte > n) */ + SAPP_STAT_UDP_STREAM_TOTAL_C2S, /* ȫ��UDP��ͳ�� */ + SAPP_STAT_UDP_STREAM_TOTAL_S2C,/* ȫ��UDP��ͳ�� */ + SAPP_STAT_UDP_STREAM_TOTAL_DOUBLE, /* ȫ��UDP��ͳ�� */ SAPP_STAT_HASH_LIST_MAX, diff --git a/include/private/stream_internal.h b/include/private/stream_internal.h index bf0ca1e..c84f1de 100644 --- a/include/private/stream_internal.h +++ b/include/private/stream_internal.h @@ -192,7 +192,8 @@ struct tcpdetail_private #endif UCHAR auto_remedy_flag:1; //�Ƿ�����FD���� UCHAR needackflag:1; //��Ҫ�ϴ�ack���� - UCHAR takeoverflag:2; + UCHAR takeoverflag:1; + UCHAR has_lost_pkt_flag:1; //2020-08-23 lijia add, ����������������־λ UCHAR tcpstateflag; // ���ڼ�¼tcp�ĻỰSYN���״̬ UCHAR link_state; // ���ӵ�״̬ UCHAR creat_mod; @@ -298,22 +299,22 @@ struct l2tp_info_pri{ struct sapp_global_single_t{ int signal_take_over_sw; /* �Ƿ�ӹܳ���ϵͳ�ź�, ��SIGSEGV, SIGABRT�ȵ� */ int ipentry_priority_over_ipfrag; /* IP_entry���ȼ�����IP_frag_entry, Ĭ��Ϊ0, ��ӦWY�����ض����� */ - int kill_tcp_with_gdev; /* FDδ��Чʱ, ����gdev�������� */ + //int kill_tcp_with_gdev; /* FDδ��Чʱ, ����gdev�������� */ int cfg_send_tcp_offload_sw; /* ��������MTUʱ, ������Ƭ�ɶ��С��MTU�İ����� */ //int cfg_kill_tcp_rst_num; /* kill_tcp����rst������ */ //int cfg_kill_tcp_rst_signature; /* kill_tcp���͵�rst�Ƿ���Ҫָ����Ϣ, ����ʶ�� */ - int tuple4_reuse_time_interval; /* ��Ԫ�����õ���С���ʱ�� */ + //int tuple4_reuse_time_interval; /* ��Ԫ�����õ���С���ʱ�� */ //void *fs2_handle; const char *fs2_server_ip; unsigned short fs2_server_port_host; short __pad1; - int send_fake_pkt_mode; /* 2018-10-26 lijia add, for PanGu, ����ȱ��FD·��, ����ô���GDEV����rst��, DNS-fake����,mode 0�� Э��ջ���㷢���� 1��Э��ջ���㷢����3��gdevע�뷢������ģʽ��send_fake_pkt_gdev_sport��Ч */ - int send_fake_pkt_gdev_sport; /* 2018-10-26 lijia add, for PanGu, ����ѡ��vxlanԴ�˿� */ + //int send_fake_pkt_mode; /* 2018-10-26 lijia add, for PanGu, ����ȱ��FD·��, ����ô���GDEV����rst��, DNS-fake����,mode 0�� Э��ջ���㷢���� 1��Э��ջ���㷢����3��gdevע�뷢������ģʽ��send_fake_pkt_gdev_sport��Ч */ + //int send_fake_pkt_gdev_sport; /* 2018-10-26 lijia add, for PanGu, ����ѡ��vxlanԴ�˿� */ int send_fake_pkt_sip; int treat_vlan_as_mac_in_mac_sw; /* MAC_IN_MAC���ᱻЭ��ջ��Ϊvlan��, ���߲���debug�ܲ�����, ���Ӵ�����, ǿ�ƽ�vlan����ΪMAC_IN_MAC��ʽ���� */ - int create_mpls_anyway;/*��������MAC��IP��֮�䴴��MPLS��*/ + //int create_mpls_anyway;/*��������MAC��IP��֮�䴴��MPLS��*/ }; diff --git a/src/config/config_parse.cpp b/src/config/config_parse.cpp index 9549c1b..68b0ab0 100644 --- a/src/config/config_parse.cpp +++ b/src/config/config_parse.cpp @@ -322,6 +322,17 @@ static int config_expression_convert(void) pconfig->packet_io.internal.interface.type_bin = CAP_MODEL_TUN; } + if(strncasecmp("sys_route", pconfig->packet_io.inject_pkt_mode_string, strlen("sys_route")) == 0){ + pconfig->packet_io.inject_pkt_mode = SEND_PKT_MODE_STACK_3_LAYER; + }else if(strncasecmp("vxlan_by_inline_device", pconfig->packet_io.inject_pkt_mode_string, strlen("vxlan_by_inline_device")) == 0){ + pconfig->packet_io.inject_pkt_mode = SEND_PKT_MODE_GDEV; + }else if(strncasecmp("raw_ethernet", pconfig->packet_io.inject_pkt_mode_string, strlen("raw_ethernet")) == 0){ + pconfig->packet_io.inject_pkt_mode = SEND_PKT_MODE_STACK_2_LAYER_MUTI_ROUTE; + }else{ + sapp_log(30, ~0, ~0, "[Error]sapp.toml->PACKET_IO.inject_pkt_mode error, only support:%s!", "[sys_route, vxlan_by_inline_device, raw_ethernet]"); + return -1; + } + tmp_str = pconfig->packet_io.external.interface.type_str; if(strncasecmp(tmp_str, "pcap", strlen("pcap")) == 0){ pconfig->packet_io.external.interface.type_bin = CAP_MODEL_PCAP_ONLINE; @@ -566,7 +577,7 @@ void sapp_gval_init(void) int sapp_parse_config(void) { int ret; - //int tmp_int; + int tmp_int; sapp_config_t *pconfig; char str_tmp[ARG_MAX]; @@ -615,7 +626,16 @@ int sapp_parse_config(void) } tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.feature", (char *)"inbound_route_dir", &pconfig->packet_io.inbound_route_dir, 0); tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.feature", (char *)"pcap_capture_direction", pconfig->packet_io.pcap_capture_direction, NAME_MAX, "in"); - + tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.feature", (char *)"create_mpls_anyway", &pconfig->packet_io.create_mpls_anyway, 0); + tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.feature", (char *)"inject_pkt_mode", pconfig->packet_io.inject_pkt_mode_string, NAME_MAX, "sys_route"); + tomlc99_wrap_load_int_def(default_config_file, (char *)"packet_io.feature", (char *)"inject_mode_inline_device_sport", &tmp_int, 54789); + if(tmp_int <= 0 || tmp_int > 65535){ + sapp_log(30, ~0, ~0, "config parse error! invalid value of 'packet_io.feature.inject_mode_inline_device_sport %d'", tmp_int); + return -1; + }else{ + pconfig->packet_io.inject_mode_inline_device_sport = tmp_int; + } + tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.depolyment", (char *)"mode", pconfig->packet_io.depolyment_mode_str, NAME_MAX, "mirror"); tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.internal.interface", (char *)"type", pconfig->packet_io.internal.interface.type_str, NAME_MAX, "pcap"); tomlc99_wrap_load_string_def(default_config_file, (char *)"packet_io.internal.interface", (char *)"name", pconfig->packet_io.internal.interface.name, NAME_MAX, "lo"); @@ -644,11 +664,15 @@ int sapp_parse_config(void) tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.tcp.inject.rst", (char *)"signature_seed1", (int *)&pconfig->stream.tcp.inject.rst_signature_seed1, 65535); tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.tcp.inject.rst", (char *)"signature_seed2", (int *)&pconfig->stream.tcp.inject.rst_signature_seed2, 13); tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.tcp.inject.rst", (char *)"number", (int *)&pconfig->stream.tcp.inject.rst_num, 3); + tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.tcp.inject.rst", (char *)"remedy_kill_tcp_by_inline_device", &pconfig->stream.tcp.inject.remedy_kill_tcp_by_inline_device, 0); /******************************* STREAM.UDP ******************************/ tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.udp", (char *)"max", (int *)&pconfig->stream.udp.max, 5000); tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.udp", (char *)"timeout", (int *)&pconfig->stream.udp.timeout, 60); + tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.udp", (char *)"meaningful_statistics_minimum_pkt", (int *)&pconfig->stream.udp.meaningful_statistics_minimum_pkt, 3); + tomlc99_wrap_load_int_def(default_config_file, (char *)"stream.udp", (char *)"meaningful_statistics_minimum_byte", (int *)&pconfig->stream.udp.meaningful_statistics_minimum_byte, 5); + /******************************* PROFILING ******************************/ tomlc99_wrap_load_int_def(default_config_file, (char *)"profiling.pkt_latency", (char *)"enabled", (int *)&pconfig->profiling.pkt_latency_enabled, 0); diff --git a/src/dealpkt/deal_ethernet.c b/src/dealpkt/deal_ethernet.c index 816cccb..106a0ee 100644 --- a/src/dealpkt/deal_ethernet.c +++ b/src/dealpkt/deal_ethernet.c @@ -98,7 +98,7 @@ int eth_entry(struct streaminfo_private *fstream_pr, const void *this_layer_hdr, ((raw_pkt_t *)raw_pkt)->raw_pkt_len = raw_pkt->__lib_raw_pkt_len - sizeof(struct mesa_ethernet_hdr);
}
}
- if(sapp_global_single.create_mpls_anyway != 0)
+ if(sapp_global_val->config.packet_io.create_mpls_anyway != 0)
{
if(eth_type == ETHERTYPE_IP || eth_type == ETHERTYPE_IPv6)
{
diff --git a/src/dealpkt/deal_mac_in_mac.c b/src/dealpkt/deal_mac_in_mac.c index a380227..41ec37e 100644 --- a/src/dealpkt/deal_mac_in_mac.c +++ b/src/dealpkt/deal_mac_in_mac.c @@ -66,7 +66,7 @@ int mac_in_mac_entry(struct streaminfo_private *fstream_pr, const void *this_lay }
}
eth_type = ntohs(inner_ether_hdr->ether_type);
- if(sapp_global_single.create_mpls_anyway != 0)
+ if(sapp_global_val->config.packet_io.create_mpls_anyway != 0)
{
if(eth_type == ETHERTYPE_IP || eth_type == ETHERTYPE_IPv6)
{
diff --git a/src/dealpkt/deal_tcp.c b/src/dealpkt/deal_tcp.c index 1aeeb24..64f9d14 100644 --- a/src/dealpkt/deal_tcp.c +++ b/src/dealpkt/deal_tcp.c @@ -1787,6 +1787,8 @@ static void tcp_set_new_data(struct streaminfo *a_tcp,struct half_tcpstream * pdetail->lostlen=rcv->count_ideal-rcv->count-rcv->totallost; rcv->totallost+=pdetail->lostlen; + + sapp_global_val->mthread_volatile[a_tcp->threadnum]->sys_stat.length[SAPP_STAT_TCP_LOST_PKT] += pdetail->lostlen; pdetail->datalen=len_new; pdetail->pdata=pdata_new; @@ -2135,6 +2137,7 @@ static int tcp_deal_data(struct streamindex *pindex,const void *this_iphdr,const { ret=tcp_deal_unorder(pindex,pstream,rcv,snd, !CHECK_ORDER_DATA); } + pdetail_pr->has_lost_pkt_flag = 1; } return ret; } @@ -2379,9 +2382,9 @@ static inline int tcp_tuple4_reuse(const struct streaminfo *pstream, const struc } } - /* lijia 2017-12-06 add */ - if((1 == is_reuse) && (sapp_global_single.tuple4_reuse_time_interval > 0)){ - if(pdetail_pr->tcpdetail_public.createtime + sapp_global_single.tuple4_reuse_time_interval >= (UINT64)g_CurrentTime){ + /* lijia 2017-12-06 add */ + if((1 == is_reuse) && (sapp_global_val->config.stream.tcp.tuple4_reuse_time_interval > 0)){ + if(pdetail_pr->tcpdetail_public.createtime + sapp_global_val->config.stream.tcp.tuple4_reuse_time_interval >= (UINT64)g_CurrentTime){ is_reuse = 0; /* ��Ԫ����ͬ, ����Ų�ͬ�����������ʱ��̫��, һ��30������, ���ƹ��������� */ } } diff --git a/src/dealpkt/stream_manage.c b/src/dealpkt/stream_manage.c index 1df8c80..3e8a240 100644 --- a/src/dealpkt/stream_manage.c +++ b/src/dealpkt/stream_manage.c @@ -1897,13 +1897,46 @@ void hash_del_stream(struct streamindex *pindex) pelementcount=G_MESA_GLOBAL_STREAM[threadnum]->udp_stream_talbe_hash_count; //g_SysInputInfo[threadnum][SYS_UDP_LINK_DEL]++; local_sys_stat->count[SAPP_STAT_UDP_STREAM_DEL]++; + if(ptmp->pudpdetail->clientpktnum+ptmp->pudpdetail->serverpktnum >= sapp_global_val->config.stream.udp.meaningful_statistics_minimum_pkt + && ptmp->pudpdetail->clientbytes+ptmp->pudpdetail->serverbytes >= sapp_global_val->config.stream.udp.meaningful_statistics_minimum_byte) + { + if(ptmp->dir == DIR_DOUBLE) + { + local_sys_stat->count[SAPP_STAT_UDP_STREAM_DOUBLE]++; + } + else if(ptmp->dir == DIR_C2S) + { + local_sys_stat->count[SAPP_STAT_UDP_STREAM_C2S]++; + } + else if(ptmp->dir == DIR_S2C) + { + local_sys_stat->count[SAPP_STAT_UDP_STREAM_S2C]++; + } + } + if(ptmp->dir == DIR_DOUBLE) + { + local_sys_stat->count[SAPP_STAT_UDP_STREAM_TOTAL_DOUBLE]++; + } + else if(ptmp->dir == DIR_C2S) + { + local_sys_stat->count[SAPP_STAT_UDP_STREAM_TOTAL_C2S]++; + } + else if(ptmp->dir == DIR_S2C) + { + local_sys_stat->count[SAPP_STAT_UDP_STREAM_TOTAL_S2C]++; + } } else if (STREAM_TYPE_TCP==ptmp->type) { + const struct tcpdetail_private *pdetail_pr=(struct tcpdetail_private*)(ptmp->pdetail); phashstream=G_MESA_GLOBAL_STREAM[threadnum]->tcp_stream_table; pelementcount=G_MESA_GLOBAL_STREAM[threadnum]->tcp_stream_talbe_hash_count; //g_SysInputInfo[threadnum][SYS_TCP_LINK_DEL]++; local_sys_stat->count[SAPP_STAT_TCP_STREAM_DEL]++; + + if(pdetail_pr->has_lost_pkt_flag != 0){ + local_sys_stat->count[SAPP_STAT_TCP_LOST_PKT_STREAM_NUM]++; + } if(ptmp->ptcpdetail->clientpktnum+ptmp->ptcpdetail->serverpktnum >= sapp_global_val->config.stream.tcp.meaningful_statistics_minimum_pkt && ptmp->ptcpdetail->clientbytes+ptmp->ptcpdetail->serverbytes >= sapp_global_val->config.stream.tcp.meaningful_statistics_minimum_byte) @@ -1926,6 +1959,20 @@ void hash_del_stream(struct streamindex *pindex) else ; } + + if(ptmp->dir == DIR_DOUBLE) + { + local_sys_stat->count[SAPP_STAT_TCP_STREAM_TOTAL_DOUBLE]++; + } + else if(ptmp->dir == DIR_C2S) + { + local_sys_stat->count[SAPP_STAT_TCP_STREAM_TOTAL_C2S]++; + } + else if(ptmp->dir == DIR_S2C) + { + local_sys_stat->count[SAPP_STAT_TCP_STREAM_TOTAL_S2C]++; + } + }else{ phashstream = NULL; pelementcount = 0; @@ -2685,7 +2732,7 @@ void update_opposite_addr_info(struct streaminfo_private *pstream_pr, } break; case ADDR_TYPE_MPLS: - if(sapp_global_single.create_mpls_anyway != 0){ + if(sapp_global_val->config.packet_io.create_mpls_anyway != 0){ if(cur_dir == DIR_C2S){ memcpy(pstream_pr->stream_public.addr.mpls->src_mpls_pkt, p_stack->stream_public.addr.mpls->src_mpls_pkt, diff --git a/src/entry/CMakeLists.txt b/src/entry/CMakeLists.txt index d8afdb2..8d2b90b 100644 --- a/src/entry/CMakeLists.txt +++ b/src/entry/CMakeLists.txt @@ -20,7 +20,7 @@ add_executable(sapp sapp_init.c sapp_main.c sapp_global_val.c) target_compile_options(sapp PUBLIC ${MEM_POOL_DEFINITIONS}) target_link_libraries(sapp nsl pthread dl m pcap) target_link_libraries(sapp MESA_handle_logger MESA_prof_load) -target_link_libraries(sapp sapp_assistant gdev_assistant) +target_link_libraries(sapp sapp_assistant) #set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) #set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) @@ -28,7 +28,7 @@ target_link_libraries(sapp sapp_assistant gdev_assistant) #set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR}/bin) -set(SAPP_MODULES breakpad_mini_static breakpad-client-static iknow timestamp_record md5 symbol_check MESA_sleep MESA_socket_wrap packet_io dealpkt project plugctrl common config timer tomlc99_wrap libevent-static) +set(SAPP_MODULES breakpad_mini_static breakpad-client-static iknow timestamp_record md5 symbol_check MESA_sleep MESA_socket_wrap packet_io dealpkt project plugctrl common config timer tomlc99_wrap libevent-static gdev_assistant ) target_link_libraries(sapp -Wl,--whole-archive ${SAPP_MODULES} -Wl,--no-whole-archive ${SAPP_DEPEND_DYN_LIB}) diff --git a/src/entry/sapp_init.c b/src/entry/sapp_init.c index 764ef26..b8230a7 100644 --- a/src/entry/sapp_init.c +++ b/src/entry/sapp_init.c @@ -144,8 +144,8 @@ int MESA_platform_init(int argc, char *argv[]) //MESA_load_profile_int_def("conf/main.conf","Module", "CreatLinkMode", &create_link_mode, TCP_CTEAT_LINK_BYSYN); - MESA_load_profile_int_def("conf/main.conf","Module", "TcpAllEnable", &TcpAllEnable, 1); - tcp_set_support_tcpall_model(TcpAllEnable); + //MESA_load_profile_int_def("conf/main.conf","Module", "TcpAllEnable", &TcpAllEnable, 1); + //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); @@ -321,7 +321,7 @@ int MESA_platform_init(int argc, char *argv[]) MESA_load_profile_int_def("conf/main.conf", "Module", "signal_take_over_switch", &sapp_global_single.signal_take_over_sw, 0); MESA_load_profile_int_def("conf/main.conf", "Module", "ipentry_priority_over_ipfrag", &sapp_global_single.ipentry_priority_over_ipfrag, 0); - MESA_load_profile_int_def("conf/main.conf", "Module", "tuple4_reuse_time_interval", &sapp_global_single.tuple4_reuse_time_interval, 3); + //MESA_load_profile_int_def("conf/main.conf", "Module", "tuple4_reuse_time_interval", &sapp_global_single.tuple4_reuse_time_interval, 3); #endif init_stream_manage(g_iThreadNum); @@ -362,15 +362,16 @@ int MESA_platform_init(int argc, char *argv[]) stream_register_udp_raw(udp_teredo_identify_entry); stream_register_udp_raw(udp_gtp_identify_entry); +#if 0 MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"kill_tcp_with_gdev", &sapp_global_single.kill_tcp_with_gdev, 0); if(sapp_global_single.kill_tcp_with_gdev != 0){ if(gdev_block_init() < 0){ printf("\n\033[33m[Warning]gdev_block_init error!\033[0m\n"); } } +#endif - MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"symbol_conflict_check", &int_tmp, - 0); + MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"symbol_conflict_check", &int_tmp,0); if(int_tmp != 0){ /* NOTE: ���������һ��Ҫ��plugctrl_proc(), �����в������֮��, Ĭ�Ͽ��� */ symbol_check(); /* 2016-01-13 Lijia add, ���ȫ�ַ�������ͻ */ @@ -382,9 +383,9 @@ int MESA_platform_init(int argc, char *argv[]) usleep(10000); } - MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"create_mpls_anyway", &sapp_global_single.create_mpls_anyway, 0); - MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"send_fake_pkt_mode", &sapp_global_single.send_fake_pkt_mode, 0); - MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"send_fake_pkt_gdev_sport", &sapp_global_single.send_fake_pkt_gdev_sport, 15); + //MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"create_mpls_anyway", &sapp_global_single.create_mpls_anyway, 0); + //MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"send_fake_pkt_mode", &sapp_global_single.send_fake_pkt_mode, 0); + //MESA_load_profile_int_def((char *)"conf/main.conf", (char *)"Module", (char *)"send_fake_pkt_gdev_sport", &sapp_global_single.send_fake_pkt_gdev_sport, 15); sapp_assistant_init(); diff --git a/src/inner_plug/gdev_block.c b/src/inner_plug/gdev_block.c index 1ce9dbe..2ca05b9 100644 --- a/src/inner_plug/gdev_block.c +++ b/src/inner_plug/gdev_block.c @@ -4,7 +4,7 @@ extern "C" { #include "sapp_api.h"
#include "sapp_private_api.h"
-
+#include "grule.h"
static void * gdev_block_c3_handle;
static unsigned char gdev_block_c3_license[8];
@@ -12,7 +12,7 @@ static unsigned gdev_block_c3_service_type; static unsigned gdev_block_c3_rule_scope;
static int gdev_block_module_conn_flag = 0;
-#define GDEV_BLOCK_PLUG_CONF "./conf/gdev_block.conf"
+#define GDEV_BLOCK_PLUG_CONF "./etc/gdev_block.conf"
/* ʹ�ö�̬����ģʽ, ������libc3client.so������, ����sapp�������� */
static void * (*dl_grule_open)(void);
diff --git a/src/packet_io/packet_io.c b/src/packet_io/packet_io.c index 667d58a..5efde37 100644 --- a/src/packet_io/packet_io.c +++ b/src/packet_io/packet_io.c @@ -678,7 +678,16 @@ void packet_io_exit(void) int packet_io_init(int argc, char *argv[]) { - int i; + int i, ret; + + if(sapp_global_val->config.stream.tcp.inject.remedy_kill_tcp_by_inline_device != 0){ + ret = gdev_block_init(); + if(ret < 0){ + printf("\n\033[33m[Error]gdev_block_init error!\033[0m\n"); + return -1; + } + } + #if (0 == SAPP_AS_TARGET_SO) if(0 == use_custom_pkt_cb){ packet_io_register_cb(mesa_default_pkt_cb); @@ -805,7 +814,7 @@ static int packet_io_calc_ethernet_offset_to_ip(const unsigned char *sendbuf) const struct mesa_ethernet_hdr *outer_ehdr; ///const struct mesa_ethernet_hdr *inner_ehdr; - if(sapp_global_single.send_fake_pkt_mode == SEND_PKT_MODE_GDEV){ + if(sapp_global_val->config.packet_io.inject_pkt_mode == SEND_PKT_MODE_GDEV){ sendbuf += VXLAN_HDR_RESERVED_LEN; /* vxlanģʽ��Ԥ����vxlan�����mac,ip,udpͷ��, ��ת���ڲ�macͷ */ } @@ -1016,7 +1025,7 @@ static int packet_io_send_by_manual_conf(MESA_send_handle *send_handle,int datal unsigned char send_route_mac[MAC_ADDR_LEN] = ""; unsigned char *p_dst_mac; - if(sapp_global_single.send_fake_pkt_mode == SEND_PKT_MODE_STACK_2_LAYER_MUTI_ROUTE ) + if(sapp_global_val->config.packet_io.inject_pkt_mode == SEND_PKT_MODE_STACK_2_LAYER_MUTI_ROUTE ) { ret = packet_io_get_sendroute_mac(mim_mem_hdr.dev_id, mim_mem_hdr.link_id, send_route_mac); if(ret < 0){ @@ -1054,12 +1063,13 @@ int packet_io_send_fake_pkt(MESA_send_handle *send_handle,int datalen,int send_t if(g_topology_mode & __NET_CONN_PARALLEL) { - if(sapp_global_single.send_fake_pkt_mode == SEND_PKT_MODE_GDEV) + if(sapp_global_val->config.packet_io.inject_pkt_mode == SEND_PKT_MODE_GDEV) { ret = packet_io_send_fake_pkt_by_gdev(send_handle, (enum addr_type_t)low_layer_type, (char *)send_handle->send_buf, datalen, dir, feedback_buf, feedback_buf_len); } - else if(sapp_global_single.send_fake_pkt_mode == SEND_PKT_MODE_STACK_2_LAYER_1_ROUTE || sapp_global_single.send_fake_pkt_mode == SEND_PKT_MODE_STACK_2_LAYER_MUTI_ROUTE) + else if(sapp_global_val->config.packet_io.inject_pkt_mode == SEND_PKT_MODE_STACK_2_LAYER_1_ROUTE + || sapp_global_val->config.packet_io.inject_pkt_mode == SEND_PKT_MODE_STACK_2_LAYER_MUTI_ROUTE) { ether_type = net_layer_to_ethernet_protocol(low_layer_type); ret = packet_io_send_by_manual_conf(send_handle, datalen, dir, ether_type); diff --git a/src/packet_io/packet_io_status.cpp b/src/packet_io/packet_io_status.cpp index 3eb81c7..5e431f6 100644 --- a/src/packet_io/packet_io_status.cpp +++ b/src/packet_io/packet_io_status.cpp @@ -187,7 +187,7 @@ void sysinfo_output(void) for(i=0;i<g_packet_io_thread_num;i++){ for(j = 0; j < SAPP_STAT_NUM_MAX; j++){ cur_count[j] += mstat[i]->sys_stat.count[j]; - cur_length[j] += mstat[i]->sys_stat.length[j]; + cur_length[j] += mstat[i]->sys_stat.length[j]; } } @@ -226,29 +226,6 @@ void sysinfo_output(void) fprintf(fp,"%12s %12llu %12llu\n", "IPV4", cur_count[SAPP_STAT_DROP_IPV4], cur_length[SAPP_STAT_DROP_IPV4]); fprintf(fp,"%12s %12llu %12llu\n", "IPV6", cur_count[SAPP_STAT_DROP_IPV6], cur_length[SAPP_STAT_DROP_IPV6]); - -#if 0 /* 20190522 lijia close */ - if(ABBR_INTERFACE_TYPE == CAP_MODEL_MARSIOV4) - { - fprintf(fp,"\n------------------------------- MARSIO mbuf statistics detail -----------------------------\n"); - fprintf(fp,"%3s %-27s %-19s %-27s\n", "", "|-----------Current---------|", "|------Realtime-----|", "|--------From-of-startup---------|"); - fprintf(fp,"%3s %8s %9s %10s %10s %10s %10s %9s %13s\n", "tid", "mbuf-recv", "mbuf-alloc", "mbuf-send", - "mbuf-free", - "mbuf-recv/s", "mbuf-alloc/s", "mbuf-send/s", "mbuf-free/s"); - for(i = 0; i < g_packet_io_thread_num; i++){ - fprintf(fp, "%3d %8llu %9llu %10llu %10llu %10llu %10llu %9llu %13llu\n", - i, - g_SysInputInfo[i][PKT_MARSIO_RCV], - g_SysInputInfo[i][PKT_MARSIO_MALLOC], - g_SysInputInfo[i][PKT_MARSIO_SND], - g_SysInputInfo[i][PKT_MARSIO_FREE], - (g_SysInputInfo[i][PKT_MARSIO_RCV]-g_SysInputInfo_old[i][PKT_MARSIO_RCV]), - (g_SysInputInfo[i][PKT_MARSIO_MALLOC]-g_SysInputInfo_old[i][PKT_MARSIO_MALLOC]), - (g_SysInputInfo[i][PKT_MARSIO_SND]-g_SysInputInfo_old[i][PKT_MARSIO_SND]), - (g_SysInputInfo[i][PKT_MARSIO_FREE]-g_SysInputInfo_old[i][PKT_MARSIO_FREE])); - } - } -#endif fprintf(fp,"\n------------------------------- TCP statistics detail -----------------------------\n"); fprintf(fp,"%3s %-27s %-19s %-27s %-27s\n", "", "|-----------Current---------|", "|------Realtime-----|", @@ -301,21 +278,54 @@ void sysinfo_output(void) fprintf(fp,"%-12s %12llu %12s %12llu %12s\n","Unknown",cur_count[SAPP_STAT_RCV_UNKNOWN],byte_convert_human(cur_length[SAPP_STAT_RCV_UNKNOWN],1,1,s1),(cur_count[SAPP_STAT_RCV_UNKNOWN]-history_count[SAPP_STAT_RCV_UNKNOWN]),byte_convert_human((cur_length[SAPP_STAT_RCV_UNKNOWN]-history_length[SAPP_STAT_RCV_UNKNOWN]),1,8,s2)); fprintf(fp,"#################################################################\n"); - - fprintf(fp, "These statistics meet the conditions: (total pkt num > %d and total byte > %d)\n", + fprintf(fp,"Network Link Quality:\n"); + fprintf(fp,"%-12s %12s %12s %12s \n","LOST_STAT", "total", "dropped", "percent"); + if((cur_length[SAPP_STAT_RCV_TCP] > 0) && (cur_length[SAPP_STAT_TCP_LOST_PKT] > 0)){ + fprintf(fp,"%-12s %12llu %12llu %2.10f\n", "bytes", cur_length[SAPP_STAT_RCV_TCP], cur_length[SAPP_STAT_TCP_LOST_PKT], (double)cur_length[SAPP_STAT_TCP_LOST_PKT]/(double)cur_length[SAPP_STAT_RCV_TCP]); + }else{ + fprintf(fp,"%-12s %12llu %12llu %2.10f\n", "bytes", cur_length[SAPP_STAT_RCV_TCP], cur_length[SAPP_STAT_TCP_LOST_PKT], 0); + } + if((cur_count[SAPP_STAT_TCP_STREAM_NEW] > 0) && (cur_count[SAPP_STAT_TCP_LOST_PKT_STREAM_NUM] > 0)){ + fprintf(fp,"%-12s %12llu %12llu %3.10f\n", "stream", cur_count[SAPP_STAT_TCP_STREAM_NEW], cur_count[SAPP_STAT_TCP_LOST_PKT_STREAM_NUM], (double)cur_count[SAPP_STAT_TCP_LOST_PKT_STREAM_NUM]/(double)cur_count[SAPP_STAT_TCP_STREAM_NEW]); + }else{ + fprintf(fp,"%-12s %12llu %12llu %3.10f\n", "stream", cur_count[SAPP_STAT_TCP_STREAM_NEW], cur_count[SAPP_STAT_TCP_LOST_PKT_STREAM_NUM], 0); + } + + fprintf(fp,"-----------------------------------------------------------------\n"); + fprintf(fp,"%-12s %12s %12s\n","STREAM_TYPE", "total_stream", "link_del/s"); + fprintf(fp,"%-12s %12llu %12llu\n", "TCP_DOU", cur_count[SAPP_STAT_TCP_STREAM_TOTAL_DOUBLE], + cur_count[SAPP_STAT_TCP_STREAM_TOTAL_DOUBLE] - history_count[SAPP_STAT_TCP_STREAM_TOTAL_DOUBLE]); + fprintf(fp,"%-12s %12llu %12llu\n", "TCP_C2S", cur_count[SAPP_STAT_TCP_STREAM_TOTAL_C2S], + cur_count[SAPP_STAT_TCP_STREAM_TOTAL_C2S] - history_count[SAPP_STAT_TCP_STREAM_TOTAL_C2S]); + fprintf(fp,"%-12s %12llu %12llu\n", "TCP_S2C", cur_count[SAPP_STAT_TCP_STREAM_TOTAL_S2C], + cur_count[SAPP_STAT_TCP_STREAM_TOTAL_S2C] - history_count[SAPP_STAT_TCP_STREAM_TOTAL_S2C]); + + fprintf(fp,"%-12s %12llu %12llu\n", "UDP_DOU", cur_count[SAPP_STAT_UDP_STREAM_TOTAL_DOUBLE], + cur_count[SAPP_STAT_UDP_STREAM_TOTAL_DOUBLE] - history_count[SAPP_STAT_UDP_STREAM_TOTAL_DOUBLE]); + fprintf(fp,"%-12s %12llu %12llu\n", "UDP_C2S", cur_count[SAPP_STAT_UDP_STREAM_TOTAL_C2S], + cur_count[SAPP_STAT_UDP_STREAM_TOTAL_C2S] - history_count[SAPP_STAT_UDP_STREAM_TOTAL_C2S]); + fprintf(fp,"%-12s %12llu %12llu\n", "UDP_S2C", cur_count[SAPP_STAT_UDP_STREAM_TOTAL_S2C], + cur_count[SAPP_STAT_UDP_STREAM_TOTAL_S2C] - history_count[SAPP_STAT_UDP_STREAM_TOTAL_S2C]); + + fprintf(fp,"----------------------------------------------------------------\n"); + fprintf(fp, "The follow statistics meet the conditions:(stream pkt num > %d and byte > %d)\n", sapp_global_val->config.stream.tcp.meaningful_statistics_minimum_pkt, sapp_global_val->config.stream.tcp.meaningful_statistics_minimum_byte); - fprintf(fp,"%-10s %12s %12s\n","TCP_LINK", "total_link", "link_del/s"); - //fprintf(fp,"%-10s %12llu %12llu\n", "TCP_NEW", cur_count[SYS_TCP_LINK_NEW],cur_count[SYS_TCP_LINK_NEW] - sysinfo_old[SYS_TCP_LINK_NEW]); - //fprintf(fp,"%-10s %12llu %12llu\n", "TCP_DATA", cur_count[SYS_TCP_LINK_DATA],cur_count[SYS_TCP_LINK_DATA] - sysinfo_old[SYS_TCP_LINK_DATA]); - ///fprintf(fp,"%-10s %12llu %12llu\n", "TCP_DEL", cur_count[SYS_TCP_LINK_DEL],cur_count[SYS_TCP_LINK_DEL] - sysinfo_old[SYS_TCP_LINK_DEL]); - fprintf(fp,"%-10s %12llu %12llu\n", "TCP_DOU", cur_count[SAPP_STAT_TCP_STREAM_DOUBLE], + fprintf(fp,"%-12s %12s %12s\n","STREAM_TYPE", "total_stream", "link_del/s"); + fprintf(fp,"%-12s %12llu %12llu\n", "TCP_DOU", cur_count[SAPP_STAT_TCP_STREAM_DOUBLE], cur_count[SAPP_STAT_TCP_STREAM_DOUBLE] - history_count[SAPP_STAT_TCP_STREAM_DOUBLE]); - fprintf(fp,"%-10s %12llu %12llu\n", "TCP_C2S", cur_count[SAPP_STAT_TCP_STREAM_C2S], + fprintf(fp,"%-12s %12llu %12llu\n", "TCP_C2S", cur_count[SAPP_STAT_TCP_STREAM_C2S], cur_count[SAPP_STAT_TCP_STREAM_C2S] - history_count[SAPP_STAT_TCP_STREAM_C2S]); - fprintf(fp,"%-10s %12llu %12llu\n", "TCP_S2C", cur_count[SAPP_STAT_TCP_STREAM_S2C], + fprintf(fp,"%-12s %12llu %12llu\n", "TCP_S2C", cur_count[SAPP_STAT_TCP_STREAM_S2C], cur_count[SAPP_STAT_TCP_STREAM_S2C] - history_count[SAPP_STAT_TCP_STREAM_S2C]); + fprintf(fp,"%-12s %12llu %12llu\n", "UDP_DOU", cur_count[SAPP_STAT_UDP_STREAM_DOUBLE], + cur_count[SAPP_STAT_UDP_STREAM_DOUBLE] - history_count[SAPP_STAT_UDP_STREAM_DOUBLE]); + fprintf(fp,"%-12s %12llu %12llu\n", "UDP_C2S", cur_count[SAPP_STAT_UDP_STREAM_C2S], + cur_count[SAPP_STAT_UDP_STREAM_C2S] - history_count[SAPP_STAT_UDP_STREAM_C2S]); + fprintf(fp,"%-12s %12llu %12llu\n", "UDP_S2C", cur_count[SAPP_STAT_UDP_STREAM_S2C], + cur_count[SAPP_STAT_UDP_STREAM_S2C] - history_count[SAPP_STAT_UDP_STREAM_S2C]); + fprintf(fp,"#################################################################\n"); fprintf(fp,"%-10s %12s %12s %12s %12s\n","SND-PKT", "total_pkt", "total_len","pps", "bps"); fprintf(fp,"%-10s %12llu %12s %12llu %12s\n", "TCP_RST", cur_count[SAPP_STAT_SND_TCP_RST], byte_convert_human(cur_length[SAPP_STAT_SND_TCP_RST], 1, 1, s1),(cur_count[SAPP_STAT_SND_TCP_RST]-history_count[SAPP_STAT_SND_TCP_RST]), byte_convert_human((cur_length[SAPP_STAT_SND_TCP_RST]-history_length[SAPP_STAT_SND_TCP_RST]), 1,8,s2)); diff --git a/src/packet_io/sendpacket.c b/src/packet_io/sendpacket.c index aedfb6c..a31ee41 100644 --- a/src/packet_io/sendpacket.c +++ b/src/packet_io/sendpacket.c @@ -2331,7 +2331,7 @@ static int __do_kill_tcp(struct streaminfo *stream, const void *ext_raw_pkt, int send_handle->user_arg = (void *)stream; //} - if(sapp_global_single.send_fake_pkt_mode == SEND_PKT_MODE_GDEV){ /* gdevע��ģʽʱԤ���ײ��װvxlan���Ŀռ�, �����ٶ���copy */ + if(sapp_global_val->config.packet_io.inject_pkt_mode == SEND_PKT_MODE_GDEV){ /* gdevע��ģʽʱԤ���ײ��װvxlan���Ŀռ�, �����ٶ���copy */ reserved_hdr_len += sizeof(vxlan_header_t); } @@ -2454,7 +2454,8 @@ int MESA_kill_tcp_remedy(struct streaminfo *stream, const void *ext_raw_pkt) struct streaminfo_private *stream_pr = (struct streaminfo_private *)stream; int last_send_time = g_CurrentTime % 255; - if((sapp_global_single.kill_tcp_with_gdev != 0 ) && (stream_pr->gdev_block_timer < last_send_time)){ + if((sapp_global_val->config.stream.tcp.inject.remedy_kill_tcp_by_inline_device != 0 ) + && (stream_pr->gdev_block_timer < last_send_time)){ /* ��ֹFD����ЧƵ������c3�ӿ�, ����һ����, ÿ��1�����һ��C3 */ stream_pr->gdev_block_timer = last_send_time; gdev_block_send_rule(stream); @@ -3131,7 +3132,7 @@ static int send_handle_init(int tot_thread_num) struct sockaddr_in listen_addr; bzero(&listen_addr, sizeof(listen_addr)); listen_addr.sin_family = AF_INET; - listen_addr.sin_port = htons((unsigned short)sapp_global_single.send_fake_pkt_gdev_sport); /* ���������ļ���дvxlanԴ�˿� */ + listen_addr.sin_port = htons((unsigned short)sapp_global_val->config.packet_io.inject_mode_inline_device_sport); /* ���������ļ���дvxlanԴ�˿� */ if(bind(g_send_handle[i].raw_udp_fd, (struct sockaddr *) &listen_addr, sizeof(listen_addr)) != 0){ printf("socket bind udp error"); return -1; |
