增加和tfe通信接口, 添加负载均衡功能等

This commit is contained in:
崔一鸣
2019-06-03 20:19:04 +08:00
parent 85aee8ba55
commit 1fa7a0673f
20 changed files with 1607 additions and 341 deletions

View File

@@ -1,3 +1,13 @@
add_library(common STATIC src/kni_utils.cpp src/ssl_utils.cpp)
add_library(common STATIC src/kni_utils.cpp src/ssl_utils.cpp src/kni_cmsg.cpp)
target_include_directories(common PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(common MESA_handle_logger)
### test_cmsg
add_executable(test_cmsg test/test_cmsg.cpp)
target_include_directories(test_cmsg PRIVATE include)
target_link_libraries(test_cmsg PRIVATE common)
### test_uuid
add_executable(test_uuid test/test_uuid.cpp)
target_include_directories(test_uuid PRIVATE include)
target_link_libraries(test_uuid PRIVATE uuid common)

48
common/include/kni_cmsg.h Normal file
View File

@@ -0,0 +1,48 @@
#pragma once
#define KNI_CMSG_TLV_NR_MAX 64
struct kni_cmsg;
struct kni_cmsg_serialize_header;
enum kni_cmsg_errno{
KNI_CMSG_INVALID_FORMAT = -1,
KNI_CMSG_BUFF_NOT_ENOUGH = -2,
KNI_CMSG_INVALID_TYPE = -3
};
enum tfe_cmsg_tlv_type
{
/* TCP restore information */
TFE_CMSG_TCP_RESTORE_SEQ = 0x0,
TFE_CMSG_TCP_RESTORE_ACK = 0x1,
TFE_CMSG_TCP_RESTORE_MSS_CLIENT = 0x2,
TFE_CMSG_TCP_RESTORE_MSS_SERVER = 0x3,
TFE_CMSG_TCP_RESTORE_WSACLE_CLIENT = 0x4,
TFE_CMSG_TCP_RESTORE_WSACLE_SERVER = 0x5,
TFE_CMSG_TCP_RESTORE_SACK_CLIENT = 0x6,
TFE_CMSG_TCP_RESTORE_SACK_SERVER = 0x7,
TFE_CMSG_TCP_RESTORE_TS_CLIENT = 0x8,
TFE_CMSG_TCP_RESTORE_TS_SERVER = 0x9,
TFE_CMSG_TCP_RESTORE_PROTOCOL = 0xa,
TFE_CMSG_POLICY_ID = 0x10,
TFE_CMSG_STREAM_TRACE_ID = 0x11,
TFE_CMSG_SSL_INTERCEPT_STATE, //size uint64_t, 0-passthrough, 1-intercept, 2-shutdown, referer from enum ssl_stream_action
TFE_CMSG_SSL_UPSTREAM_LATENCY, //size uint64_t, milisecond
TFE_CMSG_SSL_DOWNSTREAM_LATENCY, //size uint64_t, milisecond
TFE_CMSG_SSL_UPSTREAM_VERSION, //string, SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 unknown
TFE_CMSG_SSL_DOWNSTREAM_VERSION,
TFE_CMSG_SSL_PINNING_STATE, //size uint64_t, 0-not pinning 1-pinning 2-maybe pinning
TFE_CMSG_SSL_CERT_VERIFY,
TFE_CMSG_SSL_ERROR
};
struct kni_cmsg* kni_cmsg_init();
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_set(struct kni_cmsg *cmsg, uint16_t type, const unsigned char *value, uint16_t size);
uint16_t kni_cmsg_serialize_size_get(struct kni_cmsg *cmsg);
int kni_cmsg_serialize(struct kni_cmsg *cmsg, unsigned char *buff, uint16_t bufflen, uint16_t *serialize_len);
int kni_cmsg_deserialize(const unsigned char *data, uint16_t len, struct kni_cmsg** pcmsg);

View File

@@ -21,6 +21,7 @@
#define KNI_PATH_MAX 256
#define KNI_SYMBOL_MAX 64
#define KNI_DOMAIN_MAX 256
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
@@ -79,6 +80,8 @@ enum kni_field{
KNI_FIELD_INTCP_STM,
KNI_FIELD_SSL_STM,
KNI_FIELD_HTTP_STM,
KNI_FIELD_SENDLOG_SUCC,
KNI_FIELD_SENDLOG_FAIL,
KNI_FIELD_UNKNOWN_STM,
};
@@ -87,10 +90,12 @@ struct kni_field_stat_handle{
int fields[KNI_FIELD_MAX];
};
int kni_stream_addr_trans(struct ipaddr* addr, char *output, int len);
uint16_t kni_ip_checksum(const void *buf, size_t hdr_len);
uint16_t kni_tcp_checksum(const void *_buf, size_t len, in_addr_t src_addr, in_addr_t dest_addr);
uint16_t kni_udp_checksum(const void *_buf, size_t len, in_addr_t src_addr, in_addr_t dest_addr);
struct kni_tcpopt_info* kni_get_tcpopt(struct tcphdr* tcphdr,int tcphdr_len);
int kni_ipv4_addr_get_by_eth(const char *ifname, uint32_t *ip);
MESA_htable_handle kni_create_htable(const char *profile, const char *section, void *free_data_cb, void *expire_notify_cb, void *logger);

190
common/src/kni_cmsg.cpp Normal file
View File

@@ -0,0 +1,190 @@
#include "kni_utils.h"
#include "kni_cmsg.h"
struct kni_cmsg_tlv
{
uint16_t type;
uint16_t length;
unsigned char value_as_string[0];
} __attribute__((packed));
struct kni_cmsg
{
uint16_t nr_tlvs;
struct kni_cmsg_tlv* tlvs[KNI_CMSG_TLV_NR_MAX];
uint16_t size;
} __attribute__((packed));
struct kni_cmsg_serialize_header
{
uint8_t __magic__[2]; /* Must be 0x4d, 0x5a */
uint16_t nr_tlvs;
struct kni_cmsg_tlv tlvs[0];
} __attribute__((packed));
struct kni_cmsg* kni_cmsg_init()
{
struct kni_cmsg *cmsg = ALLOC(struct kni_cmsg, 1);
cmsg->size = sizeof(struct kni_cmsg_serialize_header);
return cmsg;
}
void kni_cmsg_destroy(struct kni_cmsg *cmsg)
{
if(cmsg != NULL)
{
for(int i = 0; i < KNI_CMSG_TLV_NR_MAX; i++)
{
FREE(&(cmsg->tlvs[i]));
}
}
FREE(&cmsg);
}
int kni_cmsg_set(struct kni_cmsg *cmsg, uint16_t type, const unsigned char *value, uint16_t size)
{
if(type >= KNI_CMSG_TLV_NR_MAX)
{
return KNI_CMSG_INVALID_TYPE;
}
struct kni_cmsg_tlv *tlv = cmsg->tlvs[type];
uint16_t length = sizeof(struct kni_cmsg_tlv) + size;
if(tlv == NULL)
{
tlv = (struct kni_cmsg_tlv*)ALLOC(char, length);
cmsg->nr_tlvs++;
cmsg->size += length;
}
tlv->type = type;
tlv->length = length;
memcpy(tlv->value_as_string, value, size);
cmsg->tlvs[type] = tlv;
return 0;
}
int kni_cmsg_get(struct kni_cmsg *cmsg, uint16_t type, uint16_t *size, unsigned char **pvalue)
{
struct kni_cmsg_tlv *tlv = NULL;
if(type >= KNI_CMSG_TLV_NR_MAX || (tlv = cmsg->tlvs[type]) == NULL)
{
*size = 0;
return KNI_CMSG_INVALID_TYPE;
}
*size = tlv->length - sizeof(struct kni_cmsg_tlv);
*pvalue = tlv->value_as_string;
return 0;
}
uint16_t kni_cmsg_serialize_size_get(struct kni_cmsg *cmsg)
{
return cmsg->size;
}
int kni_cmsg_serialize(struct kni_cmsg *cmsg, unsigned char *buff, uint16_t bufflen, uint16_t *serialize_len)
{
//size是serialize之后的实际长度
uint16_t size = cmsg->size;
//传入buff是否够长
if(bufflen < size)
{
return KNI_CMSG_BUFF_NOT_ENOUGH;
}
//size是否正确
if(size < sizeof(struct kni_cmsg_serialize_header))
{
return KNI_CMSG_INVALID_FORMAT;
}
struct kni_cmsg_serialize_header *header = (struct kni_cmsg_serialize_header*)buff;
header->__magic__[0] = 0x4d;
header->__magic__[1] = 0x5a;
header->nr_tlvs = htons(cmsg->nr_tlvs);
uint16_t offset = sizeof(struct kni_cmsg_serialize_header);
//检查nr_tlvs是否合法
int count = 0;
for(int i = 0; i < KNI_CMSG_TLV_NR_MAX; i++){
if(cmsg->tlvs[i] != NULL)
{
count++;
}
}
if(count != cmsg->nr_tlvs)
{
return KNI_CMSG_INVALID_FORMAT;
}
//序列化
for(int i = 0; i < KNI_CMSG_TLV_NR_MAX; i++)
{
struct kni_cmsg_tlv *tlv = cmsg->tlvs[i];
if(tlv == NULL)
{
continue;
}
if(i != tlv->type)
{
return KNI_CMSG_INVALID_FORMAT;
}
uint16_t length = tlv->length;
if(length < sizeof(struct kni_cmsg_tlv) || offset + length > size)
{
return KNI_CMSG_INVALID_FORMAT;
}
memcpy((char*)header + offset, (void*)tlv, length);
struct kni_cmsg_tlv *tlv1 = (struct kni_cmsg_tlv*)((char*)header + offset);
tlv1->type = htons(tlv->type);
tlv1->length = htons(tlv->length);
offset += length;
}
//检查size是否正确
if(offset != size)
{
return KNI_CMSG_INVALID_FORMAT;
}
*serialize_len = size;
return 0;
}
//反序列化
int kni_cmsg_deserialize(const unsigned char *data, uint16_t len, struct kni_cmsg** pcmsg)
{
struct kni_cmsg *cmsg = NULL;
struct kni_cmsg_serialize_header *header = (struct kni_cmsg_serialize_header*)data;
int offset = 0, nr_tlvs = -1;
if(len < sizeof(struct kni_cmsg_serialize_header))
{
goto error_out;
}
if(header->__magic__[0] != 0x4d || header->__magic__[1] != 0x5a)
{
goto error_out;
}
cmsg = ALLOC(struct kni_cmsg, 1);
offset = sizeof(struct kni_cmsg_serialize_header);
nr_tlvs = ntohs(header->nr_tlvs);
for(int i = 0; i < nr_tlvs; i++)
{
struct kni_cmsg_tlv *tlv = (struct kni_cmsg_tlv*)(data + offset);
if(offset + sizeof(struct kni_cmsg_tlv) > len)
{
goto error_out;
}
uint16_t type = ntohs(tlv->type);
uint16_t length = ntohs(tlv->length);
if(length < sizeof(struct kni_cmsg_tlv) || offset + length > len)
{
goto error_out;
}
int ret = kni_cmsg_set(cmsg, type, data + offset + sizeof(struct kni_cmsg_tlv), length - sizeof(struct kni_cmsg_tlv));
if(ret < 0)
{
goto error_out;
}
offset += length;
}
cmsg->size = offset;
*pcmsg = cmsg;
return 0;
error_out:
kni_cmsg_destroy(cmsg);
return KNI_CMSG_INVALID_FORMAT;
}

View File

@@ -1,4 +1,15 @@
#include "kni_utils.h"
#include <sys/ioctl.h>
#include <net/if.h>
int kni_stream_addr_trans(struct ipaddr* addr, char *output, int len){
char saddr[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &(addr->v4->saddr), saddr, INET_ADDRSTRLEN);
char daddr[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &(addr->v4->daddr), daddr, INET_ADDRSTRLEN);
snprintf(output, len, "%s:%d -> %s:%d", saddr, ntohs(addr->v4->source), daddr, ntohs(addr->v4->dest));
return 0;
}
uint16_t kni_ip_checksum(const void *buf, size_t hdr_len){
unsigned long sum = 0;
@@ -149,3 +160,96 @@ struct kni_tcpopt_info* kni_get_tcpopt(struct tcphdr* tcphdr,int tcphdr_len){
}
return tcpopt;
}
int kni_ipv4_addr_get_by_eth(const char *ifname, uint32_t *ip){
struct ifreq ifr;
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if(sockfd == -1) {
goto error_out;
}
strcpy(ifr.ifr_name, ifname);
if(ioctl(sockfd, SIOCGIFADDR, &ifr) < 0){
goto error_out;
}
*ip = ((struct sockaddr_in*)&(ifr.ifr_addr))->sin_addr.s_addr;
close(sockfd);
return 0;
error_out:
close(sockfd);
return -1;
}
static int __wrapper_MESA_htable_set_opt(MESA_htable_handle table, enum MESA_htable_opt opt_type, unsigned value, void *logger, const char *symbol)
{
int ret = MESA_htable_set_opt(table, opt_type, &value, (int)(sizeof(value)));
if(unlikely(ret != 0))
{
KNI_LOG_ERROR(logger, "Failed at MESA_htable_set_opt, htable is %s, opt_type is %d", symbol, opt_type);
}
return ret;
}
static int __wrapper_MESA_htable_set_opt(MESA_htable_handle table, enum MESA_htable_opt opt_type, void * val, size_t len, void *logger, const char *symbol)
{
int ret = MESA_htable_set_opt(table, opt_type, val, (int)len);
if(unlikely(ret != 0))
{
KNI_LOG_ERROR(logger, "Failed at MESA_htable_set_opt, htable is %s, opt_type is %d", symbol, opt_type);
}
return ret;
}
MESA_htable_handle kni_create_htable(const char *profile, const char *section, void *free_data_cb, void *expire_notify_cb, void *logger)
{
int mho_screen_print_ctrl;
int mho_thread_safe;
int mho_mutex_num;
int mho_hash_slot_size;
int mho_hash_max_element_num;
int mho_expire_time;
char mho_eliminate_type[KNI_SYMBOL_MAX];
MESA_load_profile_int_def(profile, section, "mho_screen_print_ctrl", &mho_screen_print_ctrl, 1);
MESA_load_profile_int_def(profile, section, "mho_thread_safe", &mho_thread_safe, 0);
MESA_load_profile_int_def(profile, section, "mho_mutex_num", &mho_mutex_num, 12);
MESA_load_profile_int_def(profile, section, "mho_hash_slot_size", &mho_hash_slot_size, 1234);
MESA_load_profile_int_def(profile, section, "mho_hash_max_element_num", &mho_hash_max_element_num, 12345);
MESA_load_profile_int_def(profile, section, "mho_expire_time", &mho_expire_time, 3600);
MESA_load_profile_string_def(profile, section, "mho_eliminate_type", mho_eliminate_type, sizeof(mho_eliminate_type), "FIFO");
KNI_LOG_INFO(logger, "MESA_prof_load, [%s]:\n mho_screen_print_ctrl: %d\n mho_thread_safe: %d\n mho_mutex_num: %d\n"
"mho_hash_slot_size: %d\n mho_hash_max_element_num: %d\n mho_expire_time: %d\n mho_eliminate_type: %s\n", section,
mho_screen_print_ctrl, mho_thread_safe, mho_mutex_num, mho_hash_slot_size, mho_hash_max_element_num, mho_expire_time, mho_eliminate_type);
MESA_htable_handle htable = MESA_htable_born();
if(htable == NULL)
{
KNI_LOG_ERROR(logger, "MESA_htable: failed at MESA_htable_born");
return NULL;
}
__wrapper_MESA_htable_set_opt(htable, MHO_SCREEN_PRINT_CTRL, mho_screen_print_ctrl, logger, section);
__wrapper_MESA_htable_set_opt(htable, MHO_THREAD_SAFE, mho_thread_safe, logger, section);
__wrapper_MESA_htable_set_opt(htable, MHO_MUTEX_NUM, mho_mutex_num, logger, section);
__wrapper_MESA_htable_set_opt(htable, MHO_HASH_SLOT_SIZE, mho_hash_slot_size, logger, section);
__wrapper_MESA_htable_set_opt(htable, MHO_HASH_MAX_ELEMENT_NUM, mho_hash_max_element_num, logger, section);
__wrapper_MESA_htable_set_opt(htable, MHO_EXPIRE_TIME, mho_expire_time, logger, section);
if(strncmp(mho_eliminate_type, "LRU", KNI_SYMBOL_MAX) == 0)
{
__wrapper_MESA_htable_set_opt(htable, MHO_ELIMIMINATE_TYPE, HASH_ELIMINATE_ALGO_LRU, logger, section);
}
else
{
__wrapper_MESA_htable_set_opt(htable, MHO_ELIMIMINATE_TYPE, HASH_ELIMINATE_ALGO_FIFO, logger, section);
}
__wrapper_MESA_htable_set_opt(htable, MHO_CBFUN_DATA_FREE,
(void *)free_data_cb, sizeof(free_data_cb), logger, section);
//ret = __wrapper_MESA_htable_set_opt(htable, MHO_CBFUN_DATA_EXPIRE_NOTIFY,
// (void *)key_keeper_verify_cb);
int ret = MESA_htable_mature(htable);
if(unlikely(ret != 0))
{
KNI_LOG_ERROR(logger, "MESA_htable: failed at MESA_htable_mature, htable is %s", section);
return NULL;
}
return htable;
}

49
common/test/test_cmsg.cpp Normal file
View File

@@ -0,0 +1,49 @@
#include "kni_utils.h"
#include "kni_cmsg.h"
int main(){
//init
struct kni_cmsg *cmsg = kni_cmsg_init();
//set
uint32_t value = 0x12345678;
int ret = kni_cmsg_set(cmsg, TFE_CMSG_TCP_RESTORE_SEQ, (const unsigned char*)(&value), 4);
printf("kni_cmsg_set: ret is %d\n", ret);
//get TCP_RESTORE_INFO_TLV_SEQ
uint16_t size = -1;
unsigned char *value1 = NULL;
ret = kni_cmsg_get(cmsg, TFE_CMSG_TCP_RESTORE_SEQ, &size, &value1);
printf("kni_cmsg_get: ret is %d, type is TCP_RESTORE_INFO_TLV_SEQ, value is 0x%02x, value_size is %d\n", ret, ((uint32_t*)value1)[0], size);
//get_serialize_size
size = kni_cmsg_serialize_size_get(cmsg);
printf("kni_cmsg_serialize_size_get: size is %d\n", size);
//serialize
unsigned char buff[size];
uint16_t serialize_len = -1;
ret = kni_cmsg_serialize(cmsg, buff, size, &serialize_len);
printf("kni_cmsg_serialize: ret is %d, serialize_len is %d, serialize result is: ", ret, serialize_len);
for(int i = 0; i < serialize_len; i++){
printf("%02x ", buff[i]);
}
printf("\n");
kni_cmsg_destroy(cmsg);
printf("kni_cmsg_destroy cmsg\n");
//deserialize
struct kni_cmsg *cmsg1 = NULL;
ret = kni_cmsg_deserialize(buff, serialize_len, &cmsg1);
printf("kni_cmsg_deserialize: ret is %d\n", ret);
//get TCP_RESTORE_INFO_TLV_SEQ
size = -1;
unsigned char *value2 = NULL;
ret = kni_cmsg_get(cmsg1, TFE_CMSG_TCP_RESTORE_SEQ, &size, &value2);
printf("kni_cmsg_get: ret is %d, type is TCP_RESTORE_INFO_TLV_SEQ, value is 0x%02x, value_size is %d\n", ret, ((uint32_t*)value2)[0], size);
kni_cmsg_destroy(cmsg1);
printf("kni_cmsg_destroy cmsg1\n");
}

12
common/test/test_uuid.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include <stdio.h>
#include "uuid/uuid.h"
int main(){
for(int i = 0; i < 10; i++){
uuid_t uu;
char buf[37];
uuid_generate_random(uu);
uuid_unparse(uu, buf);
printf("uuid is: %s\n", buf);
}
}

View File

@@ -1,20 +1,50 @@
[global]
log_path = ./log/kni/kni.log
log_level = 10
tfe_count = 1
local_eth = enp8s0
[maat]
readconf_mode = 1
readconf_mode = 2
tableinfo_path = ./conf/kni/maat_tableinfo.conf
maatjson_path = ./conf/kni/maat_test.json
redis_ip = 192.168.10.120
redis_port = 6390
redis_index = 4
tablename_intercept_ip = PXY_INTERCEPT_IP
tablename_intercept_domain = PXY_INTERCEPT_DOMAIN
compile_alias = COMPILE_ALIAS
[marsio]
appsym = knifw
dev_eth_symbol = eth4
dev_vxlan_symbol = vxlan_user
src_mac_addr = 00:0e:c6:d6:72:c1
[tfe0]
mac_addr = fe:65:b7:03:50:bd
dev_eth_symbol = ens1f5
[tfe1]
mac_addr = fe:65:b7:03:50:bd
dev_eth_symbol = eth8
[tfe2]
mac_addr = fe:65:b7:03:50:bd
dev_eth_symbol = eth9
[field_stat]
stat_path = ./fs2_kni.status
[send_logger]
switch = 1
kafka_topic = SESSION-RECORD-LOG
kafka_brokerlist = 192.168.10.121:9092,192.168.10.122:9092,192.168.10.123:9092
[kafka]
queue.buffering.max.messages = 1000000
topic.metadata.refresh.interval.ms = 600000
security.protocol = MG
[tfe_cmsg_receiver]
listen_eth = enp8s0
listen_port = 8888

View File

@@ -1,8 +1,8 @@
[PLUGINFO]
PLUGNAME = KNI
SO_PATH = ./plug/business/kni/libkni.so
SO_PATH = ./plug/business/kni/kni2.so
INIT_FUNC = kni_init
DESTROY_FUNC =
DESTROY_FUNC = kni_destroy
[TCP_ALL]
FUNC_FLAG = all

View File

@@ -1,3 +1,3 @@
add_library(kni SHARED src/kni_entry.cpp src/kni_maat.cpp)
add_library(kni SHARED src/kni_entry.cpp src/kni_maat.cpp src/kni_send_logger.cpp)
target_include_directories(kni PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
target_link_libraries(kni common MESA_prof_load MESA_field_stat maatframe marsio)
target_link_libraries(kni common MESA_prof_load MESA_htable MESA_field_stat maatframe marsio uuid cjson rdkafka)

View File

@@ -1,108 +0,0 @@
#define HTTP_PROJECT_NAME "kni_http_tag"
#define BURST_MAX 1
enum kni_protocol{
KNI_PROTOCOL_UNKNOWN = 0,
KNI_PROTOCOL_SSL,
KNI_PROTOCOL_HTTP,
};
struct http_project{
int host_len;
char host[KNI_DOMAIN_MAX];
};
struct pme_info{
int protocol;
int action;
struct kni_tcpopt_info *client_tcpopt;
struct kni_tcpopt_info *server_tcpopt;
};
struct wrapped_packet{
char data[KNI_MTU];
};
struct tcp_option_restore{
uint8_t kind;
uint8_t len;
uint16_t offset;
};
struct kni_marsio_handle{
struct mr_instance *instance;
struct mr_vdev *dev_eth_handler;
struct mr_vdev *dev_vxlan_handler;
struct mr_sendpath *dev_eth_sendpath;
struct mr_sendpath *dev_vxlan_sendpath;
};
struct protocol_identify_result{
int protocol;
char domain[KNI_DOMAIN_MAX];
int domain_len;
};
struct tfe_receiver_args{
void *logger;
struct kni_marsio_handle *marsio_handle;
};
//TODO: 有些字段可以不要
struct pkt_info{
struct iphdr *iphdr;
int iphdr_len;
int ip_totlen;
struct tcphdr *tcphdr;
int tcphdr_len;
char *data;
int data_len;
};
enum tcp_restore_info_tlv_type
{
TCP_RESTORE_INFO_TLV_SEQ,
TCP_RESTORE_INFO_TLV_ACK,
TCP_RESTORE_INFO_TLV_MSS_CLIENT,
TCP_RESTORE_INFO_TLV_MSS_SERVER,
TCP_RESTORE_INFO_TLV_WSACLE_CLIENT,
TCP_RESTORE_INFO_TLV_WSACLE_SERVER,
TCP_RESTORE_INFO_TLV_SACK_CLIENT,
TCP_RESTORE_INFO_TLV_SACK_SERVER,
TCP_RESTORE_INFO_TLV_TS_CLIENT,
TCP_RESTORE_INFO_TLV_TS_SERVER,
TCP_RESTORE_INFO_TLV_PROTOCOL,
TCP_RESTORE_INFO_TLV_USER_DEFINED
};
struct tcp_restore_info_tlv
{
uint16_t type;
uint16_t length;
union
{
uint8_t value_as_uint8[0];
uint16_t value_as_uint16[0];
uint32_t value_as_uint32[0];
unsigned char value_as_string[0];
};
} __attribute__((packed));
struct tcp_restore_info_header
{
uint8_t __magic__[2]; /* Must be 0x4d, 0x5a */
uint16_t nr_tlvs;
struct tcp_restore_info_tlv tlvs[0];
} __attribute__((packed));
struct kni_handle{
int http_project_id;
struct kni_marsio_handle *marsio_handle;
struct kni_maat_handle *maat_handle;
void *logger;
};
#define TCP_RESTORE_HEADER_MAX 128

View File

@@ -3,19 +3,15 @@
#define KNI_MAAT_READCONF_JSON 1
#define KNI_MAAT_READCONF_REDIS 2
#define KNI_MAAT_RULE_NUM_MAX 8
struct kni_maat_handle{
Maat_feather_t feather;
int tableid_intercept_ip;
int tableid_intercept_domain;
void *logger;
};
struct kni_maat_handle;
enum kni_action{
KNI_ACTION_UNKNOWN = 0,
KNI_ACTION_INTERCEPT,
KNI_ACTION_BYPASS,
};
struct kni_maat_handle* kni_maat_init(const char* profile, void *logger);
void kni_maat_destroy(struct kni_maat_handle *handle);
int kni_maat_scan_ip(struct kni_maat_handle* handle, struct ipaddr *addr, int thread_seq);
int kni_maat_scan_domain(struct kni_maat_handle* handle, char *domain, int domain_len, int thread_seq);
int kni_maat_scan_ip(struct kni_maat_handle* handle, struct ipaddr *addr, int thread_seq, int *policy_id);
int kni_maat_scan_domain(struct kni_maat_handle* handle, char *domain, int domain_len, int thread_seq, int *policy_id);

View File

@@ -0,0 +1,5 @@
struct kni_send_logger;
struct kni_send_logger* kni_send_logger_init(const char *profile, void *logger);
void kni_send_logger_destroy(struct kni_send_logger *handle);
int kni_send_logger_sendlog(kni_send_logger *handle, char *log_msg, int log_msg_len);

File diff suppressed because it is too large Load Diff

View File

@@ -2,8 +2,16 @@
#include "kni_maat.h"
extern int g_iThreadNum;
int g_maat_default_action = -1;
struct kni_maat_handle{
Maat_feather_t feather;
int tableid_intercept_ip;
int tableid_intercept_domain;
void *logger;
};
void kni_maat_destroy(struct kni_maat_handle *handle){
if(handle != NULL){
if(handle->feather != NULL){
@@ -42,76 +50,125 @@ struct kni_maat_handle* kni_maat_init(const char* profile, void *logger){
char tablename_intercept_ip[KNI_SYMBOL_MAX];
char tablename_intercept_domain[KNI_SYMBOL_MAX];
char compile_alias[KNI_SYMBOL_MAX];
MESA_load_profile_int_def(profile, section, "readconf_mode", &readconf_mode, KNI_MAAT_READCONF_IRIS);
MESA_load_profile_string_def(profile, section, "tableinfo_path", tableinfo_path, sizeof(tableinfo_path), "unknown");
MESA_load_profile_string_def(profile, section, "tablename_intercept_ip", tablename_intercept_ip, sizeof(tablename_intercept_ip), "unknown");
MESA_load_profile_string_def(profile, section, "tablename_intercept_domain", tablename_intercept_domain, sizeof(tablename_intercept_domain), "unknown");
MESA_load_profile_string_def(profile, section, "compile_alias", compile_alias, sizeof(compile_alias), "unknown");
char maatjson_path[KNI_PATH_MAX];
char redis_ip[INET_ADDRSTRLEN];
int redis_port;
int redis_index;
Maat_feather_t feather = NULL;
int tableid_intercept_ip = -1;
int tableid_intercept_domain = -1;
struct kni_maat_handle *handle = NULL;
int ret = MESA_load_profile_int_nodef(profile, section, "readconf_mode", &readconf_mode);
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: readconf_mode not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "tableinfo_path", tableinfo_path, sizeof(tableinfo_path));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: tableinfo_path not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "tablename_intercept_ip", tablename_intercept_ip, sizeof(tablename_intercept_ip));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: tablename_intercept_ip not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "tablename_intercept_domain", tablename_intercept_domain, sizeof(tablename_intercept_domain));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: tablename_intercept_domain not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "compile_alias", compile_alias, sizeof(compile_alias));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: compile_alias not set, profile is %s, section is %s", profile, section);
goto error_out;
}
KNI_LOG_INFO(logger, "MESA_prof_load, [%s]:\n readconf_mode: %d\n tableinfo_path: %s\n tablename_intercept_ip: %s\n tablename_intercept_domain: %s\n"
"compile_alias: %s\n", section, readconf_mode, tableinfo_path, tablename_intercept_ip, tablename_intercept_domain, compile_alias);
Maat_feather_t feather = Maat_feather(g_iThreadNum, tableinfo_path, logger);
feather = Maat_feather(g_iThreadNum, tableinfo_path, logger);
handle = ALLOC(struct kni_maat_handle, 1);
handle->feather = feather;
if(feather == NULL){
KNI_LOG_ERROR(logger, "Failed at Maat_feather, max_thread_num is %d, tableinfo_path is %s", g_iThreadNum, tableinfo_path);
return NULL;
}
if(readconf_mode == KNI_MAAT_READCONF_JSON){
char maatjson_path[KNI_PATH_MAX];
MESA_load_profile_string_def(profile, section, "maatjson_path", maatjson_path, sizeof(maatjson_path), "unknown");
switch(readconf_mode){
case KNI_MAAT_READCONF_JSON:
ret = MESA_load_profile_string_nodef(profile, section, "maatjson_path", maatjson_path, sizeof(maatjson_path));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: maatjson_path not set, profile is %s, section is %s", profile, section);
goto error_out;
}
KNI_LOG_INFO(logger, "MESA_prof_load, [%s]:\n maatjson_path: %s", section, maatjson_path);
Maat_set_feather_opt(feather, MAAT_OPT_JSON_FILE_PATH, maatjson_path, strlen(maatjson_path));
break;
case KNI_MAAT_READCONF_IRIS:
break;
case KNI_MAAT_READCONF_REDIS:
ret = MESA_load_profile_string_nodef(profile, section, "redis_ip", redis_ip, sizeof(redis_ip));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: redis_ip not set, profile is %s, section is %s", profile, section);
goto error_out;
}
if(readconf_mode == KNI_MAAT_READCONF_IRIS){
//TODO
ret = MESA_load_profile_int_nodef(profile, section, "redis_port", &redis_port);
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: redis_port not set, profile is %s, section is %s", profile, section);
goto error_out;
}
if(readconf_mode == KNI_MAAT_READCONF_REDIS){
char redis_ip[KNI_SYMBOL_MAX];
int redis_port;
int redis_index;
MESA_load_profile_string_def(profile, section, "redis_ip", redis_ip, sizeof(redis_ip), "unknown");
MESA_load_profile_int_def(profile, section, "redis_port", &redis_port, -1);
MESA_load_profile_int_def(profile, section, "redis_index", &redis_index, -1);
KNI_LOG_INFO(logger, "MESA_prof_load, [%s]:\n redis_ip: %s\n redis_port: %s\n redis_index: %d",
ret = MESA_load_profile_int_nodef(profile, section, "redis_index", &redis_index);
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: redis_index not set, profile is %s, section is %s", profile, section);
goto error_out;
}
KNI_LOG_INFO(logger, "MESA_prof_load, [%s]:\n redis_ip: %s\n redis_port: %d\n redis_index: %d",
section, redis_ip, redis_port, redis_index);
Maat_set_feather_opt(feather, MAAT_OPT_REDIS_IP, (void*)redis_ip, strlen(redis_ip) + 1);
Maat_set_feather_opt(feather, MAAT_OPT_REDIS_PORT, (void*)&redis_port, sizeof(redis_port));
Maat_set_feather_opt(feather, MAAT_OPT_REDIS_INDEX, (void*)&redis_index, sizeof(redis_index));
break;
default:
break;
}
int ret = Maat_initiate_feather(feather);
ret = Maat_initiate_feather(feather);
if(ret < 0){
KNI_LOG_ERROR(logger, "Failed at Maat_initiate_feather");
return NULL;
goto error_out;
}
int tableid_intercept_ip = Maat_table_register(feather, tablename_intercept_ip);
int tableid_intercept_domain = Maat_table_register(feather, tablename_intercept_domain);
tableid_intercept_ip = Maat_table_register(feather, tablename_intercept_ip);
tableid_intercept_domain = Maat_table_register(feather, tablename_intercept_domain);
if(tableid_intercept_ip < 0){
KNI_LOG_ERROR(logger, "Failed at Maat_table_register, tablename is %d, ret is %d",
tablename_intercept_ip, tableid_intercept_ip);
return NULL;
goto error_out;
}
if(tableid_intercept_domain < 0){
KNI_LOG_ERROR(logger, "Failed at Maat_table_register, tablename is %d, ret is %d",
tablename_intercept_domain, tableid_intercept_domain);
return NULL;
goto error_out;
}
struct kni_maat_handle *handle = ALLOC(struct kni_maat_handle, 1);
ret = Maat_rule_get_ex_new_index(feather, compile_alias, compile_ex_param_new, compile_ex_param_free, compile_ex_param_dup, 0, logger);
if(ret < 0){
KNI_LOG_ERROR(logger, "Failed at Maat_rule_get_ex_new_index, ret is %d", ret);
kni_maat_destroy(handle);
return NULL;
goto error_out;
}
handle->feather = feather;
handle->tableid_intercept_ip = tableid_intercept_ip;
handle->tableid_intercept_domain = tableid_intercept_domain;
handle->logger = logger;
return handle;
error_out:
kni_maat_destroy(handle);
return NULL;
}
static int maat_process_scan_result(struct kni_maat_handle *handle, int num, struct Maat_rule_t *result){
static int maat_process_scan_result(struct kni_maat_handle *handle, int num, struct Maat_rule_t *result, int *policy_id){
//void *logger = handle->logger;
int action = g_maat_default_action;
*policy_id = 0; //默认动作是编译表中policy_id=0的字段所以默认policy_id=0;
for(int i = 0; i < num; i++){
action = result[i].action;
*policy_id = result[i].config_id;
if(action == KNI_ACTION_BYPASS){
return action;
}
@@ -121,7 +178,7 @@ static int maat_process_scan_result(struct kni_maat_handle *handle, int num, str
//TODO: Maat_rule_get_ex_new_index compile_ex_param_new: config_id = 0, 取action即为全局变量, 一旦配置更新就回调, tableinfo怎么写回调表 编译配置表
int kni_maat_scan_ip(struct kni_maat_handle *handle, struct ipaddr *addr, int thread_seq){
int kni_maat_scan_ip(struct kni_maat_handle *handle, struct ipaddr *addr, int thread_seq, int *policy_id){
//printf("default action is %d\n", g_maat_default_action);
void *logger = handle->logger;
struct Maat_rule_t result[KNI_MAAT_RULE_NUM_MAX];
@@ -132,17 +189,17 @@ int kni_maat_scan_ip(struct kni_maat_handle *handle, struct ipaddr *addr, int th
KNI_LOG_ERROR(logger, "Failed at Maat_scan_proto_addr, ret is %d", ret);
return g_maat_default_action;
}
int action = maat_process_scan_result(handle, ret, result);
int action = maat_process_scan_result(handle, ret, result, policy_id);
//for debug
char saddr[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &(addr->v4->saddr), saddr, INET_ADDRSTRLEN);
KNI_LOG_DEBUG(logger, "ip is %s, ret is %d, action is %d\n", saddr, ret, action);
char stream_addr[KNI_SYMBOL_MAX] = "";
kni_stream_addr_trans(addr, stream_addr, sizeof(stream_addr));
KNI_LOG_DEBUG(logger, "maat_scan_ip, %s, policy_id = %d, action = %s\n",
stream_addr, *policy_id, action == KNI_ACTION_BYPASS ? "bypss" : "intercept");
return action;
}
int kni_maat_scan_domain(struct kni_maat_handle* handle, char *domain, int domain_len, int thread_seq){
int kni_maat_scan_domain(struct kni_maat_handle* handle, char *domain, int domain_len, int thread_seq, int *policy_id){
void *logger = handle->logger;
struct Maat_rule_t result[KNI_MAAT_RULE_NUM_MAX];
//必须要初始化为NULL, 不懂为什么
@@ -153,14 +210,14 @@ int kni_maat_scan_domain(struct kni_maat_handle* handle, char *domain, int domai
KNI_LOG_ERROR(logger, "Failed at Maat_full_scan_string, ret is %d", ret);
return g_maat_default_action;
}
int action = maat_process_scan_result(handle, ret, result);
int action = maat_process_scan_result(handle, ret, result, policy_id);
//for debug
char domain1[100] = "";
memcpy(domain1, domain, domain_len);
domain1[domain_len] = '\0';
KNI_LOG_DEBUG(logger, "domain is %s, ret is %d, action is %d\n", domain, ret, action);
KNI_LOG_DEBUG(logger, "maat_scan_domain: %s, policy_id = %d, action = %s\n",
domain, *policy_id, action == KNI_ACTION_BYPASS ? "bypss" : "intercept");
return action;
}

View File

@@ -0,0 +1,149 @@
#include "kni_utils.h"
#include "kni_send_logger.h"
#include "librdkafka/rdkafka.h"
struct kni_send_logger{
int sendlog_switch;
rd_kafka_t *kafka_handle;
rd_kafka_topic_t *kafka_topic;
void *local_logger;
};
static rd_kafka_t* kafka_init(const char *profile, void *logger){
rd_kafka_t *kafka_handle = NULL;
rd_kafka_conf_t *rdkafka_conf = NULL;
char kafka_errstr[1024];
const char *section = "kafka";
char queue_buffering_max_messages[KNI_SYMBOL_MAX] = "";
char topic_metadata_refresh_interval_ms[KNI_SYMBOL_MAX] = "";
char security_protocol[KNI_SYMBOL_MAX] = "";
int ret = MESA_load_profile_string_nodef(profile, section, "queue.buffering.max.messages",
queue_buffering_max_messages, sizeof(queue_buffering_max_messages));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: queue.buffering.max.messages not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "topic.metadata.refresh.interval.ms",
topic_metadata_refresh_interval_ms, sizeof(topic_metadata_refresh_interval_ms));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: topic.metadata.refresh.interval.ms not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "security.protocol", security_protocol, sizeof(security_protocol));
if(ret < 0){
KNI_LOG_ERROR(logger, "MESA_prof_load: security.protocol not set, profile is %s, section is %s", profile, section);
goto error_out;
}
KNI_LOG_INFO(logger, "MESA_prof_load, [%s]:\n queue.buffering.max.messages: %s\n topic.metadata.refresh.interval.ms: %s\n"
"security.protocol: %s", "kafka", queue_buffering_max_messages, topic_metadata_refresh_interval_ms, security_protocol);
rdkafka_conf = rd_kafka_conf_new();
rd_kafka_conf_set(rdkafka_conf, "queue.buffering.max.messages", queue_buffering_max_messages, kafka_errstr, sizeof(kafka_errstr));
rd_kafka_conf_set(rdkafka_conf, "topic.metadata.refresh.interval.ms", topic_metadata_refresh_interval_ms, kafka_errstr, sizeof(kafka_errstr));
rd_kafka_conf_set(rdkafka_conf, "security.protocol", security_protocol, kafka_errstr, sizeof(kafka_errstr));
//The conf object is freed by this function and must not be used or destroyed by the application sub-sequently.
kafka_handle = rd_kafka_new(RD_KAFKA_PRODUCER, rdkafka_conf, kafka_errstr, sizeof(kafka_errstr));
rdkafka_conf = NULL;
if(kafka_handle == NULL){
goto error_out;
}
return kafka_handle;
error_out:
if(rdkafka_conf != NULL){
rd_kafka_conf_destroy(rdkafka_conf);
rdkafka_conf = NULL;
}
if(kafka_handle != NULL){
rd_kafka_destroy(kafka_handle);
kafka_handle = NULL;
}
return NULL;
}
void kni_send_logger_destroy(struct kni_send_logger *handle){
if(handle != NULL){
if(handle->kafka_topic != NULL){
rd_kafka_topic_destroy(handle->kafka_topic);
handle->kafka_topic = NULL;
}
if(handle->kafka_handle != NULL){
rd_kafka_destroy(handle->kafka_handle);
handle->kafka_handle = NULL;
}
FREE(&handle);
}
}
struct kni_send_logger* kni_send_logger_init(const char *profile, void *local_logger){
struct kni_send_logger *handle = NULL;
const char *section = "send_logger";
int sendlog_switch = -1;
char kafka_topic[KNI_SYMBOL_MAX] = "";
char kafka_brokerlist[KNI_SYMBOL_MAX] = "";
rd_kafka_t *kafka_handle = NULL;
rd_kafka_topic_t *topic = NULL;
int ret = MESA_load_profile_int_nodef(profile, section, "switch", &sendlog_switch);
if(ret < 0){
KNI_LOG_ERROR(local_logger, "MESA_prof_load: switch not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "kafka_topic", kafka_topic, sizeof(kafka_topic));
if(ret < 0){
KNI_LOG_ERROR(local_logger, "MESA_prof_load: kafka_topic not set, profile is %s, section is %s", profile, section);
goto error_out;
}
ret = MESA_load_profile_string_nodef(profile, section, "kafka_brokerlist", kafka_brokerlist, sizeof(kafka_brokerlist));
if(ret < 0){
KNI_LOG_ERROR(local_logger, "MESA_prof_load: kafka_brokerlist not set, profile is %s, section is %s", profile, section);
goto error_out;
}
KNI_LOG_INFO(local_logger, "MESA_prof_load, [%s]:\n switch: %d\n kafka_topic: %s\n, kafka_brokerlist: %s",
section, sendlog_switch, kafka_topic, kafka_brokerlist);
handle = ALLOC(struct kni_send_logger, 1);
handle->local_logger = local_logger;
//sendlog_switch = 0, 不发送日志给kafka
if(sendlog_switch == 0){
handle->sendlog_switch = 0;
return handle;
}
handle->sendlog_switch = 1;
//init kafka
kafka_handle = kafka_init(profile, local_logger);
if(kafka_handle == NULL){
KNI_LOG_ERROR(local_logger, "Failed at init kafka");
goto error_out;
}
handle->kafka_handle = kafka_handle;
//kafka_brokerlist
ret = rd_kafka_brokers_add(kafka_handle, kafka_brokerlist);
if(ret == 0){
KNI_LOG_ERROR(local_logger, "Failed at add kafka_brokers");
goto error_out;
}
//kafka topic
topic = rd_kafka_topic_new(kafka_handle, kafka_topic, NULL);
if(topic == NULL){
KNI_LOG_ERROR(local_logger, "Failed at new kafka topic");
goto error_out;
}
handle->kafka_topic = topic;
return handle;
error_out:
kni_send_logger_destroy(handle);
return NULL;
}
int kni_send_logger_sendlog(kni_send_logger *handle, char *log_msg, int log_msg_len){
void *logger = handle->local_logger;
//kafka produce
int kafka_status = rd_kafka_produce(handle->kafka_topic, RD_KAFKA_PARTITION_UA, RD_KAFKA_MSG_F_COPY,
log_msg, log_msg_len, NULL, 0, NULL);
if(kafka_status < 0){
KNI_LOG_ERROR(logger, "Kafka: Failed to produce, error is %s", rd_kafka_err2name(rd_kafka_last_error()));
return -1;
}
return 0;
}

View File

@@ -1,7 +1,7 @@
SAPP_RUN="/home/tsg/kni"
/bin/cp -f ../conf/sapp/conflist_business.inf $SAPP_RUN/plug/business/conflist_business.inf
/bin/cp -rf ../conf/sapp/kni/ $SAPP_RUN/plug/business
/bin/cp -f ../build/entry/libkni.so $SAPP_RUN/plug/business/kni/libkni.so
/bin/cp -f ../build/entry/libkni.so $SAPP_RUN/plug/business/kni/kni2.so
mkdir -p $SAPP_RUN/conf/kni
/bin/cp -f ../conf/kni.conf $SAPP_RUN/conf/kni/kni.conf

26
vendor/CMakeLists.txt vendored
View File

@@ -3,12 +3,13 @@
include(ExternalProject)
### cJSON
### cJSON: 注意: -DCMAKE_POSITION_INDEPENDENT_CODE=ON
ExternalProject_Add(cJSON PREFIX cJSON
URL ${CMAKE_CURRENT_SOURCE_DIR}/cJSON-1.7.7.tar.gz
URL_MD5 715009c99728bf81d6c97352718650ff
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DBUILD_SHARED_AND_STATIC_LIBS=1)
ExternalProject_Get_Property(cJSON INSTALL_DIR)
@@ -20,6 +21,25 @@ set_property(TARGET cjson PROPERTY IMPORTED_LOCATION ${INSTALL_DIR}/lib64/libcjs
set_property(TARGET cjson PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
### libUUID 注意: --enable-shared --with-pic
ExternalProject_Add(libUUID PREFIX libUUID
URL ${CMAKE_CURRENT_SOURCE_DIR}/libuuid-1.0.3.tar.gz
URL_MD5 d44d866d06286c08ba0846aba1086d68
CONFIGURE_COMMAND cd ../libUUID && ./configure --prefix=<INSTALL_DIR> --enable-shared --with-pic
BUILD_COMMAND cd ../libUUID && make
INSTALL_COMMAND cd ../libUUID && make install)
ExternalProject_Get_Property(libUUID INSTALL_DIR)
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
add_library(uuid SHARED IMPORTED GLOBAL)
add_dependencies(uuid libUUID)
set_property(TARGET uuid PROPERTY IMPORTED_LOCATION ${INSTALL_DIR}/lib/libuuid.a)
set_property(TARGET uuid PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include)
### MESA Framework
set(MESA_FRAMEWORK_LIB_DIR /opt/MESA/lib)
set(MESA_FRAMEWORK_INCLUDE_DIR /opt/MESA/include)
@@ -47,3 +67,7 @@ set_property(TARGET maatframe PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MESA_FRAM
add_library(MESA_field_stat SHARED IMPORTED GLOBAL)
set_property(TARGET MESA_field_stat PROPERTY IMPORTED_LOCATION ${MESA_FRAMEWORK_LIB_DIR}/libMESA_field_stat2.so)
set_property(TARGET MESA_field_stat PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MESA_FRAMEWORK_INCLUDE_DIR})
add_library(rdkafka SHARED IMPORTED GLOBAL)
set_property(TARGET rdkafka PROPERTY IMPORTED_LOCATION ${MESA_FRAMEWORK_LIB_DIR}/librdkafka.so)
set_property(TARGET rdkafka PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MESA_FRAMEWORK_INCLUDE_DIR})

BIN
vendor/libuuid-1.0.3.tar.gz vendored Normal file

Binary file not shown.