TSG-18596 修复Redirect-DoH策略无法命中

TSG-18558 Manipulation日志中,有字节数和包数均为0的日志存在
This commit is contained in:
fengweihao
2024-01-15 15:50:58 +08:00
parent b1f670c05d
commit ad21a6ac3d
5 changed files with 27 additions and 14 deletions

View File

@@ -9,6 +9,6 @@ int tfe_scan_ip_asn(const struct tfe_stream *stream, long long *result, struct m
int hit_cnt, void *logger, char **asn_server, char **asn_client);
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);
int tfe_scan_app_id(long long *result, struct maat_state *scan_mid, int hit_cnt, int app_id, int table_id);
int tfe_scan_app_id(long long *result, struct maat_state *scan_mid, int hit_cnt, long long app_id, int table_id);
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);
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);

View File

@@ -254,7 +254,7 @@ int tfe_scan_ip_asn(const struct tfe_stream *stream, long long *result, struct m
return hit_cnt_ip;
}
int tfe_scan_app_id(long long *result, struct maat_state *scan_mid, int hit_cnt, int app_id, int table_id)
int tfe_scan_app_id(long long *result, struct maat_state *scan_mid, int hit_cnt, long long app_id, int table_id)
{
int scan_ret = 0;
int hit_app_id = 0;

View File

@@ -61,6 +61,8 @@
/* Systemd */
#include <systemd/sd-daemon.h>
#include <MESA/maat.h>
extern struct tcp_policy_enforcer *tcp_policy_enforcer_create(void *logger);
extern struct chaining_policy_enforcer *chaining_policy_enforcer_create(void *logger);
extern struct ssl_policy_enforcer *ssl_policy_enforcer_create(void *logger);
@@ -257,6 +259,11 @@ static void __dummy_event_handler(evutil_socket_t fd, short what, void * arg)
static void __signal_handler_cb(evutil_socket_t fd, short what, void * arg)
{
tfe_proxy * ctx = (tfe_proxy *) arg;
struct maat *maat=NULL;
const char *profile_path = "./conf/tfe/tfe.conf";
int log_level=LOG_LEVEL_FATAL;
switch (fd)
{
case SIGTERM:
@@ -264,6 +271,12 @@ static void __signal_handler_cb(evutil_socket_t fd, short what, void * arg)
case SIGHUP:
TFE_LOG_ERROR(ctx->logger, "recv SIGHUP, reload zlog.conf");
MESA_handle_runtime_log_reconstruction(NULL);
MESA_load_profile_int_def(profile_path, "maat", "log_level", &(log_level), LOG_LEVEL_FATAL);
maat = (struct maat *)tfe_bussiness_resouce_get(STATIC_MAAT);
if(maat)
{
maat_reload_log_level(maat, (enum log_level)log_level);
}
break;
case SIGUSR1:
// enable work thread sleep

View File

@@ -266,7 +266,6 @@ static void doh_maat_scan(const struct tfe_stream *stream, const struct tfe_http
{
int hit_cnt = 0;
int scan_ret = 0;
int app_id = 8006;
size_t n_hit_result;
struct ipaddr sapp_addr;
long long p_result = 0;
@@ -334,6 +333,7 @@ static void doh_maat_scan(const struct tfe_stream *stream, const struct tfe_http
}
}
// scan appid
long long app_id = 8006;
scan_ret = tfe_scan_app_id(result, ctx->scan_mid, hit_cnt, app_id, g_doh_conf->tables[TYPE_APPID].id);
if(scan_ret > 0)
{

View File

@@ -243,12 +243,12 @@ int proxy_send_log(struct proxy_logger* handle, const struct proxy_log* log_msg)
ret = tfe_stream_info_get(log_msg->stream, INFO_FROM_DOWNSTREAM_RX_OFFSET, &c2s_byte_num, sizeof(c2s_byte_num));
if(ret != 0)
{
c2s_byte_num = log_msg->c2s_byte_num;
c2s_byte_num = log_msg->c2s_byte_num == 0 ? c2s_byte_num : log_msg->c2s_byte_num;
}
ret = tfe_stream_info_get(log_msg->stream, INFO_FROM_UPSTREAM_RX_OFFSET, &s2c_byte_num, sizeof(s2c_byte_num));
if(ret !=0)
{
s2c_byte_num = log_msg->s2c_byte_num;
s2c_byte_num = log_msg->s2c_byte_num == 0 ? s2c_byte_num : log_msg->s2c_byte_num;
}
cJSON_AddStringToObject(common_obj, "http_version", app_proto[http->major_version]);