From 935aa7235e05b508ca7c989c2b54abad45bc2c1f Mon Sep 17 00:00:00 2001 From: wangmenglan Date: Wed, 10 May 2023 20:06:07 +0800 Subject: TFE优化解析控制报文,解决mpack只有proxy字段时,解析错误 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/tfe_mpack.cpp | 4 ++-- common/src/tfe_packet_io.cpp | 6 ------ conf/tfe/tfe.conf | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/common/src/tfe_mpack.cpp b/common/src/tfe_mpack.cpp index e7f2893..5844f52 100644 --- a/common/src/tfe_mpack.cpp +++ b/common/src/tfe_mpack.cpp @@ -280,7 +280,7 @@ int parse_messagepack(const char* data, size_t length, void *ctx) } params = mpack_node_map_cstr(root, "params"); - if (!mpack_node_is_nil(mpack_node_map_cstr(params, "sce"))) + if (!mpack_node_is_missing(mpack_node_map_str_optional(params, "sce", strlen("sce")))) { sce_map = mpack_node_map_cstr(params, "sce"); if (mpack_node_is_nil(mpack_node_map_cstr(sce_map, "rule_ids"))) @@ -301,7 +301,7 @@ int parse_messagepack(const char* data, size_t length, void *ctx) } } - if (mpack_node_is_nil(mpack_node_map_cstr(params, "proxy"))) + if (mpack_node_is_missing(mpack_node_map_str_optional(params, "proxy", strlen("proxy")))) { TFE_LOG_ERROR(g_default_logger, "%s: unexpected control packet: (proxy no found)", LOG_TAG_CTRLPKT); goto error; diff --git a/common/src/tfe_packet_io.cpp b/common/src/tfe_packet_io.cpp index ef9c8f9..766ea48 100644 --- a/common/src/tfe_packet_io.cpp +++ b/common/src/tfe_packet_io.cpp @@ -1045,12 +1045,6 @@ static void send_event_log(struct session_ctx *s_ctx, int thread_seq, void *ctx) } return; } - - struct ethhdr *eth_hdr = (struct ethhdr *)s_ctx->ctrl_meta->raw_data; - struct ip *ip_hdr = (struct ip *)((char *)eth_hdr + sizeof(struct ethhdr)); - struct tcphdr *tcp_hdr = (struct tcphdr *)((char *)ip_hdr + sizeof(struct ip)); - // ip_hdr->ip_len = htons(sizeof(struct ip) + (ntohs(tcp_hdr->th_off) * 4) + size); - ip_hdr->ip_len = htons(sizeof(struct ip) + 20 + size); char *raw_packet_header_data = s_ctx->ctrl_meta->raw_data; int raw_packet_header_len = s_ctx->ctrl_meta->l7offset; diff --git a/conf/tfe/tfe.conf b/conf/tfe/tfe.conf index 5352e72..3b31416 100644 --- a/conf/tfe/tfe.conf +++ b/conf/tfe/tfe.conf @@ -170,8 +170,8 @@ table_info=resource/pangu/table_info_traffic_mirror.conf stat_file=log/traffic_mirror.status [traffic_steering] -enable_steering_http=1 -enable_steering_ssl=1 +enable_steering_http=0 +enable_steering_ssl=0 # 17: 0x11 so_mask_client=17 # 34: 0x22 -- cgit v1.2.3