bugfix: 修复了通过cmsg获取IP归属地的问题
This commit is contained in:
@@ -104,8 +104,9 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, long long *result, str
|
||||
int scan_ret = 0;
|
||||
int hit_cnt_ip = 0;
|
||||
uint16_t opt_out_size;
|
||||
unsigned int i=0, group_id=0, group_id_num=0;
|
||||
unsigned int group_id_val[TFE_SYMBOL_MAX] = {0};
|
||||
unsigned int i=0, group_id_num=0;
|
||||
uint64_t group_id=0;
|
||||
uint64_t group_id_val[TFE_SYMBOL_MAX] = {0};
|
||||
|
||||
struct tfe_cmsg *cmsg = tfe_stream_get0_cmsg(stream);
|
||||
if(cmsg == NULL)
|
||||
@@ -122,8 +123,7 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, long long *result, str
|
||||
}
|
||||
group_id_num++;
|
||||
}
|
||||
TFE_LOG_DEBUG(logger, "fetch src ip location group id num:%d val:%d,%d,%d,%d, addr: %s", group_id_num, group_id_val[0], group_id_val[1], group_id_val[2],group_id_val[3], stream->str_stream_info);
|
||||
|
||||
TFE_LOG_DEBUG(logger, "fetch src ip location region_id:%lu, province_id:%lu, city_id:%lu, subdivision_id:%lu, addr: %s", group_id_val[0], group_id_val[1], group_id_val[2],group_id_val[3], stream->str_stream_info);
|
||||
struct maat_hit_group hit_group;
|
||||
for (i = 0; i < group_id_num; i++)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, long long *result, str
|
||||
}
|
||||
group_id_num++;
|
||||
}
|
||||
TFE_LOG_DEBUG(logger, "fetch dst ip location group id num:%d val:%d,%d,%d,%d, addr: %s", group_id_num, group_id_val[0], group_id_val[1], group_id_val[2],group_id_val[3], stream->str_stream_info);
|
||||
TFE_LOG_DEBUG(logger, "fetch dst ip location region_id:%lu, province_id:%lu, city_id:%lu, subdivision_id:%lu, addr: %s", group_id_val[0], group_id_val[1], group_id_val[2],group_id_val[3], stream->str_stream_info);
|
||||
for (i = 0; i < group_id_num; i++)
|
||||
{
|
||||
memset(&hit_group, 0, sizeof(hit_group));
|
||||
@@ -171,8 +171,7 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, long long *result, str
|
||||
return hit_cnt_ip;
|
||||
}
|
||||
|
||||
int tfe_scan_ip_asn(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid,
|
||||
int hit_cnt, void *logger, char **asn_server, char **asn_client)
|
||||
int tfe_scan_ip_asn(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid, int hit_cnt, void *logger)
|
||||
{
|
||||
int scan_ret = 0;
|
||||
int hit_cnt_ip = 0;
|
||||
@@ -416,7 +415,7 @@ int tfe_scan_ipv4_addr(const struct tfe_stream *stream, long long *result, struc
|
||||
{
|
||||
hit_cnt_ip += n_hit_result;
|
||||
}
|
||||
|
||||
|
||||
scan_ret = maat_scan_ipv4_port((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_IP), sapp_addr.v4->saddr, ntohs(sapp_addr.v4->source),
|
||||
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
||||
if (scan_ret == MAAT_SCAN_HIT)
|
||||
@@ -471,9 +470,14 @@ int tfe_scan_ipv6_addr(const struct tfe_stream *stream, long long *result, struc
|
||||
{
|
||||
hit_cnt_ip += n_hit_result;
|
||||
}
|
||||
|
||||
scan_ret = maat_scan_ipv6((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_IP), sapp_addr.v6->saddr,
|
||||
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
||||
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_IP_PROTOCOL),
|
||||
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
||||
if (scan_ret == MAAT_SCAN_HIT)
|
||||
{
|
||||
hit_cnt_ip += n_hit_result;
|
||||
}
|
||||
scan_ret = maat_scan_ipv6_port((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_IP), sapp_addr.v6->saddr, ntohs(sapp_addr.v6->source),
|
||||
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
||||
if (scan_ret == MAAT_SCAN_HIT)
|
||||
{
|
||||
hit_cnt_ip += n_hit_result;
|
||||
|
||||
Reference in New Issue
Block a user