diff --git a/src/core/main.cpp b/src/core/main.cpp index e4ab67b..aee1368 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -10,25 +10,25 @@ static void signal_handler(int signo) { if (signo == SIGINT) { - printf("SIGINT received, notify threads to exit"); + printf("SIGINT received, notify threads to exit\n"); stellar_loopbreak(st); } if (signo == SIGQUIT) { - printf("SIGQUIT received, notify threads to exit"); + printf("SIGQUIT received, notify threads to exit\n"); stellar_loopbreak(st); } if (signo == SIGTERM) { - printf("SIGTERM received, notify threads to exit"); + printf("SIGTERM received, notify threads to exit\n"); stellar_loopbreak(st); } if (signo == SIGHUP) { - printf("SIGHUP received, reload log level !!!"); + printf("SIGHUP received, reload log level\n"); stellar_reload_log_level(st); } } diff --git a/src/core/stellar_core.cpp b/src/core/stellar_core.cpp index e61893c..824e079 100644 --- a/src/core/stellar_core.cpp +++ b/src/core/stellar_core.cpp @@ -464,7 +464,6 @@ static void stellar_thread_join(struct stellar *st) struct stellar_runtime *runtime = &st->runtime; struct stellar_config *config = &st->config; - STELLAR_LOG_FATAL("wait worker thread exit ..."); for (uint16_t i = 0; i < config->pkt_io_opts.nr_threads; i++) { struct stellar_thread *thread = &runtime->threads[i]; @@ -511,7 +510,7 @@ struct stellar *stellar_new(const char *stellar_cfg_file, const char *plugin_cfg STELLAR_LOG_ERROR("unable to init log"); goto error_out; } - STELLAR_LOG_FATAL("start stellar (version: %s)\n %s", version, logo_str); + STELLAR_LOG_FATAL("stellar start (version: %s)\n %s", version, logo_str); STELLAR_LOG_FATAL("stellar config file : %s", st->stellar_cfg_file); STELLAR_LOG_FATAL("plugin config file : %s", st->plugin_cfg_file); STELLAR_LOG_FATAL("log config file : %s", st->log_cfg_file); @@ -596,8 +595,8 @@ void stellar_run(struct stellar *st) // only available in dump file mode, automatically exits when all sessions have been released if (packet_io_isbreak(runtime->packet_io) && all_session_have_freed(runtime, config)) { - stellar_stat_output(runtime->stat); // flush stat STELLAR_LOG_FATAL("all sessions have been released, notify threads to exit"); + stellar_stat_output(runtime->stat); // flush stat ATOMIC_SET(&runtime->need_exit, 1); } } diff --git a/src/packet_io/dumpfile_io.cpp b/src/packet_io/dumpfile_io.cpp index 88f6346..0a6fb6d 100644 --- a/src/packet_io/dumpfile_io.cpp +++ b/src/packet_io/dumpfile_io.cpp @@ -221,7 +221,7 @@ static void *dumpfile_thread(void *arg) FILE *fp = NULL; if (strcmp(handle->dumpfile_path, "-") == 0) { - PACKET_IO_LOG_ERROR("dumpfile list is empty"); + PACKET_IO_LOG_ERROR("dumpfile list is empty, read from stdin"); fp = stdin; } else @@ -255,10 +255,9 @@ static void *dumpfile_thread(void *arg) fclose(fp); } } + PACKET_IO_LOG_FATAL("dumpfile io thread read all pcap files"); erro_out: - PACKET_IO_LOG_FATAL("dumpfile io thread processed all pcap files"); - while (ATOMIC_READ(&handle->io_thread_need_exit) == 0) { if (all_packet_processed(handle)) diff --git a/src/tcp_reassembly/CMakeLists.txt b/src/tcp_reassembly/CMakeLists.txt index b5caf6f..0fa35a7 100644 --- a/src/tcp_reassembly/CMakeLists.txt +++ b/src/tcp_reassembly/CMakeLists.txt @@ -1,6 +1,7 @@ add_library(tcp_reassembly tcp_reassembly.cpp) target_include_directories(tcp_reassembly PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(tcp_reassembly PUBLIC ${CMAKE_SOURCE_DIR}/deps/list) +target_include_directories(tcp_reassembly PUBLIC ${CMAKE_SOURCE_DIR}/include) target_link_libraries(tcp_reassembly interval_tree log) add_subdirectory(test) \ No newline at end of file diff --git a/src/tcp_reassembly/tcp_reassembly.cpp b/src/tcp_reassembly/tcp_reassembly.cpp index c0e180e..0b6f571 100644 --- a/src/tcp_reassembly/tcp_reassembly.cpp +++ b/src/tcp_reassembly/tcp_reassembly.cpp @@ -4,6 +4,7 @@ #include "list.h" #include "interval_tree.h" #include "tcp_reassembly.h" +#include "stellar/stellar.h" #define TCP_REASSEMBLY_LOG_DEBUG(format, ...) LOG_DEBUG("tcp_reassembly", format, ##__VA_ARGS__) #define TCP_REASSEMBLY_LOG_ERROR(format, ...) LOG_ERROR("tcp_reassembly", format, ##__VA_ARGS__) diff --git a/src/tcp_reassembly/tcp_reassembly.h b/src/tcp_reassembly/tcp_reassembly.h index 55d09a0..65a7a35 100644 --- a/src/tcp_reassembly/tcp_reassembly.h +++ b/src/tcp_reassembly/tcp_reassembly.h @@ -33,9 +33,6 @@ void tcp_reassembly_inc_recv_next(struct tcp_reassembly *assembler, uint32_t off void tcp_reassembly_set_recv_next(struct tcp_reassembly *assembler, uint32_t seq); uint32_t tcp_reassembly_get_recv_next(struct tcp_reassembly *assembler); -const char *tcp_segment_get_data(const struct tcp_segment *seg); -uint16_t tcp_segment_get_len(const struct tcp_segment *seg); - /* * The next routines deal with comparing 32 bit unsigned ints * and worry about wraparound (automatic with unsigned arithmetic).