summaryrefslogtreecommitdiff
path: root/plugin/business/doh/src
diff options
context:
space:
mode:
authorfengweihao <[email protected]>2024-07-12 11:13:56 +0800
committerfengweihao <[email protected]>2024-07-12 11:13:56 +0800
commit88a7a8c5c48f681cdd0478a809652ac94c2647ee (patch)
treeb0b56b4faaa0a5d667112dd1a3868ef0bc6c05a1 /plugin/business/doh/src
parent5eccfbb882852a9c4779ee4d7039b1ae7e6a9bbb (diff)
TSG-21787 Proxy初始化kafka topic时增加client.id参数v4.9.7-20240712
TSG-21730 Proxy优化Manipulation日志中host和fqdn字段的格式
Diffstat (limited to 'plugin/business/doh/src')
-rw-r--r--plugin/business/doh/src/logger.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugin/business/doh/src/logger.cpp b/plugin/business/doh/src/logger.cpp
index a1ab494..a2567c0 100644
--- a/plugin/business/doh/src/logger.cpp
+++ b/plugin/business/doh/src/logger.cpp
@@ -337,6 +337,17 @@ static int doh_get_ip_server_geolocation(struct tfe_cmsg * cmsg, cJSON *common_o
return 0;
}
+int doh_add_host_to_object(cJSON *common_obj, const char *req_spec_host)
+{
+ unsigned int port;
+ char *format_host=ALLOC(char, strlen(req_spec_host)+1);
+ sscanf(req_spec_host, "%[^:]:%u", format_host, &port);
+ cJSON_AddStringToObject(common_obj, "doh_host", format_host);
+ cJSON_AddStringToObject(common_obj, "server_fqdn", format_host);
+ FREE(&format_host);
+ return 0;
+}
+
int doh_send_log(struct doh_conf *handle, const struct tfe_http_session *http, const struct tfe_stream *stream, struct doh_ctx *ctx)
{
struct doh_maat_rule_t *result = ctx->result;
@@ -446,8 +457,7 @@ int doh_send_log(struct doh_conf *handle, const struct tfe_http_session *http, c
cJSON_AddNumberToObject(common_obj, "sent_bytes", c2s_byte_num);
cJSON_AddNumberToObject(common_obj, "received_bytes", s2c_byte_num);
cJSON_AddStringToObject(common_obj, "doh_url", http->req->req_spec.url);
- cJSON_AddStringToObject(common_obj, "doh_host", http->req->req_spec.host);
- cJSON_AddStringToObject(common_obj, "server_fqdn", http->req->req_spec.host);
+ doh_add_host_to_object(common_obj, http->req->req_spec.host);
if(handle->effective_device_tag)
{