summaryrefslogtreecommitdiff
path: root/plugin/business/doh/src
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2022-10-26 14:30:45 +0800
committer卢文朋 <[email protected]>2022-11-11 02:09:15 +0000
commit6e4fc2a97808b9eef9de079d6651a7e0387a6ce6 (patch)
treea54f8e74778d43c3c2835a50f533a5ca984d5799 /plugin/business/doh/src
parent87adce7cbf4e2c715776199228ac04ff396d33f7 (diff)
TSG-12300 代理日志增加Traffic Vsys id字段
Diffstat (limited to 'plugin/business/doh/src')
-rw-r--r--plugin/business/doh/src/doh.cpp9
-rw-r--r--plugin/business/doh/src/logger.cpp3
-rw-r--r--plugin/business/doh/src/pub.h1
3 files changed, 10 insertions, 3 deletions
diff --git a/plugin/business/doh/src/doh.cpp b/plugin/business/doh/src/doh.cpp
index 59cf502..8c2b1a0 100644
--- a/plugin/business/doh/src/doh.cpp
+++ b/plugin/business/doh/src/doh.cpp
@@ -74,10 +74,15 @@ static int doh_get_answer_ttl(cJSON *object)
return (rand() % (max - min + 1) + min);
}
-static cJSON *doh_get_answer_records(cJSON *object, int qtype)
+static cJSON *doh_get_answer_records(struct doh_ctx *ctx, cJSON *object, int qtype)
{
int i = 0;
+ cJSON *vsys_id=cJSON_GetObjectItem(object, "vsys_id");
+ if(vsys_id && vsys_id->type==cJSON_Number)
+ {
+ ctx->vsys_id = vsys_id->valueint;
+ }
cJSON *resolution = cJSON_GetObjectItem(object, "resolution");
int size = cJSON_GetArraySize(resolution);
for (i = 0; i < size; i++)
@@ -114,7 +119,7 @@ static void doh_get_cheat_data(Maat_rule_t *p_result, int qtype, struct doh_ctx
goto end;
}
- answer_array = doh_get_answer_records(object, qtype);
+ answer_array = doh_get_answer_records(ctx, object, qtype);
if (answer_array != NULL)
{
answer_size = cJSON_GetArraySize(answer_array);
diff --git a/plugin/business/doh/src/logger.cpp b/plugin/business/doh/src/logger.cpp
index f0632ed..1c65288 100644
--- a/plugin/business/doh/src/logger.cpp
+++ b/plugin/business/doh/src/logger.cpp
@@ -400,7 +400,8 @@ int doh_send_log(struct doh_conf *handle, const struct tfe_http_session *http, c
cJSON_AddNumberToObject(common_obj, "common_link_id", 0);
cJSON_AddNumberToObject(common_obj, "common_stream_dir", 3); //1:c2s, 2:s2c, 3:double
cJSON_AddStringToObject(common_obj, "common_sled_ip", handle->kafka_logger->local_ip_str);
- cJSON_AddNumberToObject(common_obj, "common_vsys_id", handle->kafka_logger->vsys_id);
+ cJSON_AddNumberToObject(common_obj, "common_t_vsys_id", handle->kafka_logger->t_vsys_id);
+ cJSON_AddNumberToObject(common_obj, "common_vsys_id", ctx->vsys_id);
cJSON_AddNumberToObject(common_obj, "common_entrance_id", handle->entry_id);
cJSON_AddStringToObject(common_obj, "common_device_id", handle->device_id);
cJSON_AddNumberToObject(common_obj, "common_c2s_byte_num", c2s_byte_num);
diff --git a/plugin/business/doh/src/pub.h b/plugin/business/doh/src/pub.h
index 18f706f..82b9ec2 100644
--- a/plugin/business/doh/src/pub.h
+++ b/plugin/business/doh/src/pub.h
@@ -80,6 +80,7 @@ struct doh_ctx
int magic_num;
int manipulate;
int opts_num;
+ int vsys_id;
size_t result_num;
Maat_rule_t *result;
cheat_pkt_opt_t *opts;