TSG-9422 TSG-9554 TSG-9470 修复元素编辑MARK问题, 代理支持4级或以上定位库
This commit is contained in:
@@ -134,6 +134,8 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, struct Maat_rule_t *re
|
||||
char dst_provine[TFE_STRING_MAX] = {0};
|
||||
char src_country[TFE_STRING_MAX] = {0};
|
||||
char dst_country[TFE_STRING_MAX] = {0};
|
||||
char src_subdivsion[TFE_STRING_MAX] = {0};
|
||||
char dst_subdivsion[TFE_STRING_MAX] = {0};
|
||||
struct tfe_cmsg *cmsg = tfe_stream_get0_cmsg(stream);
|
||||
if (cmsg != NULL)
|
||||
{
|
||||
@@ -166,14 +168,32 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, struct Maat_rule_t *re
|
||||
if (scan_ret != 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "fetch dst city from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
||||
}
|
||||
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_IP_LOCATION_SUBDIVISION, (unsigned char *)src_subdivsion, sizeof(src_subdivsion), &opt_out_size);
|
||||
if (scan_ret != 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "fetch src subdivsion from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
||||
}
|
||||
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_DST_IP_LOCATION_SUBDIVISION, (unsigned char *)dst_subdivsion, sizeof(dst_subdivsion), &opt_out_size);
|
||||
if (scan_ret != 0)
|
||||
{
|
||||
TFE_LOG_ERROR(logger, "fetch dst subdivsion from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
||||
}
|
||||
}
|
||||
TFE_LOG_DEBUG(logger, "fetch src country:%s provine:%s city:%s; dst country:%s provine:%s city:%s addr: %s", src_country, src_provine, src_city, dst_country, dst_provine, dst_city, stream->str_stream_info);
|
||||
TFE_LOG_DEBUG(logger, "fetch src country:%s provine:%s city:%s; subdivsion:%s, dst country:%s provine:%s city:%s subdivsion:%s addr: %s", src_country, src_provine, src_city, src_subdivsion, dst_country, dst_provine, dst_city, dst_subdivsion, stream->str_stream_info);
|
||||
|
||||
if (strlen(dst_country) || strlen(dst_city))
|
||||
{
|
||||
memset(buff, 0, sizeof(buff));
|
||||
snprintf(buff, sizeof(buff), "%s.%s.", dst_country, dst_city);
|
||||
|
||||
if(strlen(dst_subdivsion))
|
||||
{
|
||||
snprintf(buff, sizeof(buff),"%s.%s.%s.%s.", dst_country, dst_provine, dst_city, dst_subdivsion);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s.%s.", dst_country, dst_city);
|
||||
}
|
||||
scan_ret = Maat_full_scan_string(tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(TABLE_SECURITY_DESTINATION_LOCATION),
|
||||
CHARSET_GBK, buff, strlen(buff),
|
||||
result + hit_cnt + hit_cnt_ip, NULL, MAX_SCAN_RESULT - hit_cnt - hit_cnt_ip,
|
||||
@@ -190,13 +210,27 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, struct Maat_rule_t *re
|
||||
buff, scan_ret, stream->str_stream_info);
|
||||
}
|
||||
memset(buff, 0, sizeof(buff));
|
||||
snprintf(buff, sizeof(buff), "%s,%s,%s", dst_city, dst_provine, dst_country);
|
||||
if(strlen(dst_subdivsion))
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s,%s,%s,%s", dst_country, dst_provine, dst_city, dst_subdivsion);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s,%s,%s", dst_country, dst_provine, dst_city);
|
||||
}
|
||||
*location_server = tfe_strdup(buff);
|
||||
}
|
||||
if (strlen(src_country) || strlen(src_city))
|
||||
{
|
||||
memset(buff, 0, sizeof(buff));
|
||||
snprintf(buff, sizeof(buff), "%s.%s.", src_country, src_city);
|
||||
if(strlen(src_subdivsion))
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s.%s.%s.%s.", src_country, src_provine, src_city, src_subdivsion);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s.%s.", src_country, src_city);
|
||||
}
|
||||
scan_ret = Maat_full_scan_string(tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(TABLE_SECURITY_SOURCE_LOCATION),
|
||||
CHARSET_GBK, buff, strlen(buff),
|
||||
result + hit_cnt + hit_cnt_ip, NULL, MAX_SCAN_RESULT - hit_cnt - hit_cnt_ip,
|
||||
@@ -214,7 +248,14 @@ int tfe_scan_ip_location(const struct tfe_stream *stream, struct Maat_rule_t *re
|
||||
}
|
||||
|
||||
memset(buff, 0, sizeof(buff));
|
||||
snprintf(buff, sizeof(buff), "%s,%s,%s", src_city, src_provine, src_country);
|
||||
if(strlen(src_subdivsion))
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s,%s,%s,%s", src_country, src_provine, src_city, src_subdivsion);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(buff, sizeof(buff), "%s,%s,%s", src_country, src_provine, src_city);
|
||||
}
|
||||
*location_client = tfe_strdup(buff);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user