summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2020-06-29 14:54:11 +0800
committerfengweihao <[email protected]>2020-06-29 14:54:11 +0800
commitbbbea82e1e5ae9820a354727068c4fd476549209 (patch)
treef8863f9734aa2b7a4de403bf918235cda90065d7 /plugin
parent6d512ab448eda491c5f367d2030c75311b67569b (diff)
配置文件增加Maat中htable表大小配置
修复ip归属地命中计数问题
Diffstat (limited to 'plugin')
-rw-r--r--plugin/business/pangu-http/src/pangu_http.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp
index 7a9d567..b2aada9 100644
--- a/plugin/business/pangu-http/src/pangu_http.cpp
+++ b/plugin/business/pangu-http/src/pangu_http.cpp
@@ -2736,7 +2736,7 @@ void cache_write(const struct tfe_http_session * session, enum tfe_http_event ev
int http_ip_subscribe_id_scan(struct Maat_rule_t *result, const char* sip, const char* dip, int hit_cnt, unsigned int thread_id, struct pangu_http_ctx * ctx)
{
- int scan_ret=0;
+ int scan_ret=0, hit_cnt_ip=0;
char* source_subscribe_id=NULL, *dest_subscribe_id=NULL;
source_subscribe_id=(char*)Maat_plugin_get_EX_data(g_pangu_rt->dyn_maat, g_pangu_rt->subscriber_id_table_id, sip);
@@ -2750,7 +2750,7 @@ int http_ip_subscribe_id_scan(struct Maat_rule_t *result, const char* sip, const
&(ctx->scan_mid), (int) thread_id);
if(scan_ret>0)
{
- hit_cnt+=scan_ret;
+ hit_cnt_ip+=scan_ret;
}
}
if(dest_subscribe_id!=NULL)
@@ -2761,19 +2761,19 @@ int http_ip_subscribe_id_scan(struct Maat_rule_t *result, const char* sip, const
&(ctx->scan_mid), (int) thread_id);
if(scan_ret>0)
{
- hit_cnt+=scan_ret;
+ hit_cnt_ip+=scan_ret;
}
}
if(source_subscribe_id!=NULL)
free(source_subscribe_id);
if(dest_subscribe_id!=NULL)
free(dest_subscribe_id);
- return hit_cnt;
+ return hit_cnt_ip;
}
int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, struct ip_address *dip, int hit_cnt, unsigned int thread_id, struct pangu_http_ctx * ctx )
{
- int scan_ret=0;
+ int scan_ret=0, hit_cnt_ip=0;
char buff[TFE_STRING_MAX]={0};
struct ip_data_table* ip_location_client=NULL, *ip_location_server=NULL;
@@ -2798,7 +2798,7 @@ int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, st
&(ctx->scan_mid), (int) thread_id);
if(scan_ret>0)
{
- hit_cnt+=scan_ret;
+ hit_cnt_ip+=scan_ret;
}
memset(buff,0,sizeof(buff));
snprintf(buff, sizeof(buff), "%s,%s,%s", ip_location_server->city_full, ip_location_server->province_full, ip_location_server->country_full);
@@ -2813,7 +2813,7 @@ int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, st
&(ctx->scan_mid), (int) thread_id);
if(scan_ret>0)
{
- hit_cnt+=scan_ret;
+ hit_cnt_ip+=scan_ret;
}
memset(buff,0,sizeof(buff));
snprintf(buff, sizeof(buff), "%s,%s,%s", ip_location_client->city_full, ip_location_client->province_full, ip_location_client->country_full);
@@ -2824,12 +2824,12 @@ int http_ip_location_scan(struct Maat_rule_t *result, struct ip_address *sip, st
ip_table_free(ip_location_server);
if(ip_location_client)
ip_table_free(ip_location_client);
- return hit_cnt;
+ return hit_cnt_ip;
}
int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct ip_address* dip, int hit_cnt, unsigned int thread_id, struct pangu_http_ctx * ctx)
{
- int scan_ret=0;
+ int scan_ret=0, hit_cnt_ip=0;
char buff[TFE_STRING_MAX]={0};
struct ip_data_table* ip_asn_client=NULL, *ip_asn_server=NULL;
@@ -2854,7 +2854,7 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct
if(scan_ret>0)
{
- hit_cnt+=scan_ret;
+ hit_cnt_ip+=scan_ret;
}
snprintf(buff, sizeof(buff), "%s(%s)", ip_asn_server->asn, ip_asn_server->organization);
ctx->ip_ctx.asn_server=tfe_strdup(buff);
@@ -2867,7 +2867,7 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct
&(ctx->scan_mid), (int) thread_id);
if(scan_ret>0)
{
- hit_cnt+=scan_ret;
+ hit_cnt_ip+=scan_ret;
}
snprintf(buff, sizeof(buff), "%s(%s)", ip_asn_client->asn, ip_asn_client->organization);
ctx->ip_ctx.asn_client=tfe_strdup(buff);
@@ -2876,7 +2876,7 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct
ip_table_free(ip_asn_server);
if(ip_asn_client)
ip_table_free(ip_asn_client);
- return hit_cnt;
+ return hit_cnt_ip;
}
int tfe_stream_addr_to_address(const struct tfe_stream_addr *addr, struct ip_address *dest_ip, struct ip_address *source_ip)