2023-03-30 19:39:18 +08:00
|
|
|
#include <MESA/maat.h>
|
2020-08-10 18:13:44 +08:00
|
|
|
#include <tfe_resource.h>
|
|
|
|
|
#include <tfe_scan.h>
|
2023-12-14 15:08:19 +08:00
|
|
|
#include <MESA/stream.h>
|
2020-08-10 18:13:44 +08:00
|
|
|
|
2023-03-30 19:39:18 +08:00
|
|
|
int tfe_scan_subscribe_id(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid,
|
|
|
|
|
int hit_cnt, void *logger)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
|
|
|
|
int scan_ret = 0;
|
|
|
|
|
int hit_cnt_ip = 0;
|
2023-03-30 19:39:18 +08:00
|
|
|
size_t n_hit_result = 0;
|
2020-08-10 18:13:44 +08:00
|
|
|
uint16_t opt_out_size;
|
|
|
|
|
char dest_subscribe_id[TFE_STRING_MAX] = {0};
|
|
|
|
|
char source_subscribe_id[TFE_STRING_MAX] = {0};
|
|
|
|
|
struct tfe_cmsg *cmsg = tfe_stream_get0_cmsg(stream);
|
|
|
|
|
if (cmsg != NULL)
|
|
|
|
|
{
|
|
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_SUB_ID, (unsigned char *)source_subscribe_id, sizeof(source_subscribe_id), &opt_out_size);
|
|
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch src sub id from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_DST_SUB_ID, (unsigned char *)dest_subscribe_id, sizeof(dest_subscribe_id), &opt_out_size);
|
|
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch dst sub id from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_DEBUG(logger, "fetch src sub id:%s dst sub id:%s addr: %s", source_subscribe_id, dest_subscribe_id, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
|
|
|
|
|
if (strlen(source_subscribe_id))
|
|
|
|
|
{
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_string((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SUBSCRIBER_ID),
|
2023-03-30 19:39:18 +08:00
|
|
|
source_subscribe_id, strlen(source_subscribe_id),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)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2023-03-30 19:39:18 +08:00
|
|
|
TFE_LOG_INFO(logger, "Scan src TSG_OBJ_SUBSCRIBER_ID, Hit subid: %s scan ret: %d policy_id: %lld addr: %s",
|
|
|
|
|
source_subscribe_id, scan_ret, result[hit_cnt + hit_cnt_ip], stream->str_stream_info);
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TFE_LOG_INFO(logger, "Scan src TSG_OBJ_SUBSCRIBER_ID, NO hit subid: %s scan ret: %d addr: %s",
|
2021-04-28 18:01:32 +08:00
|
|
|
source_subscribe_id, scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SUBSCRIBER_ID),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(dest_subscribe_id))
|
|
|
|
|
{
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_string((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SUBSCRIBER_ID),
|
2023-03-30 19:39:18 +08:00
|
|
|
dest_subscribe_id, strlen(dest_subscribe_id),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)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2023-03-30 19:39:18 +08:00
|
|
|
TFE_LOG_INFO(logger, "Scan dst TSG_OBJ_SUBSCRIBER_ID, Hit subid: %s scan ret: %d policy_id: %lld addr: %s",
|
|
|
|
|
dest_subscribe_id, scan_ret, result[hit_cnt + hit_cnt_ip], stream->str_stream_info);
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TFE_LOG_INFO(logger, "Scan dst TSG_OBJ_SUBSCRIBER_ID, NO hit subid: %s scan ret: %d addr: %s",
|
2021-04-28 18:01:32 +08:00
|
|
|
dest_subscribe_id, scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SUBSCRIBER_ID),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hit_cnt_ip;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-30 19:39:18 +08:00
|
|
|
int tfe_scan_ip_location(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid,
|
|
|
|
|
int hit_cnt, void *logger, char **location_server, char **location_client)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
|
|
|
|
int scan_ret = 0;
|
|
|
|
|
int hit_cnt_ip = 0;
|
2023-06-19 14:45:58 +08:00
|
|
|
size_t n_hit_result = 0;
|
2020-08-10 18:13:44 +08:00
|
|
|
uint16_t opt_out_size;
|
2023-06-19 14:45:58 +08:00
|
|
|
char src_ip_location[TFE_STRING_MAX * 5] = {0};
|
|
|
|
|
char dst_ip_location[TFE_STRING_MAX * 5] = {0};
|
|
|
|
|
|
2020-08-10 18:13:44 +08:00
|
|
|
struct tfe_cmsg *cmsg = tfe_stream_get0_cmsg(stream);
|
|
|
|
|
if (cmsg != NULL)
|
|
|
|
|
{
|
2023-06-19 14:45:58 +08:00
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_IP_LOCATION, (unsigned char *)src_ip_location, sizeof(src_ip_location), &opt_out_size);
|
2020-08-10 18:13:44 +08:00
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch src country from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2023-06-19 14:45:58 +08:00
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_DST_IP_LOCATION, (unsigned char *)dst_ip_location, sizeof(dst_ip_location), &opt_out_size);
|
2020-08-10 18:13:44 +08:00
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch dst country from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-06-19 14:45:58 +08:00
|
|
|
TFE_LOG_DEBUG(logger, "fetch src ip location: %s dst ip location: %s addr: %s", src_ip_location, dst_ip_location, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
|
2023-06-19 14:45:58 +08:00
|
|
|
if (strlen(dst_ip_location))
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_string((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_LOCATION),
|
2023-06-19 14:45:58 +08:00
|
|
|
dst_ip_location, strlen(dst_ip_location), result + hit_cnt + hit_cnt_ip, MAX_SCAN_RESULT - hit_cnt - hit_cnt_ip,
|
2023-03-30 19:39:18 +08:00
|
|
|
&n_hit_result, scan_mid);
|
|
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2023-03-30 19:39:18 +08:00
|
|
|
TFE_LOG_INFO(logger, "Scan TSG_SECURITY_DESTINATION_LOCATION, Hit location: %s scan ret: %d policy_id: %lld addr: %s",
|
2023-06-19 14:45:58 +08:00
|
|
|
dst_ip_location, scan_ret, result[hit_cnt + hit_cnt_ip], stream->str_stream_info);
|
2023-03-30 19:39:18 +08:00
|
|
|
hit_cnt_ip += n_hit_result;
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TFE_LOG_INFO(logger, "Scan TSG_SECURITY_DESTINATION_LOCATION, NO hit location: %s scan ret: %d addr: %s",
|
2023-06-19 14:45:58 +08:00
|
|
|
dst_ip_location, scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_LOCATION),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-19 14:45:58 +08:00
|
|
|
*location_server = (char *)ALLOC(char, strlen(dst_ip_location));
|
|
|
|
|
memcpy(*location_server,dst_ip_location,strlen(dst_ip_location)-1);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2023-06-19 14:45:58 +08:00
|
|
|
if (strlen(src_ip_location))
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_string((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_LOCATION),
|
2023-06-19 14:45:58 +08:00
|
|
|
src_ip_location, strlen(src_ip_location), result + hit_cnt + hit_cnt_ip, MAX_SCAN_RESULT - hit_cnt - hit_cnt_ip,
|
2023-03-30 19:39:18 +08:00
|
|
|
&n_hit_result, scan_mid);
|
|
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2023-03-30 19:39:18 +08:00
|
|
|
TFE_LOG_INFO(logger, "Scan TSG_SECURITY_SOURCE_LOCATION, Hit location: %s scan ret: %d policy_id: %lld addr: %s",
|
2023-06-19 14:45:58 +08:00
|
|
|
src_ip_location, scan_ret, result[hit_cnt + hit_cnt_ip], stream->str_stream_info);
|
2023-03-30 19:39:18 +08:00
|
|
|
hit_cnt_ip += n_hit_result;
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TFE_LOG_INFO(logger, "Scan TSG_SECURITY_SOURCE_LOCATION, NO hit location: %s scan ret: %d addr: %s",
|
2023-06-19 14:45:58 +08:00
|
|
|
src_ip_location, scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_LOCATION),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-19 14:45:58 +08:00
|
|
|
*location_client = (char *)ALLOC(char, strlen(src_ip_location));
|
|
|
|
|
memcpy(*location_client,src_ip_location, strlen(src_ip_location)-1);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hit_cnt_ip;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-30 19:39:18 +08:00
|
|
|
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)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
|
|
|
|
int scan_ret = 0;
|
|
|
|
|
int hit_cnt_ip = 0;
|
2023-03-30 19:39:18 +08:00
|
|
|
size_t n_hit_result = 0;
|
2020-08-10 18:13:44 +08:00
|
|
|
uint16_t opt_out_size;
|
2023-04-11 15:19:22 +08:00
|
|
|
char buff[TFE_STRING_MAX * 5] = {0};
|
2020-08-10 18:13:44 +08:00
|
|
|
char src_asn[TFE_STRING_MAX] = {0};
|
|
|
|
|
char dst_asn[TFE_STRING_MAX] = {0};
|
|
|
|
|
char src_org[TFE_STRING_MAX] = {0};
|
|
|
|
|
char dst_org[TFE_STRING_MAX] = {0};
|
|
|
|
|
struct tfe_cmsg *cmsg = tfe_stream_get0_cmsg(stream);
|
|
|
|
|
if (cmsg != NULL)
|
|
|
|
|
{
|
|
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_ASN, (unsigned char *)src_asn, sizeof(src_asn), &opt_out_size);
|
|
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch src asn from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_DST_ASN, (unsigned char *)dst_asn, sizeof(dst_asn), &opt_out_size);
|
|
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch dst asn from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_SRC_ORGANIZATION, (unsigned char *)src_org, sizeof(src_org), &opt_out_size);
|
|
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch src org from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
scan_ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_DST_ORGANIZATION, (unsigned char *)dst_org, sizeof(dst_org), &opt_out_size);
|
|
|
|
|
if (scan_ret != 0)
|
|
|
|
|
{
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_ERROR(logger, "fetch dst org from cmsg failed, ret: %d addr: %s", scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2021-04-28 18:01:32 +08:00
|
|
|
TFE_LOG_DEBUG(logger, "fetch src asn:%s org:%s; dst asn:%s org:%s addr: %s", src_asn, src_org, dst_asn, dst_org, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
|
|
|
|
|
if (strlen(dst_asn))
|
|
|
|
|
{
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_string((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_ASN),
|
2023-03-30 19:39:18 +08:00
|
|
|
dst_asn, strlen(dst_asn), 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)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2023-03-30 19:39:18 +08:00
|
|
|
TFE_LOG_INFO(logger, "Scan TSG_SECURITY_DESTINATION_ASN, Hit asn: %s scan ret: %d policy_id: %lld addr: %s",
|
|
|
|
|
dst_asn, scan_ret, result[hit_cnt + hit_cnt_ip], stream->str_stream_info);
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TFE_LOG_INFO(logger, "Scan TSG_SECURITY_DESTINATION_ASN, NO hit asn: %s scan ret: %d addr: %s",
|
2021-04-28 18:01:32 +08:00
|
|
|
dst_asn, scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_ASN),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2020-08-10 18:13:44 +08:00
|
|
|
memset(buff, 0, sizeof(buff));
|
2024-03-14 16:32:09 +08:00
|
|
|
snprintf(buff, sizeof(buff), "%s", dst_asn);
|
2020-08-10 18:13:44 +08:00
|
|
|
*asn_server = tfe_strdup(buff);
|
|
|
|
|
}
|
|
|
|
|
if (strlen(src_asn))
|
|
|
|
|
{
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_string((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_ASN),
|
2023-12-14 15:08:19 +08:00
|
|
|
src_asn, strlen(src_asn), result + hit_cnt + hit_cnt_ip, MAX_SCAN_RESULT - hit_cnt - hit_cnt_ip,
|
2023-03-30 19:39:18 +08:00
|
|
|
&n_hit_result, scan_mid);
|
|
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
2020-08-10 18:13:44 +08:00
|
|
|
{
|
2023-11-24 15:26:23 +08:00
|
|
|
TFE_LOG_INFO(logger, "Scan ATTR_SOURCE_ASN, Hit asn: %s scan ret: %d policy_id: %lld addr: %s",
|
2023-03-30 19:39:18 +08:00
|
|
|
src_asn, scan_ret, result[hit_cnt + hit_cnt_ip], stream->str_stream_info);
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-11-24 15:26:23 +08:00
|
|
|
TFE_LOG_INFO(logger, "Scan ATTR_SOURCE_ASN, NO hit asn: %s scan ret: %d addr: %s",
|
2021-04-28 18:01:32 +08:00
|
|
|
src_asn, scan_ret, stream->str_stream_info);
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_ASN),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2020-08-10 18:13:44 +08:00
|
|
|
memset(buff, 0, sizeof(buff));
|
2024-03-14 16:32:09 +08:00
|
|
|
snprintf(buff, sizeof(buff), "%s", src_asn);
|
2020-08-10 18:13:44 +08:00
|
|
|
*asn_client = tfe_strdup(buff);
|
|
|
|
|
}
|
|
|
|
|
return hit_cnt_ip;
|
2023-12-14 15:08:19 +08:00
|
|
|
}
|
|
|
|
|
|
2024-01-15 15:50:58 +08:00
|
|
|
int tfe_scan_app_id(long long *result, struct maat_state *scan_mid, int hit_cnt, long long app_id, int table_id)
|
2023-12-14 15:08:19 +08:00
|
|
|
{
|
|
|
|
|
int scan_ret = 0;
|
|
|
|
|
int hit_app_id = 0;
|
|
|
|
|
size_t n_hit_result = 0;
|
2024-01-03 17:26:20 +08:00
|
|
|
struct maat_hit_group hit_group;
|
2024-02-01 16:03:49 +08:00
|
|
|
|
|
|
|
|
struct app_id_dict *app_dict = (struct app_id_dict*)maat_plugin_table_get_ex_data((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_APP_ID_DICT),
|
2023-12-14 15:08:19 +08:00
|
|
|
(const char *)&app_id, sizeof(long long));
|
|
|
|
|
if(app_dict!=NULL)
|
|
|
|
|
{
|
2024-01-03 17:26:20 +08:00
|
|
|
memset(&hit_group, 0, sizeof(hit_group));
|
|
|
|
|
hit_group.group_id=app_dict->group_id;
|
|
|
|
|
scan_ret = maat_scan_group((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), table_id, &hit_group, 1, result+hit_cnt+hit_app_id,
|
2023-12-14 15:08:19 +08:00
|
|
|
MAX_SCAN_RESULT-hit_cnt-hit_app_id, &n_hit_result, scan_mid);
|
|
|
|
|
if(scan_ret==MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_app_id += n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), table_id, result+hit_cnt+hit_app_id, MAX_SCAN_RESULT-hit_cnt-hit_app_id, &n_hit_result, scan_mid);
|
|
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_app_id += n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
app_id_dict_free(app_dict);
|
|
|
|
|
}
|
|
|
|
|
return hit_app_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int get_route_dir(const struct tfe_stream * stream)
|
|
|
|
|
{
|
|
|
|
|
uint16_t out_size;
|
|
|
|
|
unsigned int route_dir; int ret=0;
|
|
|
|
|
|
|
|
|
|
struct tfe_cmsg *cmsg = tfe_stream_get0_cmsg(stream);
|
|
|
|
|
if (cmsg != NULL)
|
|
|
|
|
{
|
|
|
|
|
ret = tfe_cmsg_get_value(cmsg, TFE_CMSG_COMMON_DIRECTION, (unsigned char *)&route_dir, sizeof(route_dir), &out_size);
|
|
|
|
|
if (ret != 0)
|
|
|
|
|
{
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-12-25 14:43:00 +08:00
|
|
|
return (route_dir==69) ? 1 : 0;
|
2023-12-14 15:08:19 +08:00
|
|
|
}
|
|
|
|
|
|
2023-12-25 14:43:00 +08:00
|
|
|
int tfe_scan_internal_exteral_addr(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid, int hit_cnt, int c2s)
|
2023-12-14 15:08:19 +08:00
|
|
|
{
|
|
|
|
|
int scan_ret = 0;
|
2023-12-25 14:43:00 +08:00
|
|
|
int table_id=0;
|
2023-12-14 15:08:19 +08:00
|
|
|
int hit_cnt_ip = 0;
|
2023-12-25 14:43:00 +08:00
|
|
|
size_t array_size=256;
|
|
|
|
|
size_t n_hit_result = 0;
|
2024-01-03 17:26:20 +08:00
|
|
|
struct maat_hit_group last_hit_groups[256] = {0};
|
2024-01-15 15:50:58 +08:00
|
|
|
|
2023-12-14 15:08:19 +08:00
|
|
|
int dir_is_e2i = get_route_dir(stream);
|
2024-02-01 16:03:49 +08:00
|
|
|
if(c2s == 1) table_id = (dir_is_e2i == 1) ? tfe_bussiness_tableid_get(PXY_CTRL_INTERNAL_IP) : tfe_bussiness_tableid_get(PXY_CTRL_EXTERNAL_IP);
|
|
|
|
|
if(c2s == 0) table_id = (dir_is_e2i == 0) ? tfe_bussiness_tableid_get(PXY_CTRL_INTERNAL_IP) : tfe_bussiness_tableid_get(PXY_CTRL_EXTERNAL_IP);
|
2023-12-25 14:43:00 +08:00
|
|
|
|
2024-01-03 17:26:20 +08:00
|
|
|
size_t n_last_hit_group = maat_state_get_last_hit_group_cnt(scan_mid);
|
2023-12-25 14:43:00 +08:00
|
|
|
if(n_last_hit_group > 0)
|
|
|
|
|
{
|
2024-01-03 17:26:20 +08:00
|
|
|
maat_state_get_last_hit_groups(scan_mid, last_hit_groups, array_size);
|
|
|
|
|
scan_ret = maat_scan_group((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), table_id, last_hit_groups, array_size, result+hit_cnt+hit_cnt_ip,
|
2023-12-25 14:43:00 +08:00
|
|
|
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_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), table_id,
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hit_cnt_ip;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-01 16:03:49 +08:00
|
|
|
int tfe_scan_internal_exteral_port(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid, int hit_cnt, int c2s)
|
2023-12-25 14:43:00 +08:00
|
|
|
{
|
2024-02-01 16:03:49 +08:00
|
|
|
int scan_ret = 0;
|
2023-12-25 14:43:00 +08:00
|
|
|
int table_id=0;
|
2024-02-01 16:03:49 +08:00
|
|
|
int hit_cnt_port = 0;
|
|
|
|
|
size_t array_size=256;
|
|
|
|
|
size_t n_hit_result = 0;
|
|
|
|
|
struct maat_hit_group last_hit_groups[256] = {0};
|
|
|
|
|
|
|
|
|
|
int dir_is_e2i = get_route_dir(stream);
|
|
|
|
|
if(c2s == 1) table_id = (dir_is_e2i == 1) ? tfe_bussiness_tableid_get(PXY_CTRL_INTERNAL_PORT) : tfe_bussiness_tableid_get(PXY_CTRL_EXTERNAL_PORT);
|
|
|
|
|
if(c2s == 0) table_id = (dir_is_e2i == 0) ? tfe_bussiness_tableid_get(PXY_CTRL_INTERNAL_PORT) : tfe_bussiness_tableid_get(PXY_CTRL_EXTERNAL_PORT);
|
|
|
|
|
|
|
|
|
|
size_t n_last_hit_group = maat_state_get_last_hit_group_cnt(scan_mid);
|
|
|
|
|
if(n_last_hit_group > 0)
|
|
|
|
|
{
|
|
|
|
|
maat_state_get_last_hit_groups(scan_mid, last_hit_groups, array_size);
|
|
|
|
|
scan_ret = maat_scan_group((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), table_id, last_hit_groups, array_size, result+hit_cnt+hit_cnt_port,
|
|
|
|
|
MAX_SCAN_RESULT-hit_cnt-hit_cnt_port, &n_hit_result, scan_mid);
|
|
|
|
|
if(scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port += n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), table_id,
|
|
|
|
|
result+hit_cnt+hit_cnt_port, MAX_SCAN_RESULT-hit_cnt-hit_cnt_port, &n_hit_result, scan_mid);
|
|
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port += n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return hit_cnt_port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int tfe_scan_port(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid, int hit_cnt, uint16_t source, uint16_t dest)
|
|
|
|
|
{
|
|
|
|
|
int scan_ret = 0;
|
|
|
|
|
int hit_cnt_port = 0;
|
|
|
|
|
size_t n_hit_result = 0;
|
|
|
|
|
|
2024-02-22 17:18:48 +08:00
|
|
|
scan_ret=maat_scan_integer((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_PORT), ntohs(source),
|
2024-02-01 16:03:49 +08:00
|
|
|
result+hit_cnt+hit_cnt_port, MAX_SCAN_RESULT-hit_cnt-hit_cnt_port, &n_hit_result, scan_mid);
|
|
|
|
|
if(scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port+=n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_PORT),
|
|
|
|
|
result+hit_cnt+hit_cnt_port, MAX_SCAN_RESULT-hit_cnt-hit_cnt_port, &n_hit_result, scan_mid);
|
|
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port+=n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
scan_ret = tfe_scan_internal_exteral_port(stream, result, scan_mid, hit_cnt, 1);
|
|
|
|
|
if(scan_ret > 0)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port+=scan_ret;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-22 17:18:48 +08:00
|
|
|
scan_ret=maat_scan_integer((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_PORT), ntohs(dest),
|
2024-02-01 16:03:49 +08:00
|
|
|
result+hit_cnt+hit_cnt_port, MAX_SCAN_RESULT-hit_cnt-hit_cnt_port, &n_hit_result, scan_mid);
|
|
|
|
|
if(scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port+=n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_PORT),
|
|
|
|
|
result+hit_cnt+hit_cnt_port, MAX_SCAN_RESULT-hit_cnt-hit_cnt_port, &n_hit_result, scan_mid);
|
|
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port+=n_hit_result;
|
|
|
|
|
}
|
|
|
|
|
scan_ret = tfe_scan_internal_exteral_port(stream, result, scan_mid, hit_cnt, 0);
|
|
|
|
|
if(scan_ret > 0)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_port+=scan_ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hit_cnt_port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define PROTOCOL_TCP_GROUP_ID 6
|
|
|
|
|
int tfe_scan_ipv4_addr(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid, int hit_cnt, struct ipaddr sapp_addr)
|
|
|
|
|
{
|
2023-12-25 14:43:00 +08:00
|
|
|
int scan_ret = 0;
|
|
|
|
|
int hit_cnt_ip = 0;
|
|
|
|
|
size_t n_hit_result = 0;
|
2024-02-01 16:03:49 +08:00
|
|
|
struct maat_hit_group hit_group;
|
2023-12-25 14:43:00 +08:00
|
|
|
|
2024-02-01 16:03:49 +08:00
|
|
|
memset(&hit_group, 0, sizeof(hit_group));
|
|
|
|
|
hit_group.group_id=PROTOCOL_TCP_GROUP_ID;
|
|
|
|
|
scan_ret = maat_scan_group((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_IP_PROTOCOL), &hit_group, 1,
|
|
|
|
|
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;
|
|
|
|
|
}
|
2024-02-29 11:25:36 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2024-03-28 11:39:31 +08:00
|
|
|
|
|
|
|
|
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);
|
2023-12-14 15:08:19 +08:00
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
|
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_IP),
|
|
|
|
|
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
2023-12-14 15:08:19 +08:00
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
|
|
|
|
}
|
2023-12-25 14:43:00 +08:00
|
|
|
scan_ret = tfe_scan_internal_exteral_addr(stream, result, scan_mid, hit_cnt, 1);
|
|
|
|
|
if(scan_ret > 0)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += scan_ret;
|
|
|
|
|
}
|
2023-12-14 15:08:19 +08:00
|
|
|
|
2024-03-28 11:39:31 +08:00
|
|
|
scan_ret = maat_scan_ipv4_port((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_IP), sapp_addr.v4->daddr, ntohs(sapp_addr.v4->dest),
|
|
|
|
|
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
2023-12-14 15:08:19 +08:00
|
|
|
if(scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
|
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_IP),
|
|
|
|
|
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
2023-12-14 15:08:19 +08:00
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
|
|
|
|
}
|
2023-12-25 14:43:00 +08:00
|
|
|
scan_ret = tfe_scan_internal_exteral_addr(stream, result, scan_mid, hit_cnt, 0);
|
|
|
|
|
if(scan_ret > 0)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += scan_ret;
|
|
|
|
|
}
|
2023-12-14 15:08:19 +08:00
|
|
|
|
|
|
|
|
return hit_cnt_ip;
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-25 14:43:00 +08:00
|
|
|
int tfe_scan_ipv6_addr(const struct tfe_stream *stream, long long *result, struct maat_state *scan_mid, int hit_cnt, struct ipaddr sapp_addr)
|
2023-12-14 15:08:19 +08:00
|
|
|
{
|
|
|
|
|
int scan_ret = 0;
|
|
|
|
|
int hit_cnt_ip = 0;
|
|
|
|
|
size_t n_hit_result = 0;
|
2024-02-01 16:03:49 +08:00
|
|
|
struct maat_hit_group hit_group;
|
2023-12-14 15:08:19 +08:00
|
|
|
|
2024-02-01 16:03:49 +08:00
|
|
|
memset(&hit_group, 0, sizeof(hit_group));
|
|
|
|
|
hit_group.group_id=PROTOCOL_TCP_GROUP_ID;
|
|
|
|
|
scan_ret = maat_scan_group((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_IP_PROTOCOL), &hit_group, 1,
|
|
|
|
|
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;
|
|
|
|
|
}
|
2024-03-28 11:39:31 +08:00
|
|
|
|
|
|
|
|
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);
|
2023-12-14 15:08:19 +08:00
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
|
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_SOURCE_IP),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2023-12-25 14:43:00 +08:00
|
|
|
scan_ret = tfe_scan_internal_exteral_addr(stream, result, scan_mid, hit_cnt, 1);
|
|
|
|
|
if(scan_ret > 0)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += scan_ret;
|
|
|
|
|
}
|
2024-03-28 11:39:31 +08:00
|
|
|
|
|
|
|
|
scan_ret = maat_scan_ipv6_port((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_IP), sapp_addr.v6->daddr, ntohs(sapp_addr.v6->dest),
|
|
|
|
|
result+hit_cnt+hit_cnt_ip, MAX_SCAN_RESULT-hit_cnt-hit_cnt_ip, &n_hit_result, scan_mid);
|
2023-12-14 15:08:19 +08:00
|
|
|
if (scan_ret == MAAT_SCAN_HIT)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += n_hit_result;
|
|
|
|
|
}
|
2024-02-01 16:03:49 +08:00
|
|
|
scan_ret = maat_scan_not_logic((struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT), tfe_bussiness_tableid_get(PXY_CTRL_DESTINATION_IP),
|
2023-12-14 15:08:19 +08:00
|
|
|
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;
|
|
|
|
|
}
|
2023-12-25 14:43:00 +08:00
|
|
|
scan_ret = tfe_scan_internal_exteral_addr(stream, result, scan_mid, hit_cnt, 0);
|
|
|
|
|
if(scan_ret > 0)
|
|
|
|
|
{
|
|
|
|
|
hit_cnt_ip += scan_ret;
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-14 15:08:19 +08:00
|
|
|
return hit_cnt_ip;
|
2020-08-10 18:13:44 +08:00
|
|
|
}
|