🔧 build(compile Werror): reduce warning
This commit is contained in:
@@ -9,6 +9,11 @@ add_definitions(-D_GNU_SOURCE)
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_C_STANDARD 11)
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
|
||||||
|
#set warning as error
|
||||||
|
add_compile_options(-Wall -Wextra -Werror
|
||||||
|
-Wno-error=implicit-fallthrough
|
||||||
|
-Wno-error=unused-parameter)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
set(CMAKE_BUILD_TYPE RelWithDebInfo)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
10
deps/dablooms/dablooms.cpp
vendored
10
deps/dablooms/dablooms.cpp
vendored
@@ -189,16 +189,8 @@ int bitmap_check(bitmap_t *bitmap, unsigned int index, long offset)
|
|||||||
|
|
||||||
int bitmap_flush(bitmap_t *bitmap)
|
int bitmap_flush(bitmap_t *bitmap)
|
||||||
{
|
{
|
||||||
#if 0
|
if(bitmap==NULL)return -1;
|
||||||
if ((msync(bitmap->array, bitmap->bytes, MS_SYNC) < 0)) {
|
|
||||||
perror("Error, flushing bitmap to disk");
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ struct id_generator
|
|||||||
uint64_t thread_volatile[MAX_THREAD_NUM];
|
uint64_t thread_volatile[MAX_THREAD_NUM];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct id_generator global_id_generator = {0};
|
struct id_generator global_id_generator = {};
|
||||||
|
|
||||||
// return 0: success
|
// return 0: success
|
||||||
// return -1: failed
|
// return -1: failed
|
||||||
|
|||||||
@@ -911,7 +911,7 @@ struct packet *ipv4_reassembly_packet(struct ip_reassembly *assy, const struct p
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ip_flow_key key = {0};
|
struct ip_flow_key key = {};
|
||||||
uint64_t src_addr = hdr->ip_src.s_addr;
|
uint64_t src_addr = hdr->ip_src.s_addr;
|
||||||
uint64_t dst_addr = hdr->ip_dst.s_addr;
|
uint64_t dst_addr = hdr->ip_dst.s_addr;
|
||||||
key.src_dst_addr[0] = src_addr << 32 | dst_addr;
|
key.src_dst_addr[0] = src_addr << 32 | dst_addr;
|
||||||
@@ -1004,7 +1004,7 @@ struct packet *ipv6_reassembly_packet(struct ip_reassembly *assy, const struct p
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ip_flow_key key = {0};
|
struct ip_flow_key key = {};
|
||||||
memcpy(&key.src_dst_addr[0], hdr->ip6_src.s6_addr, 16);
|
memcpy(&key.src_dst_addr[0], hdr->ip6_src.s6_addr, 16);
|
||||||
memcpy(&key.src_dst_addr[2], hdr->ip6_dst.s6_addr, 16);
|
memcpy(&key.src_dst_addr[2], hdr->ip6_dst.s6_addr, 16);
|
||||||
key.src_dst_len = IPV6_KEYLEN;
|
key.src_dst_len = IPV6_KEYLEN;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ struct log_context
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct log_context g_log_context = {
|
struct log_context g_log_context = {
|
||||||
.config = {.output = LOG_OUTPUT_STDERR, .level = LOG_DEBUG},
|
.config = {},
|
||||||
.log_fd = -1,
|
.log_fd = -1,
|
||||||
.log_file_reopen_day = 0,
|
.log_file_reopen_day = 0,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ static void calculate_length_and_checksum(const struct packet *origin_pkt, int l
|
|||||||
struct gre1_hdr *gre1 = NULL;
|
struct gre1_hdr *gre1 = NULL;
|
||||||
struct raw_layer *curr_layer = NULL;
|
struct raw_layer *curr_layer = NULL;
|
||||||
struct raw_layer *last_layer = NULL;
|
struct raw_layer *last_layer = NULL;
|
||||||
struct fingerprint finger = {0};
|
struct fingerprint finger = {};
|
||||||
calc_packet_fingerprint(&finger);
|
calc_packet_fingerprint(&finger);
|
||||||
for (int i = layer_count - 1; i >= 0; i--)
|
for (int i = layer_count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ int packet_dump_pcap(const struct packet *pkt, const char *file)
|
|||||||
const char *data = packet_get_raw_data(pkt);
|
const char *data = packet_get_raw_data(pkt);
|
||||||
uint16_t len = packet_get_raw_len(pkt);
|
uint16_t len = packet_get_raw_len(pkt);
|
||||||
|
|
||||||
struct pcap_pkt_hdr pkt_hdr = {0};
|
struct pcap_pkt_hdr pkt_hdr = {};
|
||||||
struct pcap_file_hdr file_hdr = {
|
struct pcap_file_hdr file_hdr = {
|
||||||
.magic = 0xA1B2C3D4,
|
.magic = 0xA1B2C3D4,
|
||||||
.version_major = 0x0002,
|
.version_major = 0x0002,
|
||||||
@@ -60,7 +60,7 @@ int packet_dump_pcap(const struct packet *pkt, const char *file)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct timeval ts = {0};
|
struct timeval ts = {};
|
||||||
gettimeofday(&ts, NULL);
|
gettimeofday(&ts, NULL);
|
||||||
|
|
||||||
pkt_hdr.tv_sec = ts.tv_sec;
|
pkt_hdr.tv_sec = ts.tv_sec;
|
||||||
|
|||||||
@@ -28,10 +28,9 @@ struct marsio_io
|
|||||||
|
|
||||||
static void metadata_from_mbuff_to_packet(marsio_buff_t *mbuff, struct packet *pkt)
|
static void metadata_from_mbuff_to_packet(marsio_buff_t *mbuff, struct packet *pkt)
|
||||||
{
|
{
|
||||||
struct route_ctx route_ctx = {0};
|
struct route_ctx route_ctx = {};
|
||||||
struct sids sids = {0};
|
struct sids sids = {};
|
||||||
uint64_t session_id = {0};
|
uint64_t session_id = {0};
|
||||||
uint64_t domain = {0};
|
|
||||||
uint16_t link_id = {0};
|
uint16_t link_id = {0};
|
||||||
int is_ctrl = {0};
|
int is_ctrl = {0};
|
||||||
enum packet_direction direction = PACKET_DIRECTION_OUTGOING;
|
enum packet_direction direction = PACKET_DIRECTION_OUTGOING;
|
||||||
@@ -107,7 +106,7 @@ static void metadata_from_packet_to_mbuff(struct packet *pkt, marsio_buff_t *mbu
|
|||||||
const struct route_ctx *route_ctx = packet_get_route_ctx(pkt);
|
const struct route_ctx *route_ctx = packet_get_route_ctx(pkt);
|
||||||
const struct sids *sids = packet_get_sids(pkt);
|
const struct sids *sids = packet_get_sids(pkt);
|
||||||
uint64_t session_id = packet_get_session_id(pkt);
|
uint64_t session_id = packet_get_session_id(pkt);
|
||||||
uint64_t domain = packet_get_domain(pkt);
|
//uint64_t domain = packet_get_domain(pkt);
|
||||||
uint16_t link_id = packet_get_link_id(pkt);
|
uint16_t link_id = packet_get_link_id(pkt);
|
||||||
int is_ctrl = packet_is_ctrl(pkt);
|
int is_ctrl = packet_is_ctrl(pkt);
|
||||||
enum packet_direction direction = packet_get_direction(pkt);
|
enum packet_direction direction = packet_get_direction(pkt);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ struct session_exdata_manager
|
|||||||
uint8_t count;
|
uint8_t count;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct session_exdata_manager g_ex_manager = {0};
|
static struct session_exdata_manager g_ex_manager = {};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* session set/get
|
* session set/get
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
|
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ struct session_manager_options opts = {
|
|||||||
|
|
||||||
// udp timeout
|
// udp timeout
|
||||||
.udp_data_timeout = 8,
|
.udp_data_timeout = 8,
|
||||||
|
.udp_discard_timeout = 0,
|
||||||
|
|
||||||
// duplicate packet filter
|
// duplicate packet filter
|
||||||
.duplicated_packet_filter_enable = 1,
|
.duplicated_packet_filter_enable = 1,
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ int stellar_config_load(struct stellar_config *config, const char *file)
|
|||||||
char errbuf[200];
|
char errbuf[200];
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
toml_table_t *table = NULL;
|
toml_table_t *table = NULL;
|
||||||
memset(config, 0, sizeof(*config));
|
//memset(config, 0, sizeof(struct stellar_config));
|
||||||
|
|
||||||
fp = fopen(file, "r");
|
fp = fopen(file, "r");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ static void stellar_thread_join(struct stellar_runtime *runtime, struct stellar_
|
|||||||
|
|
||||||
int stellar_run(int argc, char **argv)
|
int stellar_run(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static struct stellar st = {0};
|
static struct stellar st={};
|
||||||
struct stellar_runtime *runtime = &st.runtime;
|
struct stellar_runtime *runtime = &st.runtime;
|
||||||
struct stellar_config *config = &st.config;
|
struct stellar_config *config = &st.config;
|
||||||
|
|
||||||
|
|||||||
@@ -279,8 +279,13 @@ static void usage(char *cmd)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int opt = 0;
|
int opt = 0;
|
||||||
|
<<<<<<< HEAD
|
||||||
struct runtime rte = {0};
|
struct runtime rte = {0};
|
||||||
while ((opt = getopt(argc, argv, "f:tvh")) != -1)
|
while ((opt = getopt(argc, argv, "f:tvh")) != -1)
|
||||||
|
=======
|
||||||
|
struct runtime rte = {};
|
||||||
|
while ((opt = getopt(argc, argv, "f:tvch")) != -1)
|
||||||
|
>>>>>>> 654eee3 (🔧 build(compile Werror): reduce warning)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user