1、修改fqdn cmsg 枚举名称 2、增加fs stat 输出格式配置项

This commit is contained in:
fumingwei
2020-10-12 17:00:13 +08:00
parent 346cd4efed
commit 5eb42db275
4 changed files with 24 additions and 8 deletions

View File

@@ -381,11 +381,11 @@ static int session_attribute_cmsg_set(struct kni_cmsg *cmsg, struct pme_info *pm
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_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)
{
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
{
@@ -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));
}
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);
@@ -2030,6 +2030,7 @@ static struct kni_field_stat_handle * fs_init(const char *profile){
int remote_switch = 0;
char remote_ip[INET_ADDRSTRLEN];
int remote_port;
int statsd_format = FS_OUTPUT_STATSD;
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");
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);
FS_set_para(handle, STATS_SERVER_IP, remote_ip, strlen(remote_ip));
FS_set_para(handle, STATS_SERVER_PORT, &remote_port, sizeof(remote_port));
value=FS_OUTPUT_STATSD;
MESA_load_profile_int_def(profile, section, "statsd_format", &statsd_format, 0);
switch(statsd_format)
{
case 1:
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));
}
MESA_load_profile_int_def(profile, section, "stat_cycle", &stat_cycle, 5);