TSG-17512 Proxy适配Maat4关于compile表特性变更

This commit is contained in:
fengweihao
2023-11-22 19:30:27 +08:00
committed by 冯伟浩
parent 15582f5d51
commit 6efee0fdc8
4 changed files with 110 additions and 70 deletions

View File

@@ -174,7 +174,7 @@ struct tsg_proxy_rt
Ratelimiter_handle_t ratelimiter;
int enable_rate;
int ctrl_compile_idx;
int ctrl_plugin_idx;
int ca_store_reseting;
int enable_plugin;
};
@@ -1037,8 +1037,8 @@ int proxy_policy_init(const char* profile_path, const char* static_section, cons
}
}
g_proxy_rt->ctrl_compile_idx=maat_get_table_id(g_proxy_rt->feather, "PXY_CTRL_COMPILE");
maat_plugin_table_ex_schema_register(g_proxy_rt->feather, "PXY_CTRL_COMPILE",
g_proxy_rt->ctrl_plugin_idx=maat_get_table_id(g_proxy_rt->feather, "PXY_CTRL_COMPILE_PLUGIN");
maat_plugin_table_ex_schema_register(g_proxy_rt->feather, "PXY_CTRL_COMPILE_PLUGIN",
policy_action_param_new,
policy_action_param_free_cb,
policy_action_param_dup,
@@ -1499,7 +1499,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], sizeof(results[i]));
get_ex_param =(struct policy_action_param *)maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_plugin_idx, (const char *)&results[i], sizeof(results[i]));
if(get_ex_param==NULL)
{
continue;
@@ -1548,7 +1548,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, sizeof(prior_rule->config_id));
ex_data=maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_plugin_idx, (const char *)&prior_rule->config_id, sizeof(prior_rule->config_id));
if(ex_data!=NULL)
{
*param=(struct policy_action_param*)ex_data;
@@ -1582,7 +1582,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, sizeof(prior_rule->config_id));
ex_data=maat_plugin_table_get_ex_data(g_proxy_rt->feather, g_proxy_rt->ctrl_plugin_idx, (const char *)&prior_rule->config_id, sizeof(prior_rule->config_id));
if(ex_data!=NULL)
{
*param=(struct policy_action_param*)ex_data;