Update session timeouts
This commit is contained in:
@@ -7,30 +7,30 @@
|
||||
|
||||
// return 0: success
|
||||
// retuun -1: failed
|
||||
static int parse_device_options(toml_table_t *table, struct device_options *opts)
|
||||
static int parse_device_section(toml_table_t *root, struct device_options *opts)
|
||||
{
|
||||
const char *ptr;
|
||||
toml_table_t *device;
|
||||
toml_table_t *table;
|
||||
|
||||
device = toml_table_in(table, "device");
|
||||
if (device == NULL)
|
||||
table = toml_table_in(root, "device");
|
||||
if (table == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing device section");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr = toml_raw_in(device, "device_base");
|
||||
ptr = toml_raw_in(table, "device_base");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing device.device_base");
|
||||
CONFIG_LOG_ERROR("config file missing device->device_base");
|
||||
return -1;
|
||||
}
|
||||
opts->device_base = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(device, "device_offset");
|
||||
ptr = toml_raw_in(table, "device_offset");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing device.device_offset");
|
||||
CONFIG_LOG_ERROR("config file missing device->device_offset");
|
||||
return -1;
|
||||
}
|
||||
opts->device_offset = atoi(ptr);
|
||||
@@ -40,23 +40,23 @@ static int parse_device_options(toml_table_t *table, struct device_options *opts
|
||||
|
||||
// return 0: success
|
||||
// retuun -1: failed
|
||||
static int parse_packet_io_options(toml_table_t *table, struct packet_io_options *opts)
|
||||
static int parse_packet_io_section(toml_table_t *root, struct packet_io_options *opts)
|
||||
{
|
||||
const char *ptr;
|
||||
toml_table_t *packet_io;
|
||||
toml_table_t *table;
|
||||
toml_array_t *mask_array;
|
||||
|
||||
packet_io = toml_table_in(table, "packet_io");
|
||||
if (packet_io == NULL)
|
||||
table = toml_table_in(root, "packet_io");
|
||||
if (table == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io section");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr = toml_raw_in(packet_io, "mode");
|
||||
ptr = toml_raw_in(table, "mode");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io.mode");
|
||||
CONFIG_LOG_ERROR("config file missing packet_io->mode");
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(ptr, "dumpfile") == 0)
|
||||
@@ -69,16 +69,16 @@ static int parse_packet_io_options(toml_table_t *table, struct packet_io_options
|
||||
}
|
||||
else
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file invalid packet_io.mode %s, only support dumpfile and marsio", ptr);
|
||||
CONFIG_LOG_ERROR("config file invalid packet_io->mode %s, only support dumpfile and marsio", ptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (opts->mode == PACKET_IO_DUMPFILE)
|
||||
{
|
||||
ptr = toml_raw_in(packet_io, "dumpfile_dir");
|
||||
ptr = toml_raw_in(table, "dumpfile_dir");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io.dumpfile_dir");
|
||||
CONFIG_LOG_ERROR("config file missing packet_io->dumpfile_dir");
|
||||
return -1;
|
||||
}
|
||||
// skip ""
|
||||
@@ -86,40 +86,40 @@ static int parse_packet_io_options(toml_table_t *table, struct packet_io_options
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr = toml_raw_in(packet_io, "app_symbol");
|
||||
ptr = toml_raw_in(table, "app_symbol");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io.app_symbol");
|
||||
CONFIG_LOG_ERROR("config file missing packet_io->app_symbol");
|
||||
return -1;
|
||||
}
|
||||
strncpy(opts->app_symbol, ptr, sizeof(opts->app_symbol) - 1);
|
||||
|
||||
ptr = toml_raw_in(packet_io, "dev_symbol");
|
||||
ptr = toml_raw_in(table, "dev_symbol");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io.dev_symbol");
|
||||
CONFIG_LOG_ERROR("config file missing packet_io->dev_symbol");
|
||||
return -1;
|
||||
}
|
||||
strncpy(opts->dev_symbol, ptr, sizeof(opts->dev_symbol) - 1);
|
||||
}
|
||||
|
||||
ptr = toml_raw_in(packet_io, "nr_threads");
|
||||
ptr = toml_raw_in(table, "nr_threads");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io.nr_threads");
|
||||
CONFIG_LOG_ERROR("config file missing packet_io->nr_threads");
|
||||
return -1;
|
||||
}
|
||||
if (atoi(ptr) <= 0 || atoi(ptr) > MAX_THREAD_NUM)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file invalid packet_io.nr_threads %d, range [1, %d]", atoi(ptr), MAX_THREAD_NUM);
|
||||
CONFIG_LOG_ERROR("config file invalid packet_io->nr_threads %d, range [1, %d]", atoi(ptr), MAX_THREAD_NUM);
|
||||
return -1;
|
||||
}
|
||||
opts->nr_threads = atoi(ptr);
|
||||
|
||||
mask_array = toml_array_in(packet_io, "cpu_mask");
|
||||
mask_array = toml_array_in(table, "cpu_mask");
|
||||
if (mask_array == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io.cpu_mask");
|
||||
CONFIG_LOG_ERROR("config file missing packet_io->cpu_mask");
|
||||
return -1;
|
||||
}
|
||||
for (uint8_t i = 0; i < opts->nr_threads; i++)
|
||||
@@ -127,7 +127,7 @@ static int parse_packet_io_options(toml_table_t *table, struct packet_io_options
|
||||
ptr = toml_raw_at(mask_array, i);
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing packet_io.cpu_mask[%d]", i);
|
||||
CONFIG_LOG_ERROR("config file missing packet_io->cpu_mask[%d]", i);
|
||||
return -1;
|
||||
}
|
||||
opts->cpu_mask[i] = atoi(ptr);
|
||||
@@ -138,46 +138,46 @@ static int parse_packet_io_options(toml_table_t *table, struct packet_io_options
|
||||
|
||||
// return 0: success
|
||||
// retuun -1: failed
|
||||
static int parse_ip_reassembly_options(toml_table_t *table, struct ip_reassembly_options *opts)
|
||||
static int parse_ip_reassembly_section(toml_table_t *root, struct ip_reassembly_options *opts)
|
||||
{
|
||||
const char *ptr;
|
||||
toml_table_t *ip_reassembly;
|
||||
toml_table_t *table;
|
||||
|
||||
ip_reassembly = toml_table_in(table, "ip_reassembly");
|
||||
if (ip_reassembly == NULL)
|
||||
table = toml_table_in(root, "ip_reassembly");
|
||||
if (table == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly section");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr = toml_raw_in(ip_reassembly, "enable");
|
||||
ptr = toml_raw_in(table, "enable");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly.enable");
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->enable");
|
||||
return -1;
|
||||
}
|
||||
opts->enable = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(ip_reassembly, "timeout");
|
||||
ptr = toml_raw_in(table, "timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly.timeout");
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->timeout = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(ip_reassembly, "bucket_entries");
|
||||
ptr = toml_raw_in(table, "bucket_entries");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly.bucket_entries");
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->bucket_entries");
|
||||
return -1;
|
||||
}
|
||||
opts->bucket_entries = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(ip_reassembly, "bucket_num");
|
||||
ptr = toml_raw_in(table, "bucket_num");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly.bucket_num");
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->bucket_num");
|
||||
return -1;
|
||||
}
|
||||
opts->bucket_num = atoi(ptr);
|
||||
@@ -187,205 +187,213 @@ static int parse_ip_reassembly_options(toml_table_t *table, struct ip_reassembly
|
||||
|
||||
// return 0: success
|
||||
// retuun -1: failed
|
||||
static int parse_session_manager_options(toml_table_t *table, struct session_manager_options *opts)
|
||||
static int parse_session_manager_section(toml_table_t *root, struct session_manager_options *opts)
|
||||
{
|
||||
const char *ptr;
|
||||
toml_table_t *session_manager;
|
||||
toml_table_t *table;
|
||||
|
||||
session_manager = toml_table_in(table, "session_manager");
|
||||
if (session_manager == NULL)
|
||||
table = toml_table_in(root, "session_manager");
|
||||
if (table == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager section");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// max session number
|
||||
ptr = toml_raw_in(session_manager, "max_tcp_session_num");
|
||||
ptr = toml_raw_in(table, "max_tcp_session_num");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.max_tcp_session_num");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->max_tcp_session_num");
|
||||
return -1;
|
||||
}
|
||||
opts->max_tcp_session_num = atoll(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "max_udp_session_num");
|
||||
ptr = toml_raw_in(table, "max_udp_session_num");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.max_udp_session_num");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->max_udp_session_num");
|
||||
return -1;
|
||||
}
|
||||
opts->max_udp_session_num = atoll(ptr);
|
||||
|
||||
// session overload (1: evict old session, 0: bypass new session)
|
||||
ptr = toml_raw_in(session_manager, "tcp_overload_evict_old_sess");
|
||||
ptr = toml_raw_in(table, "tcp_overload_evict_old_sess");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_overload_evict_old_sess");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_overload_evict_old_sess");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_overload_evict_old_sess = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "udp_overload_evict_old_sess");
|
||||
ptr = toml_raw_in(table, "udp_overload_evict_old_sess");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.udp_overload_evict_old_sess");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->udp_overload_evict_old_sess");
|
||||
return -1;
|
||||
}
|
||||
opts->udp_overload_evict_old_sess = atoi(ptr);
|
||||
|
||||
// TCP timeout
|
||||
ptr = toml_raw_in(session_manager, "tcp_timeout_init");
|
||||
ptr = toml_raw_in(table, "tcp_init_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_timeout_init");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_init_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_timeout_init = atoll(ptr);
|
||||
opts->tcp_init_timeout = atoll(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_timeout_handshake");
|
||||
ptr = toml_raw_in(table, "tcp_handshake_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_timeout_handshake");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_handshake_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_timeout_handshake = atoll(ptr);
|
||||
opts->tcp_handshake_timeout = atoll(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_timeout_data");
|
||||
ptr = toml_raw_in(table, "tcp_data_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_timeout_data");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_data_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_timeout_data = atoll(ptr);
|
||||
opts->tcp_data_timeout = atoll(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_timeout_half_closed");
|
||||
ptr = toml_raw_in(table, "tcp_half_closed_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_timeout_half_closed");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_half_closed_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_timeout_half_closed = atoll(ptr);
|
||||
opts->tcp_half_closed_timeout = atoll(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_timeout_time_wait");
|
||||
ptr = toml_raw_in(table, "tcp_time_wait_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_timeout_time_wait");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_time_wait_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_timeout_time_wait = atoll(ptr);
|
||||
opts->tcp_time_wait_timeout = atoll(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_timeout_discard");
|
||||
ptr = toml_raw_in(table, "tcp_discard_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_timeout_discard");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_discard_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_timeout_discard = atoll(ptr);
|
||||
opts->tcp_discard_timeout = atoll(ptr);
|
||||
|
||||
ptr = toml_raw_in(table, "tcp_unverified_rst_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_unverified_rst_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_unverified_rst_timeout = atoll(ptr);
|
||||
|
||||
// UDP timeout
|
||||
ptr = toml_raw_in(session_manager, "udp_timeout_data");
|
||||
ptr = toml_raw_in(table, "udp_data_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.udp_timeout_data");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->udp_data_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->udp_timeout_data = atoll(ptr);
|
||||
opts->udp_data_timeout = atoll(ptr);
|
||||
|
||||
// duplicate packet filter
|
||||
ptr = toml_raw_in(session_manager, "duplicated_packet_filter_enable");
|
||||
ptr = toml_raw_in(table, "duplicated_packet_filter_enable");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.duplicated_packet_filter_enable");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->duplicated_packet_filter_enable");
|
||||
return -1;
|
||||
}
|
||||
opts->duplicated_packet_filter_enable = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "duplicated_packet_filter_capacity");
|
||||
ptr = toml_raw_in(table, "duplicated_packet_filter_capacity");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.duplicated_packet_filter_capacity");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->duplicated_packet_filter_capacity");
|
||||
return -1;
|
||||
}
|
||||
opts->duplicated_packet_filter_capacity = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "duplicated_packet_filter_timeout");
|
||||
ptr = toml_raw_in(table, "duplicated_packet_filter_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.duplicated_packet_filter_timeout");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->duplicated_packet_filter_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->duplicated_packet_filter_timeout = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "duplicated_packet_filter_error_rate");
|
||||
ptr = toml_raw_in(table, "duplicated_packet_filter_error_rate");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.duplicated_packet_filter_error_rate");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->duplicated_packet_filter_error_rate");
|
||||
return -1;
|
||||
}
|
||||
opts->duplicated_packet_filter_error_rate = atof(ptr);
|
||||
|
||||
// eviction filter
|
||||
ptr = toml_raw_in(session_manager, "evicted_session_filter_enable");
|
||||
// eviction session filter
|
||||
ptr = toml_raw_in(table, "evicted_session_filter_enable");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.evicted_session_filter_enable");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->evicted_session_filter_enable");
|
||||
return -1;
|
||||
}
|
||||
opts->evicted_session_filter_enable = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "evicted_session_filter_capacity");
|
||||
ptr = toml_raw_in(table, "evicted_session_filter_capacity");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.evicted_session_filter_capacity");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->evicted_session_filter_capacity");
|
||||
return -1;
|
||||
}
|
||||
opts->evicted_session_filter_capacity = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "evicted_session_filter_timeout");
|
||||
ptr = toml_raw_in(table, "evicted_session_filter_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.evicted_session_filter_timeout");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->evicted_session_filter_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->evicted_session_filter_timeout = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "evicted_session_filter_error_rate");
|
||||
ptr = toml_raw_in(table, "evicted_session_filter_error_rate");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.evicted_session_filter_error_rate");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->evicted_session_filter_error_rate");
|
||||
return -1;
|
||||
}
|
||||
opts->evicted_session_filter_error_rate = atof(ptr);
|
||||
|
||||
// TCP reassembly
|
||||
ptr = toml_raw_in(session_manager, "tcp_reassembly_enable");
|
||||
ptr = toml_raw_in(table, "tcp_reassembly_enable");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_reassembly_enable");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_reassembly_enable");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_reassembly_enable = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_reassembly_max_timeout");
|
||||
ptr = toml_raw_in(table, "tcp_reassembly_max_timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_reassembly_max_timeout");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_reassembly_max_timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_reassembly_max_timeout = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_reassembly_max_segments");
|
||||
ptr = toml_raw_in(table, "tcp_reassembly_max_segments");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_reassembly_max_segments");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_reassembly_max_segments");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_reassembly_max_segments = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(session_manager, "tcp_reassembly_max_bytes");
|
||||
ptr = toml_raw_in(table, "tcp_reassembly_max_bytes");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing session_manager.tcp_reassembly_max_bytes");
|
||||
CONFIG_LOG_ERROR("config file missing session_manager->tcp_reassembly_max_bytes");
|
||||
return -1;
|
||||
}
|
||||
opts->tcp_reassembly_max_bytes = atoi(ptr);
|
||||
@@ -401,7 +409,6 @@ int parse_config_file(const char *file, struct config *config)
|
||||
char errbuf[200];
|
||||
FILE *fp = NULL;
|
||||
toml_table_t *table = NULL;
|
||||
|
||||
memset(config, 0, sizeof(*config));
|
||||
|
||||
fp = fopen(file, "r");
|
||||
@@ -418,22 +425,22 @@ int parse_config_file(const char *file, struct config *config)
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (parse_device_options(table, &config->dev_opts) != 0)
|
||||
if (parse_device_section(table, &config->device_opts) != 0)
|
||||
{
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (parse_packet_io_options(table, &config->pkt_io_opts) != 0)
|
||||
if (parse_packet_io_section(table, &config->packet_io_opts) != 0)
|
||||
{
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (parse_ip_reassembly_options(table, &config->ip_reass_opts) != 0)
|
||||
if (parse_ip_reassembly_section(table, &config->ip_reassembly_opts) != 0)
|
||||
{
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (parse_session_manager_options(table, &config->sess_mgr_opts) != 0)
|
||||
if (parse_session_manager_section(table, &config->session_manager_opts) != 0)
|
||||
{
|
||||
goto error_out;
|
||||
}
|
||||
@@ -461,67 +468,71 @@ void print_config_options(struct config *config)
|
||||
return;
|
||||
}
|
||||
|
||||
struct device_options *dev_opts = &config->dev_opts;
|
||||
struct packet_io_options *pkt_io_opts = &config->pkt_io_opts;
|
||||
struct ip_reassembly_options *ip_reass_opts = &config->ip_reass_opts;
|
||||
struct session_manager_options *sess_mgr_opts = &config->sess_mgr_opts;
|
||||
struct device_options *device_opts = &config->device_opts;
|
||||
struct packet_io_options *packet_io_opts = &config->packet_io_opts;
|
||||
struct ip_reassembly_options *ip_reassembly_opts = &config->ip_reassembly_opts;
|
||||
struct session_manager_options *session_manager_opts = &config->session_manager_opts;
|
||||
|
||||
// device config
|
||||
CONFIG_LOG_DEBUG("device->device_base : %d", dev_opts->device_base);
|
||||
CONFIG_LOG_DEBUG("device->device_offset : %d", dev_opts->device_offset);
|
||||
CONFIG_LOG_DEBUG("device->device_base : %d", device_opts->device_base);
|
||||
CONFIG_LOG_DEBUG("device->device_offset : %d", device_opts->device_offset);
|
||||
|
||||
// packet io config
|
||||
CONFIG_LOG_DEBUG("packet_io->mode : %s", pkt_io_opts->mode == PACKET_IO_DUMPFILE ? "dumpfile" : "marsio");
|
||||
if (pkt_io_opts->mode == PACKET_IO_DUMPFILE)
|
||||
CONFIG_LOG_DEBUG("packet_io->mode : %s", packet_io_opts->mode == PACKET_IO_DUMPFILE ? "dumpfile" : "marsio");
|
||||
if (packet_io_opts->mode == PACKET_IO_DUMPFILE)
|
||||
{
|
||||
CONFIG_LOG_DEBUG("packet_io->dumpfile_dir : %s", pkt_io_opts->dumpfile_dir);
|
||||
CONFIG_LOG_DEBUG("packet_io->dumpfile_dir : %s", packet_io_opts->dumpfile_dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONFIG_LOG_DEBUG("packet_io->app_symbol : %s", pkt_io_opts->app_symbol);
|
||||
CONFIG_LOG_DEBUG("packet_io->dev_symbol : %s", pkt_io_opts->dev_symbol);
|
||||
CONFIG_LOG_DEBUG("packet_io->app_symbol : %s", packet_io_opts->app_symbol);
|
||||
CONFIG_LOG_DEBUG("packet_io->dev_symbol : %s", packet_io_opts->dev_symbol);
|
||||
}
|
||||
CONFIG_LOG_DEBUG("packet_io->nr_threads : %d", pkt_io_opts->nr_threads);
|
||||
for (uint8_t i = 0; i < pkt_io_opts->nr_threads; i++)
|
||||
CONFIG_LOG_DEBUG("packet_io->nr_threads : %d", packet_io_opts->nr_threads);
|
||||
for (uint8_t i = 0; i < packet_io_opts->nr_threads; i++)
|
||||
{
|
||||
CONFIG_LOG_DEBUG("packet_io->cpu_mask[%03d] : %d", i, pkt_io_opts->cpu_mask[i]);
|
||||
CONFIG_LOG_DEBUG("packet_io->cpu_mask[%03d] : %d", i, packet_io_opts->cpu_mask[i]);
|
||||
}
|
||||
|
||||
// ip reassemble config
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->enable : %d", ip_reass_opts->enable);
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->timeout : %d", ip_reass_opts->timeout);
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->bucket_entries : %d", ip_reass_opts->bucket_entries);
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->bucket_num : %d", ip_reass_opts->bucket_num);
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->enable : %d", ip_reassembly_opts->enable);
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->timeout : %d", ip_reassembly_opts->timeout);
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->bucket_entries : %d", ip_reassembly_opts->bucket_entries);
|
||||
CONFIG_LOG_DEBUG("ip_reassembly->bucket_num : %d", ip_reassembly_opts->bucket_num);
|
||||
|
||||
// session manager config
|
||||
CONFIG_LOG_DEBUG("session_manager->max_tcp_session_num : %ld", sess_mgr_opts->max_tcp_session_num);
|
||||
CONFIG_LOG_DEBUG("session_manager->max_udp_session_num : %ld", sess_mgr_opts->max_udp_session_num);
|
||||
// session manager config -> max session number
|
||||
CONFIG_LOG_DEBUG("session_manager->max_tcp_session_num : %ld", session_manager_opts->max_tcp_session_num);
|
||||
CONFIG_LOG_DEBUG("session_manager->max_udp_session_num : %ld", session_manager_opts->max_udp_session_num);
|
||||
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_overload_evict_old_sess : %d", sess_mgr_opts->tcp_overload_evict_old_sess);
|
||||
CONFIG_LOG_DEBUG("session_manager->udp_overload_evict_old_sess : %d", sess_mgr_opts->udp_overload_evict_old_sess);
|
||||
// session manager config -> session overload evict
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_overload_evict_old_sess : %d", session_manager_opts->tcp_overload_evict_old_sess);
|
||||
CONFIG_LOG_DEBUG("session_manager->udp_overload_evict_old_sess : %d", session_manager_opts->udp_overload_evict_old_sess);
|
||||
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_timeout_init : %ld", sess_mgr_opts->tcp_timeout_init);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_timeout_handshake : %ld", sess_mgr_opts->tcp_timeout_handshake);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_timeout_data : %ld", sess_mgr_opts->tcp_timeout_data);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_timeout_half_closed : %ld", sess_mgr_opts->tcp_timeout_half_closed);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_timeout_time_wait : %ld", sess_mgr_opts->tcp_timeout_time_wait);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_timeout_discard : %ld", sess_mgr_opts->tcp_timeout_discard);
|
||||
// session manager config -> session timeout
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_init_timeout : %ld", session_manager_opts->tcp_init_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_handshake_timeout : %ld", session_manager_opts->tcp_handshake_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_data_timeout : %ld", session_manager_opts->tcp_data_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_half_closed_timeout : %ld", session_manager_opts->tcp_half_closed_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_time_wait_timeout : %ld", session_manager_opts->tcp_time_wait_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_discard_timeout : %ld", session_manager_opts->tcp_discard_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_unverified_rst_timeout : %ld", session_manager_opts->tcp_unverified_rst_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->udp_data_timeout : %ld", session_manager_opts->udp_data_timeout);
|
||||
|
||||
CONFIG_LOG_DEBUG("session_manager->udp_timeout_data : %ld", sess_mgr_opts->udp_timeout_data);
|
||||
// session manager config -> duplicated packet filter
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_enable : %d", session_manager_opts->duplicated_packet_filter_enable);
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_capacity : %d", session_manager_opts->duplicated_packet_filter_capacity);
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_timeout : %d", session_manager_opts->duplicated_packet_filter_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_error_rate : %f", session_manager_opts->duplicated_packet_filter_error_rate);
|
||||
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_enable : %d", sess_mgr_opts->duplicated_packet_filter_enable);
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_capacity : %d", sess_mgr_opts->duplicated_packet_filter_capacity);
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_timeout : %d", sess_mgr_opts->duplicated_packet_filter_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->duplicated_packet_filter_error_rate : %f", sess_mgr_opts->duplicated_packet_filter_error_rate);
|
||||
// session manager config -> evicted session filter
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_enable : %d", session_manager_opts->evicted_session_filter_enable);
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_capacity : %d", session_manager_opts->evicted_session_filter_capacity);
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_timeout : %d", session_manager_opts->evicted_session_filter_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_error_rate : %f", session_manager_opts->evicted_session_filter_error_rate);
|
||||
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_enable : %d", sess_mgr_opts->evicted_session_filter_enable);
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_capacity : %d", sess_mgr_opts->evicted_session_filter_capacity);
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_timeout : %d", sess_mgr_opts->evicted_session_filter_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->evicted_session_filter_error_rate : %f", sess_mgr_opts->evicted_session_filter_error_rate);
|
||||
|
||||
// TCP reassembly
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_enable : %d", sess_mgr_opts->tcp_reassembly_enable);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_max_timeout : %d", sess_mgr_opts->tcp_reassembly_max_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_max_segments : %d", sess_mgr_opts->tcp_reassembly_max_segments);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_max_bytes : %d", sess_mgr_opts->tcp_reassembly_max_bytes);
|
||||
// session manager config -> TCP reassembly
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_enable : %d", session_manager_opts->tcp_reassembly_enable);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_max_timeout : %d", session_manager_opts->tcp_reassembly_max_timeout);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_max_segments : %d", session_manager_opts->tcp_reassembly_max_segments);
|
||||
CONFIG_LOG_DEBUG("session_manager->tcp_reassembly_max_bytes : %d", session_manager_opts->tcp_reassembly_max_bytes);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user