TSG-16056 修复deny动作,修复tsg_lua多线程调用问题和tfe编译告警
This commit is contained in:
@@ -683,7 +683,6 @@ void policy_action_param_new(const char *table_name, int table_id, const char* k
|
||||
}
|
||||
*ad=param;
|
||||
TFE_LOG_INFO(g_proxy_rt->local_logger, "Add ctrl policy: %lld", config_id);
|
||||
error_out:
|
||||
cJSON_Delete(json);
|
||||
return;
|
||||
}
|
||||
@@ -890,15 +889,8 @@ void ma_lua_profile_table_new_cb(const char *table_name, int table_id, const cha
|
||||
return;
|
||||
}
|
||||
|
||||
int i=0, thread_num = g_proxy_rt->thread_num;
|
||||
struct tsg_lua_script *lua_script = &(g_proxy_rt->lua_script);
|
||||
|
||||
int thread_num = g_proxy_rt->thread_num;
|
||||
ply_profile->escript_ctx = ALLOC(struct elua_script *, thread_num);
|
||||
for(i=0; i<thread_num; i++)
|
||||
{
|
||||
ply_profile->escript_ctx[i]=http_lua_map_cache_script(lua_script->http_lua_handle[i], ply_profile->profile_msg, ply_profile->msg_len, timeout);
|
||||
}
|
||||
|
||||
TFE_LOG_INFO(g_proxy_rt->local_logger, "Policy table add success %d", profile_id);
|
||||
|
||||
*ad = ply_profile;
|
||||
@@ -933,7 +925,12 @@ void ma_profile_table_free_cb(int table_id, void **ad, long argl, void *argp)
|
||||
int i=0;
|
||||
for(i=0; i<g_proxy_rt->thread_num; i++)
|
||||
{
|
||||
elua_cleanup_script(ply_obj->escript_ctx[i]);
|
||||
if(ply_obj->escript_ctx[i])
|
||||
{
|
||||
elua_cleanup_script(ply_obj->escript_ctx[i]);
|
||||
FREE(&ply_obj->escript_ctx[i]);
|
||||
ply_obj->escript_ctx[i]=NULL;
|
||||
}
|
||||
}
|
||||
free(ply_obj->escript_ctx);
|
||||
ply_obj->escript_ctx=NULL;
|
||||
@@ -1686,7 +1683,7 @@ static int http_enforcement_ratio(float enforcement_ratio)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int http_lua_profile(int profile_id, struct elua_script ***elua_ctx)
|
||||
int http_lua_profile(int profile_id, struct elua_script ***elua_ctx, char **profile_msg, size_t *msg_len, int *timeout)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
@@ -1698,6 +1695,9 @@ int http_lua_profile(int profile_id, struct elua_script ***elua_ctx)
|
||||
}
|
||||
|
||||
*elua_ctx=lua_profile->escript_ctx;
|
||||
*profile_msg=tfe_strdup(lua_profile->profile_msg);
|
||||
*msg_len=lua_profile->msg_len;
|
||||
*timeout=lua_profile->timeout;
|
||||
ma_profile_table_free(lua_profile);
|
||||
lua_profile = NULL;
|
||||
return ret;
|
||||
@@ -2178,7 +2178,7 @@ static void http_block(const struct tfe_stream * stream, const struct tfe_http_s
|
||||
int profile_id = param->profile_id;
|
||||
char *message = param->message;
|
||||
|
||||
if (resp_code <= 0 || profile_id < 0){
|
||||
if (profile_id < 0){
|
||||
TFE_LOG_ERROR(g_proxy_rt->local_logger, "Invalid block rule %lld", ctx->enforce_rules[0].config_id);
|
||||
ctx->action = PX_ACTION_NONE;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user