TFE pangu 增加 enable_plugin 配置,可以选择是否启用插件

This commit is contained in:
luwenpeng
2020-07-28 18:54:00 +08:00
parent f1b2d63816
commit 7e2f36d416
2 changed files with 22 additions and 1 deletions

View File

@@ -154,7 +154,7 @@ struct pangu_rt
int ctrl_compile_idx;
int ca_store_reseting;
int enable_plugin;
};
struct pangu_rt * g_pangu_rt;
@@ -919,6 +919,11 @@ int pangu_http_init(struct tfe_proxy * proxy)
int temp=0;
g_pangu_rt = ALLOC(struct pangu_rt, 1);
MESA_load_profile_int_def(profile_path, "DEBUG", "enable_plugin", &(g_pangu_rt->enable_plugin), 1);
if (!g_pangu_rt->enable_plugin)
{
return 0;
}
g_pangu_rt->thread_num = tfe_proxy_get_work_thread_count();
g_pangu_rt->gc_evbase=tfe_proxy_get_gc_evbase();
@@ -2548,6 +2553,11 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct
void pangu_on_http_begin(const struct tfe_stream * stream,
const struct tfe_http_session * session, unsigned int thread_id, void ** pme)
{
if (!g_pangu_rt->enable_plugin)
{
return;
}
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
struct Maat_rule_t result[MAX_SCAN_RESULT];
struct ipaddr sapp_addr;
@@ -2662,6 +2672,11 @@ static inline int ctx_actually_manipulate(struct pangu_http_ctx * ctx)
void pangu_on_http_end(const struct tfe_stream * stream,
const struct tfe_http_session * session, unsigned int thread_id, void ** pme)
{
if (!g_pangu_rt->enable_plugin)
{
return;
}
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
size_t i=0, j=0;
int ret=0;
@@ -2723,6 +2738,11 @@ void pangu_on_http_end(const struct tfe_stream * stream,
int pangu_on_http_data(const struct tfe_stream * stream, const struct tfe_http_session * session,
enum tfe_http_event events, const unsigned char * body_frag, size_t frag_size, unsigned int thread_id, void ** pme)
{
if (!g_pangu_rt->enable_plugin)
{
return CALL_NEXT_PLUGIN;
}
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
int ret=0;
if(ctx->resumed_cb)