🐞 fix(TSG-15212): 修复TFE_CMSG_SSL_INTERCEPT_STATE字段设置错误; 修复msgpack默写字段为空时, 增加默认值
This commit is contained in:
@@ -50,14 +50,14 @@ extern bool g_print_to_stderr;
|
||||
|
||||
#define TFE_LOG_ERROR(handler, fmt, ...) \
|
||||
do { if(g_print_to_stderr) fprintf(stderr, fmt "\n" , ##__VA_ARGS__); \
|
||||
MESA_handle_runtime_log(handler, RLOG_LV_FATAL, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0)
|
||||
MESA_handle_runtime_log((struct log_handle_t *)handler, RLOG_LV_FATAL, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0)
|
||||
|
||||
#define TFE_LOG_INFO(handler, fmt, ...) \
|
||||
do { if(g_print_to_stderr) fprintf(stderr, fmt "\n", ##__VA_ARGS__); \
|
||||
MESA_handle_runtime_log(handler, RLOG_LV_INFO, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
MESA_handle_runtime_log((struct log_handle_t *)handler, RLOG_LV_INFO, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
|
||||
#define TFE_LOG_DEBUG(handler, fmt, ...) \
|
||||
do { MESA_handle_runtime_log(handler, RLOG_LV_DEBUG, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
do { MESA_handle_runtime_log((struct log_handle_t *)handler, RLOG_LV_DEBUG, __FUNCTION__, fmt, ##__VA_ARGS__); } while(0) \
|
||||
|
||||
#define CHECK_OR_EXIT(condition, fmt, ...) \
|
||||
do { if(!(condition)) { TFE_LOG_ERROR(g_default_logger, fmt, ##__VA_ARGS__); exit(EXIT_FAILURE); } } while(0) \
|
||||
|
||||
@@ -79,14 +79,20 @@ struct mpack_mmap_id2type
|
||||
|
||||
static int fqdn_id_set_cmsg(struct ctrl_pkt_parser *handler, mpack_node_t node, int table_index)
|
||||
{
|
||||
char empty_str[4] = {0};
|
||||
uint32_t fqdn_val[8] = {0};
|
||||
|
||||
uint32_t array_cnt = mpack_node_array_length(node);
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_NUM, (const unsigned char *)&array_cnt, sizeof(uint32_t));
|
||||
for (uint32_t i = 0; i < array_cnt; i++) {
|
||||
fqdn_val[i] = mpack_node_u32(mpack_node_array_at(node, i));
|
||||
if (array_cnt > 0) {
|
||||
for (uint32_t i = 0; i < array_cnt; i++) {
|
||||
fqdn_val[i] = mpack_node_u32(mpack_node_array_at(node, i));
|
||||
}
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char*)fqdn_val, array_cnt * sizeof(uint32_t));
|
||||
}
|
||||
else {
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char *)empty_str, 0);
|
||||
}
|
||||
tfe_cmsg_set(handler->cmsg, TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char*)fqdn_val, array_cnt * sizeof(uint32_t));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -124,6 +130,7 @@ static int proxy_parse_messagepack(mpack_node_t node, void *ctx, void *logger)
|
||||
{
|
||||
int ret = 0;
|
||||
uint64_t value = 0;
|
||||
char empty_str[4] = {0};
|
||||
char cmsg_str[256] = {0};
|
||||
struct ctrl_pkt_parser *handler = (struct ctrl_pkt_parser *)ctx;
|
||||
|
||||
@@ -152,10 +159,11 @@ static int proxy_parse_messagepack(mpack_node_t node, void *ctx, void *logger)
|
||||
tfe_cmsg_set(handler->cmsg, mpack_table[i].type, (const unsigned char *)&value, mpack_table[i].size);
|
||||
break;
|
||||
case mpack_type_str:
|
||||
snprintf(cmsg_str, sizeof(cmsg_str), mpack_node_str(ptr), mpack_node_strlen(ptr));
|
||||
mpack_node_copy_cstr(ptr, cmsg_str, sizeof(cmsg_str));
|
||||
tfe_cmsg_set(handler->cmsg, mpack_table[i].type, (const unsigned char *)cmsg_str, mpack_node_strlen(ptr));
|
||||
break;
|
||||
case mpack_type_nil:
|
||||
tfe_cmsg_set(handler->cmsg, mpack_table[i].type, (const unsigned char *)empty_str, 0);
|
||||
break;
|
||||
case mpack_type_array:
|
||||
switch(mpack_table[i].array_index)
|
||||
|
||||
Reference in New Issue
Block a user