update src: fix syntax error

This commit is contained in:
Junzy
2024-08-26 18:31:05 +08:00
parent fd5f7e30d9
commit 919b90a2da
2 changed files with 5 additions and 5 deletions

View File

@@ -32,7 +32,7 @@ struct sockaddr_in dst_addr;
// 初始化函数
int nat_format_init(void) {
// 读取配置文件
MESA_load_profile_uint_def(NAT_FORMAT_CONFIG_FILE, "NAT_FORMAT_SEND", "batch_size", g_nat_format_info.batch_size, 20);
MESA_load_profile_uint_def(NAT_FORMAT_CONFIG_FILE, "NAT_FORMAT_SEND", "batch_size", &g_nat_format_info.batch_size, 20);
MESA_load_profile_string_def(NAT_FORMAT_CONFIG_FILE, "NAT_FORMAT_SEND", "host_ip", g_nat_format_info.host_ip, 16, "127.0.0.1");
MESA_load_profile_int_def(NAT_FORMAT_CONFIG_FILE, "NAT_FORMAT_SEND", "host_port", &g_nat_format_info.host_port, 5678);
MESA_load_profile_string_def(NAT_FORMAT_CONFIG_FILE, "NAT_FORMAT_SEND", "multicast_ip", g_nat_format_info.multicast_ip, 16, "224.88.88.88");
@@ -48,7 +48,7 @@ int nat_format_init(void) {
MESA_load_profile_string_def(NAT_FORMAT_CONFIG_FILE, "NAT_FORMAT_LOG", "run_log_path", g_nat_format_info.log_path, sizeof(g_nat_format_info.log_path), "./log/nat_format.log");
MESA_load_profile_uint_def(NAT_FORMAT_CONFIG_FILE, "NAT_FORMAT_LOG", "run_log_level", &g_nat_format_info.log_level, 10);
g_nat_format_info.log = MESA_create_runtime_log_handle(g_nat_format_info.log_path, g_nat_format_info.log_level);
if (g_tf_dns_info.log == NULL) {
if (g_nat_format_info.log == NULL) {
printf("MESA_create_runtime_log_handle %s failed: %s\n", g_nat_format_info.log_path, strerror(errno));
return -1;
}
@@ -109,7 +109,7 @@ char nat_format_entry(struct streaminfo *a_udp, void **pme, int thread_seq, void
// 提取nat信息
struct nat_payload nat_payload;
inet_pton(AF_INET, a_udp->addr.tuple4_v4->saddr, nat_payload.fw_ip); // 防火墙ip为源ip需要进行点分十进制转换
nat_payload.fw_ip = a_udp->addr.tuple4_v4->saddr; // 防火墙ip为源ip本身为二进制格式
// 根据数据来源的端口采取不同的处理策略
// 华为syslog格式防火墙日志生成时间需要转换为时间戳、动作字符串需要转换为序号、点分十进制格式ip需要转换为二进制
if (udp_port == g_nat_format_info.hw_syslog_port) {
@@ -130,7 +130,7 @@ char nat_format_entry(struct streaminfo *a_udp, void **pme, int thread_seq, void
MESA_handle_runtime_log(g_nat_format_info.log, RLOG_LV_FATAL, "nat_format Huawei syslog", "firewall log generation time extraction failed: %s", fw_log_time);
return APP_STATE_GIVEME;
}
nat_payload.fw_log_timestamp = (unsigned int)mktime(fw_time);
nat_payload.fw_log_timestamp = (unsigned int)mktime(&fw_time);
inet_pton(AF_INET, src_intra_ip, &nat_payload.src_intra_ip);
inet_pton(AF_INET, dst_ip, &nat_payload.dst_ip);

View File

@@ -14,7 +14,7 @@
// 全局配置信息
struct nat_format_global_info {
int32_t batch_size;
u_int32_t batch_size;
char host_ip[64];
u_int32_t host_port;
char multicast_ip[64];