summaryrefslogtreecommitdiff
path: root/src/tsg_send_log.cpp
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2023-05-30 16:56:15 +0800
committerliuxueli <[email protected]>2023-05-30 16:56:15 +0800
commita4711a653d54fc6ccd8abf8d1a49c3f7b79172d5 (patch)
tree9f27bb5375923141bd6c93b3099637b53e901855 /src/tsg_send_log.cpp
parentc34f27e2502071658757cd9848b588d5b9f3d273 (diff)
TSG-14580: 链接命中shunt动作时不记录任何日志
Diffstat (limited to 'src/tsg_send_log.cpp')
-rw-r--r--src/tsg_send_log.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp
index 6f3703e..5bd6836 100644
--- a/src/tsg_send_log.cpp
+++ b/src/tsg_send_log.cpp
@@ -380,7 +380,13 @@ static int set_location(struct TLD_handle_t *_handle, const struct streaminfo *
static int set_direction(struct tsg_log_instance_t *_instance, struct TLD_handle_t *_handle, const struct streaminfo *a_stream)
{
- char direction=srt_action_context_get_direction(a_stream);
+ const struct session_runtime_action_context *srt_action_context=session_runtime_action_context_get(a_stream);
+ if(srt_action_context==NULL)
+ {
+ return 0;
+ }
+
+ char direction=srt_action_context_get_direction(srt_action_context);
if(direction>0)
{
TLD_append(_handle, _instance->id2field[LOG_COMMON_DIRECTION].name, (void *)(long)direction, TLD_TYPE_LONG);
@@ -1573,6 +1579,23 @@ int is_multi_hit_same_policy(struct maat_rule *result, int *policy_id, int *poli
return 0;
}
+static int is_hitted_shunt(const struct streaminfo *a_stream)
+{
+ if(a_stream==NULL)
+ {
+ return 0;
+ }
+
+ const struct session_runtime_action_context *srt_action_context=session_runtime_action_context_get(a_stream);
+ enum TSG_METHOD_TYPE method_type=srt_action_context_get_method_type(srt_action_context);
+ if(method_type==TSG_METHOD_TYPE_SHUNT)
+ {
+ return 1;
+ }
+
+ return 0;
+}
+
static int set_xxxx_from_user_region(struct TLD_handle_t *_handle, struct tsg_log_instance_t *_instance, struct maat_rule *p_result, int thread_seq)
{
cJSON *item=NULL;
@@ -2316,7 +2339,13 @@ int tsg_send_log(struct tsg_log_instance_t *instance, struct TLD_handle_t *handl
MESA_handle_runtime_log(_instance->logger, RLOG_LV_INFO, "tsg_send_log", "Disable tsg_send_log.");
return 0;
}
-
+
+ if(is_hitted_shunt(a_stream))
+ {
+ TLD_cancel(handle);
+ return 0;
+ }
+
TLD_append_streaminfo(instance, handle, a_stream);
TLD_append(_handle, _instance->id2field[LOG_COMMON_SLED_IP].name, (void *)(_instance->local_ip_str), TLD_TYPE_STRING);
if(strlen(g_tsg_para.device_sn)>0)