TFE优化解析控制报文,解决mpack只有proxy字段时,解析错误

This commit is contained in:
wangmenglan
2023-05-10 20:06:07 +08:00
parent 2a55a2be75
commit 935aa7235e
3 changed files with 4 additions and 10 deletions

View File

@@ -280,7 +280,7 @@ int parse_messagepack(const char* data, size_t length, void *ctx)
} }
params = mpack_node_map_cstr(root, "params"); 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"); sce_map = mpack_node_map_cstr(params, "sce");
if (mpack_node_is_nil(mpack_node_map_cstr(sce_map, "rule_ids"))) 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); TFE_LOG_ERROR(g_default_logger, "%s: unexpected control packet: (proxy no found)", LOG_TAG_CTRLPKT);
goto error; goto error;

View File

@@ -1046,12 +1046,6 @@ static void send_event_log(struct session_ctx *s_ctx, int thread_seq, void *ctx)
return; 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; char *raw_packet_header_data = s_ctx->ctrl_meta->raw_data;
int raw_packet_header_len = s_ctx->ctrl_meta->l7offset; int raw_packet_header_len = s_ctx->ctrl_meta->l7offset;
marsio_buff_malloc_global(packet_io->instance, tx_buffs, 1, 0, thread_seq); marsio_buff_malloc_global(packet_io->instance, tx_buffs, 1, 0, thread_seq);

View File

@@ -170,8 +170,8 @@ table_info=resource/pangu/table_info_traffic_mirror.conf
stat_file=log/traffic_mirror.status stat_file=log/traffic_mirror.status
[traffic_steering] [traffic_steering]
enable_steering_http=1 enable_steering_http=0
enable_steering_ssl=1 enable_steering_ssl=0
# 17: 0x11 # 17: 0x11
so_mask_client=17 so_mask_client=17
# 34: 0x22 # 34: 0x22