summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorluwenpeng <[email protected]>2023-06-06 10:39:01 +0800
committerluwenpeng <[email protected]>2023-06-08 16:44:34 +0800
commitdb5530aa568d66eec2caf18eed067e1ccceb197d (patch)
tree67b7b9140b7146b5f8eeada4cf344cef33bf90d5 /plugin
parent396f8426f9ddf83c7d5f483fef20ab7a92bd7fac (diff)
TSG-15381 TFE适配MAAT4的maat_plugin_table_get_ex_data()接口变更
Diffstat (limited to 'plugin')
-rw-r--r--plugin/business/chaining-policy/src/chaining_policy.cpp2
-rw-r--r--plugin/business/doh/src/doh.cpp2
-rw-r--r--plugin/business/ssl-policy/src/ssl_policy.cpp2
-rw-r--r--plugin/business/tcp-policy/src/tcp_policy.cpp2
-rw-r--r--plugin/business/traffic-mirror/src/entry.cpp4
-rw-r--r--plugin/business/tsg-http/src/tsg_http.cpp8
-rw-r--r--plugin/business/tsg-http/src/tsg_web_cache.cpp2
7 files changed, 11 insertions, 11 deletions
diff --git a/plugin/business/chaining-policy/src/chaining_policy.cpp b/plugin/business/chaining-policy/src/chaining_policy.cpp
index 1c73e1c..9d9cf02 100644
--- a/plugin/business/chaining-policy/src/chaining_policy.cpp
+++ b/plugin/business/chaining-policy/src/chaining_policy.cpp
@@ -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);
- 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)
{
TFE_LOG_INFO(enforcer->logger, "Failed to get chaining parameter of policy %lu.", rule_id);
diff --git a/plugin/business/doh/src/doh.cpp b/plugin/business/doh/src/doh.cpp
index 53f9902..bba3aab 100644
--- a/plugin/business/doh/src/doh.cpp
+++ b/plugin/business/doh/src/doh.cpp
@@ -157,7 +157,7 @@ static void doh_get_cheat_data(long long p_result, int qtype, struct doh_ctx *ct
{
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)
{
return;
diff --git a/plugin/business/ssl-policy/src/ssl_policy.cpp b/plugin/business/ssl-policy/src/ssl_policy.cpp
index 6cb0866..625ba48 100644
--- a/plugin/business/ssl-policy/src/ssl_policy.cpp
+++ b/plugin/business/ssl-policy/src/ssl_policy.cpp
@@ -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);
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)
{
TFE_LOG_INFO(enforcer->logger, "Failed to get decryption parameter of profile %s.", profile_id_str);
diff --git a/plugin/business/tcp-policy/src/tcp_policy.cpp b/plugin/business/tcp-policy/src/tcp_policy.cpp
index 6c9cdef..a7d352d 100644
--- a/plugin/business/tcp-policy/src/tcp_policy.cpp
+++ b/plugin/business/tcp-policy/src/tcp_policy.cpp
@@ -247,7 +247,7 @@ int tcp_policy_enforce(struct tcp_policy_enforcer *tcp_enforcer, struct tfe_cmsg
}
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)
{
TFE_LOG_INFO(tcp_enforcer->logger, "Failed to get tcp option parameter of profile %d.", profile_id);
diff --git a/plugin/business/traffic-mirror/src/entry.cpp b/plugin/business/traffic-mirror/src/entry.cpp
index bbf4ee0..262a76e 100644
--- a/plugin/business/traffic-mirror/src/entry.cpp
+++ b/plugin/business/traffic-mirror/src/entry.cpp
@@ -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);
- 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)
{
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)
{
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)
{
TFE_LOG_ERROR(instance->logger, "failed at getting policy %s's profile, profile id = %s, "
diff --git a/plugin/business/tsg-http/src/tsg_http.cpp b/plugin/business/tsg-http/src/tsg_http.cpp
index 954ed23..b6a28e7 100644
--- a/plugin/business/tsg-http/src/tsg_http.cpp
+++ b/plugin/business/tsg-http/src/tsg_http.cpp
@@ -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);
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;
}
@@ -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);
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)
{
continue;
@@ -1562,7 +1562,7 @@ static enum proxy_action decide_ctrl_action(long long *results, size_t n_hit,
}
*enforce_rules[0]=*prior_rule;
*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)
{
*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));
}
- 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)
{
*param=(struct policy_action_param*)ex_data;
diff --git a/plugin/business/tsg-http/src/tsg_web_cache.cpp b/plugin/business/tsg-http/src/tsg_web_cache.cpp
index 5d23ba1..0011ad9 100644
--- a/plugin/business/tsg-http/src/tsg_web_cache.cpp
+++ b/plugin/business/tsg-http/src/tsg_web_cache.cpp
@@ -1088,7 +1088,7 @@ enum cache_pending_result web_cache_async_pending(struct cache_handle* handle, u
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)
{
param=(struct cache_param*)ex_data;