TSG-15381 TFE适配MAAT4的maat_plugin_table_get_ex_data()接口变更

This commit is contained in:
luwenpeng
2023-06-06 10:39:01 +08:00
parent 396f8426f9
commit db5530aa56
9 changed files with 13 additions and 13 deletions

View File

@@ -266,7 +266,7 @@ int intercept_policy_enforce(struct intercept_policy_enforcer *enforcer, struct
} }
snprintf(buff, sizeof(buff), "%lu", rule_id); snprintf(buff, sizeof(buff), "%lu", rule_id);
param = (struct intercept_param *)maat_plugin_table_get_ex_data(enforcer->maat, enforcer->table_id, buff); param = (struct intercept_param *)maat_plugin_table_get_ex_data(enforcer->maat, enforcer->table_id, buff, strlen(buff));
if (param == NULL) if (param == NULL)
{ {
TFE_LOG_INFO(enforcer->logger, "Failed to get intercept parameter of policy %lu.", rule_id); TFE_LOG_INFO(enforcer->logger, "Failed to get intercept parameter of policy %lu.", rule_id);

View File

@@ -122,7 +122,7 @@ enum ssl_ja3_pinning_status ssl_svc_ja3_scan(char *ja3_hash, const char *addr_st
enum ssl_ja3_pinning_status ret = JA3_PINNING_STATUS_UNKNOWN; enum ssl_ja3_pinning_status ret = JA3_PINNING_STATUS_UNKNOWN;
struct ssl_svc_ja3 *param = NULL; struct ssl_svc_ja3 *param = NULL;
param = (struct ssl_svc_ja3 *)maat_plugin_table_get_ex_data(g_static_enforcer.maat, g_static_enforcer.table_id, ja3_hash); param = (struct ssl_svc_ja3 *)maat_plugin_table_get_ex_data(g_static_enforcer.maat, g_static_enforcer.table_id, ja3_hash, strlen(ja3_hash));
if (param == NULL) if (param == NULL)
{ {
ret = JA3_PINNING_STATUS_UNKNOWN; ret = JA3_PINNING_STATUS_UNKNOWN;

View File

@@ -193,7 +193,7 @@ void chaining_policy_enforce(struct chaining_policy_enforcer *enforcer, struct t
} }
snprintf(rule_id_str, sizeof(rule_id_str), "%lu", rule_id); snprintf(rule_id_str, sizeof(rule_id_str), "%lu", rule_id);
struct chaining_param *param = (struct chaining_param *)maat_plugin_table_get_ex_data(enforcer->maat, enforcer->table_id, rule_id_str); struct chaining_param *param = (struct chaining_param *)maat_plugin_table_get_ex_data(enforcer->maat, enforcer->table_id, rule_id_str, strlen(rule_id_str));
if (param == NULL) if (param == NULL)
{ {
TFE_LOG_INFO(enforcer->logger, "Failed to get chaining parameter of policy %lu.", rule_id); TFE_LOG_INFO(enforcer->logger, "Failed to get chaining parameter of policy %lu.", rule_id);

View File

@@ -157,7 +157,7 @@ static void doh_get_cheat_data(long long p_result, int qtype, struct doh_ctx *ct
{ {
return; return;
} }
struct doh_action_param *get_ex_param=(struct doh_action_param *)maat_plugin_table_get_ex_data(g_doh_conf->maat, table_id, (const char *)&p_result); struct doh_action_param *get_ex_param=(struct doh_action_param *)maat_plugin_table_get_ex_data(g_doh_conf->maat, table_id, (const char *)&p_result, sizeof(p_result));
if(get_ex_param==NULL) if(get_ex_param==NULL)
{ {
return; return;

View File

@@ -205,7 +205,7 @@ enum ssl_stream_action ssl_policy_enforce(struct ssl_stream *upstream, void* u_p
TFE_LOG_DEBUG(enforcer->logger, "%s %s enforce policy %lu", addr_string, sni, policy_id); TFE_LOG_DEBUG(enforcer->logger, "%s %s enforce policy %lu", addr_string, sni, policy_id);
snprintf(profile_id_str, sizeof(profile_id_str), "%u", decryption_profile_id); snprintf(profile_id_str, sizeof(profile_id_str), "%u", decryption_profile_id);
struct decryption_param *profile_param=(struct decryption_param *)maat_plugin_table_get_ex_data(enforcer->maat, enforcer->profile_table_id, profile_id_str); struct decryption_param *profile_param=(struct decryption_param *)maat_plugin_table_get_ex_data(enforcer->maat, enforcer->profile_table_id, profile_id_str, strlen(profile_id_str));
if (profile_param==NULL) if (profile_param==NULL)
{ {
TFE_LOG_INFO(enforcer->logger, "Failed to get decryption parameter of profile %s.", profile_id_str); TFE_LOG_INFO(enforcer->logger, "Failed to get decryption parameter of profile %s.", profile_id_str);

View File

@@ -247,7 +247,7 @@ int tcp_policy_enforce(struct tcp_policy_enforcer *tcp_enforcer, struct tfe_cmsg
} }
snprintf(buffer, sizeof(buffer), "%d", profile_id); snprintf(buffer, sizeof(buffer), "%d", profile_id);
struct tcp_profile_param *param = (struct tcp_profile_param *)maat_plugin_table_get_ex_data(tcp_enforcer->maat, tcp_enforcer->table_id, buffer); struct tcp_profile_param *param = (struct tcp_profile_param *)maat_plugin_table_get_ex_data(tcp_enforcer->maat, tcp_enforcer->table_id, buffer, strlen(buffer));
if (param == NULL) if (param == NULL)
{ {
TFE_LOG_INFO(tcp_enforcer->logger, "Failed to get tcp option parameter of profile %d.", profile_id); TFE_LOG_INFO(tcp_enforcer->logger, "Failed to get tcp option parameter of profile %d.", profile_id);

View File

@@ -547,7 +547,7 @@ int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thr
} }
snprintf(str_policy_id, sizeof(str_policy_id), "%lu", rule_id); snprintf(str_policy_id, sizeof(str_policy_id), "%lu", rule_id);
policy_ex_data = (struct policy_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, instance->policy_table_id, str_policy_id); policy_ex_data = (struct policy_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, instance->policy_table_id, str_policy_id, strlen(str_policy_id));
if (!policy_ex_data || !policy_ex_data->enable) if (!policy_ex_data || !policy_ex_data->enable)
{ {
goto detach; goto detach;
@@ -574,7 +574,7 @@ int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thr
if (policy_ex_data->is_profile_set) if (policy_ex_data->is_profile_set)
{ {
snprintf(str_profile_id, sizeof(str_policy_id), "%u", policy_ex_data->profile_id); snprintf(str_profile_id, sizeof(str_policy_id), "%u", policy_ex_data->profile_id);
profile_ex_data = (struct profile_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, instance->profile_table_id, str_profile_id); profile_ex_data = (struct profile_table_ex_data *)maat_plugin_table_get_ex_data(instance->maat_feather, instance->profile_table_id, str_profile_id, strlen(str_profile_id));
if (!profile_ex_data) if (!profile_ex_data)
{ {
TFE_LOG_ERROR(instance->logger, "failed at getting policy %s's profile, profile id = %s, " TFE_LOG_ERROR(instance->logger, "failed at getting policy %s's profile, profile id = %s, "

View File

@@ -1471,7 +1471,7 @@ static struct manipulate_profile* get_profile_by_id(int profile_table, int profi
snprintf(cfg_id_str, sizeof(cfg_id_str), "%d", profile_id); snprintf(cfg_id_str, sizeof(cfg_id_str), "%d", profile_id);
int table_id = g_proxy_rt->plolicy_table_id[profile_table]; int table_id = g_proxy_rt->plolicy_table_id[profile_table];
result = (struct manipulate_profile*)maat_plugin_table_get_ex_data(g_proxy_rt->feather, table_id, (const char*)cfg_id_str); result = (struct manipulate_profile*)maat_plugin_table_get_ex_data(g_proxy_rt->feather, table_id, (const char*)cfg_id_str, strlen(cfg_id_str));
return result; return result;
} }
@@ -1513,7 +1513,7 @@ static enum proxy_action decide_ctrl_action(long long *results, size_t n_hit,
hit_rules=ALLOC(struct maat_rule_t, n_hit); hit_rules=ALLOC(struct maat_rule_t, n_hit);
for (i = 0; i < n_hit && i<MAX_SCAN_RESULT; i++) for (i = 0; i < n_hit && i<MAX_SCAN_RESULT; i++)
{ {
get_ex_param =(struct policy_action_param *)maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_compile_idx, (const char *)&results[i]); get_ex_param =(struct policy_action_param *)maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_compile_idx, (const char *)&results[i], sizeof(results[i]));
if(get_ex_param==NULL) if(get_ex_param==NULL)
{ {
continue; continue;
@@ -1562,7 +1562,7 @@ static enum proxy_action decide_ctrl_action(long long *results, size_t n_hit,
} }
*enforce_rules[0]=*prior_rule; *enforce_rules[0]=*prior_rule;
*n_enforce=1; *n_enforce=1;
ex_data=maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_compile_idx, (const char *)&prior_rule->config_id); ex_data=maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_compile_idx, (const char *)&prior_rule->config_id, sizeof(prior_rule->config_id));
if(ex_data!=NULL) if(ex_data!=NULL)
{ {
*param=(struct policy_action_param*)ex_data; *param=(struct policy_action_param*)ex_data;
@@ -1596,7 +1596,7 @@ static enum proxy_action decide_ctrl_action(long long *results, size_t n_hit,
memcpy(*enforce_rules + exist_enforce_num + 1, monit_rule, n_monit * sizeof(struct maat_rule_t)); memcpy(*enforce_rules + exist_enforce_num + 1, monit_rule, n_monit * sizeof(struct maat_rule_t));
} }
ex_data=maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_compile_idx, (const char *)&prior_rule->config_id); ex_data=maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_compile_idx, (const char *)&prior_rule->config_id, sizeof(prior_rule->config_id));
if(ex_data!=NULL) if(ex_data!=NULL)
{ {
*param=(struct policy_action_param*)ex_data; *param=(struct policy_action_param*)ex_data;

View File

@@ -1088,7 +1088,7 @@ enum cache_pending_result web_cache_async_pending(struct cache_handle* handle, u
if(ret==MAAT_SCAN_HIT) if(ret==MAAT_SCAN_HIT)
{ {
ex_data=maat_plugin_table_get_ex_data(handle->ref_feather, handle->cache_param_idx, (const char *)&cache_policy); ex_data=maat_plugin_table_get_ex_data(handle->ref_feather, handle->cache_param_idx, (const char *)&cache_policy, sizeof(cache_policy));
if(ex_data!=NULL) if(ex_data!=NULL)
{ {
param=(struct cache_param*)ex_data; param=(struct cache_param*)ex_data;