1、修改fqdn cmsg 枚举名称 2、增加fs stat 输出格式配置项
This commit is contained in:
@@ -76,14 +76,16 @@ enum tfe_cmsg_tlv_type
|
|||||||
TFE_CMSG_DST_IP_LOCATION_CITY, // string max size 256
|
TFE_CMSG_DST_IP_LOCATION_CITY, // string max size 256
|
||||||
//ja3 fingerprint
|
//ja3 fingerprint
|
||||||
TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT,
|
TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT,
|
||||||
TFE_CMSG_FQDN_NUM, // uint8_t max size 1
|
//fqdn cat id
|
||||||
TFE_CMSG_FQDN_VAL, // string max size 8 * sizeof(uint32_t)
|
TFE_CMSG_FQDN_CAT_ID_NUM, // uint32_t
|
||||||
|
TFE_CMSG_FQDN_CAT_ID_VAL, // string max size 8 * sizeof(uint32_t)
|
||||||
//cmsg tlv max
|
//cmsg tlv max
|
||||||
KNI_CMSG_TLV_NR_MAX,
|
KNI_CMSG_TLV_NR_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const char * tfe_cmsg_tlv_type_to_string[KNI_CMSG_TLV_NR_MAX];
|
extern const char * tfe_cmsg_tlv_type_to_string[KNI_CMSG_TLV_NR_MAX];
|
||||||
|
|
||||||
|
|
||||||
struct kni_cmsg* kni_cmsg_init();
|
struct kni_cmsg* kni_cmsg_init();
|
||||||
void kni_cmsg_destroy(struct kni_cmsg *cmsg);
|
void kni_cmsg_destroy(struct kni_cmsg *cmsg);
|
||||||
int kni_cmsg_get(struct kni_cmsg *cmsg, uint16_t type, uint16_t *size, unsigned char **pvalue);
|
int kni_cmsg_get(struct kni_cmsg *cmsg, uint16_t type, uint16_t *size, unsigned char **pvalue);
|
||||||
|
|||||||
@@ -248,8 +248,8 @@ void tfe_cmsg_enum_to_string()
|
|||||||
tfe_cmsg_tlv_type_to_string[TFE_CMSG_DST_IP_LOCATION_CITY] = "TFE_CMSG_DST_IP_LOCATION_CITY";
|
tfe_cmsg_tlv_type_to_string[TFE_CMSG_DST_IP_LOCATION_CITY] = "TFE_CMSG_DST_IP_LOCATION_CITY";
|
||||||
|
|
||||||
tfe_cmsg_tlv_type_to_string[TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT] = "TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT";
|
tfe_cmsg_tlv_type_to_string[TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT] = "TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT";
|
||||||
tfe_cmsg_tlv_type_to_string[TFE_CMSG_FQDN_NUM] = "TFE_CMSG_FQDN_NUM";
|
tfe_cmsg_tlv_type_to_string[TFE_CMSG_FQDN_CAT_ID_NUM] = "TFE_CMSG_FQDN_CAT_ID_NUM";
|
||||||
tfe_cmsg_tlv_type_to_string[TFE_CMSG_FQDN_VAL] = "TFE_CMSG_FQDN_VAL";
|
tfe_cmsg_tlv_type_to_string[TFE_CMSG_FQDN_CAT_ID_VAL] = "TFE_CMSG_FQDN_CAT_ID_VAL";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ remote_port = 8125
|
|||||||
local_path = ./fs2_kni.status
|
local_path = ./fs2_kni.status
|
||||||
stat_cycle = 1
|
stat_cycle = 1
|
||||||
print_mode = 1
|
print_mode = 1
|
||||||
|
# 1:FS_OUTPUT_STATSD; 2:FS_OUTPUT_INFLUX_LINE
|
||||||
|
statsd_format = 2
|
||||||
|
|
||||||
#self test Shunt rules security policy id
|
#self test Shunt rules security policy id
|
||||||
[tsg_diagnose]
|
[tsg_diagnose]
|
||||||
|
|||||||
@@ -381,11 +381,11 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
|
|||||||
else
|
else
|
||||||
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT, (const unsigned char*)session_attribute_label->ja3_fingerprint, strlen(session_attribute_label->ja3_fingerprint), pmeinfo);
|
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_SSL_CLIENT_JA3_FINGERPRINT, (const unsigned char*)session_attribute_label->ja3_fingerprint, strlen(session_attribute_label->ja3_fingerprint), pmeinfo);
|
||||||
|
|
||||||
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_FQDN_NUM, (const unsigned char*)&(session_attribute_label->fqdn_category_id_num), sizeof(unsigned int), pmeinfo);
|
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_FQDN_CAT_ID_NUM, (const unsigned char*)&(session_attribute_label->fqdn_category_id_num), sizeof(unsigned int), pmeinfo);
|
||||||
|
|
||||||
if(session_attribute_label->fqdn_category_id_num <= 0 || session_attribute_label->fqdn_category_id_num > 8)
|
if(session_attribute_label->fqdn_category_id_num <= 0 || session_attribute_label->fqdn_category_id_num > 8)
|
||||||
{
|
{
|
||||||
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_FQDN_VAL, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
|
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char*)empty_arr, strlen(empty_arr), pmeinfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -394,7 +394,7 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
|
|||||||
{
|
{
|
||||||
memcpy((void *)(fqdn_val + i * (sizeof(unsigned int))), (void *)&(session_attribute_label->fqdn_category_id[i]), sizeof(unsigned int));
|
memcpy((void *)(fqdn_val + i * (sizeof(unsigned int))), (void *)&(session_attribute_label->fqdn_category_id[i]), sizeof(unsigned int));
|
||||||
}
|
}
|
||||||
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_FQDN_VAL, (const unsigned char*)fqdn_val,session_attribute_label->fqdn_category_id_num *sizeof(unsigned int) , pmeinfo);
|
ret = wrapped_kni_cmsg_set(cmsg,TFE_CMSG_FQDN_CAT_ID_VAL, (const unsigned char*)fqdn_val,session_attribute_label->fqdn_category_id_num *sizeof(unsigned int) , pmeinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}while(0);
|
}while(0);
|
||||||
@@ -2030,6 +2030,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){
|
|||||||
int remote_switch = 0;
|
int remote_switch = 0;
|
||||||
char remote_ip[INET_ADDRSTRLEN];
|
char remote_ip[INET_ADDRSTRLEN];
|
||||||
int remote_port;
|
int remote_port;
|
||||||
|
int statsd_format = FS_OUTPUT_STATSD;
|
||||||
MESA_load_profile_int_def(profile, section, "remote_switch", &remote_switch, 0);
|
MESA_load_profile_int_def(profile, section, "remote_switch", &remote_switch, 0);
|
||||||
MESA_load_profile_string_def(profile, section, "local_path", local_path, sizeof(local_path), "./fs2_kni.status");
|
MESA_load_profile_string_def(profile, section, "local_path", local_path, sizeof(local_path), "./fs2_kni.status");
|
||||||
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n remote_switch: %d\n local_path: %s", section, remote_switch, local_path);
|
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n remote_switch: %d\n local_path: %s", section, remote_switch, local_path);
|
||||||
@@ -2052,7 +2053,18 @@ static struct kni_field_stat_handle * fs_init(const char *profile){
|
|||||||
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n remote_ip: %s\n remote_port: %d", section, remote_ip, remote_port);
|
KNI_LOG_ERROR(logger, "MESA_prof_load, [%s]:\n remote_ip: %s\n remote_port: %d", section, remote_ip, remote_port);
|
||||||
FS_set_para(handle, STATS_SERVER_IP, remote_ip, strlen(remote_ip));
|
FS_set_para(handle, STATS_SERVER_IP, remote_ip, strlen(remote_ip));
|
||||||
FS_set_para(handle, STATS_SERVER_PORT, &remote_port, sizeof(remote_port));
|
FS_set_para(handle, STATS_SERVER_PORT, &remote_port, sizeof(remote_port));
|
||||||
|
MESA_load_profile_int_def(profile, section, "statsd_format", &statsd_format, 0);
|
||||||
|
switch(statsd_format)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
value=FS_OUTPUT_STATSD;
|
value=FS_OUTPUT_STATSD;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
value=FS_OUTPUT_INFLUX_LINE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value=FS_OUTPUT_STATSD;
|
||||||
|
}
|
||||||
FS_set_para(handle, STATS_FORMAT, &value, sizeof(value));
|
FS_set_para(handle, STATS_FORMAT, &value, sizeof(value));
|
||||||
}
|
}
|
||||||
MESA_load_profile_int_def(profile, section, "stat_cycle", &stat_cycle, 5);
|
MESA_load_profile_int_def(profile, section, "stat_cycle", &stat_cycle, 5);
|
||||||
|
|||||||
Reference in New Issue
Block a user