IP reassembly parses IP frag related configuration items
This commit is contained in:
@@ -168,55 +168,6 @@ error_out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
// return 0: success
|
||||
// retuun -1: failed
|
||||
static int parse_ip_reassembly_section(toml_table_t *root, struct ip_reassembly_options *opts)
|
||||
{
|
||||
const char *ptr;
|
||||
toml_table_t *table;
|
||||
|
||||
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(table, "enable");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->enable");
|
||||
return -1;
|
||||
}
|
||||
opts->enable = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(table, "timeout");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->timeout");
|
||||
return -1;
|
||||
}
|
||||
opts->timeout = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(table, "bucket_entries");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->bucket_entries");
|
||||
return -1;
|
||||
}
|
||||
opts->bucket_entries = atoi(ptr);
|
||||
|
||||
ptr = toml_raw_in(table, "bucket_num");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing ip_reassembly->bucket_num");
|
||||
return -1;
|
||||
}
|
||||
opts->bucket_num = atoi(ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// return 0: success
|
||||
// retuun -1: failed
|
||||
static int parse_schedule_options(toml_table_t *root, struct schedule_options *opts)
|
||||
@@ -231,32 +182,6 @@ static int parse_schedule_options(toml_table_t *root, struct schedule_options *o
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr = toml_raw_in(table, "free_expired_ip_frag_interval");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing schedule->free_expired_ip_frag_interval");
|
||||
return -1;
|
||||
}
|
||||
opts->free_expired_ip_frag_interval = atoll(ptr);
|
||||
if (opts->free_expired_ip_frag_interval < 1 || opts->free_expired_ip_frag_interval > 60000)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file invalid schedule->free_expired_ip_frag_interval %ld, range [1, 60000]", opts->free_expired_ip_frag_interval);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr = toml_raw_in(table, "free_expired_ip_frag_batch");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file missing schedule->free_expired_ip_frag_batch");
|
||||
return -1;
|
||||
}
|
||||
opts->free_expired_ip_frag_batch = atoll(ptr);
|
||||
if (opts->free_expired_ip_frag_batch < 1 || opts->free_expired_ip_frag_batch > 60000)
|
||||
{
|
||||
CONFIG_LOG_ERROR("config file invalid schedule->free_expired_ip_frag_batch %ld, range [1, 60000]", opts->free_expired_ip_frag_batch);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptr = toml_raw_in(table, "merge_stat_interval");
|
||||
if (ptr == NULL)
|
||||
{
|
||||
@@ -332,11 +257,6 @@ int stellar_config_load(struct stellar_config *config, const char *file)
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (parse_ip_reassembly_section(table, &config->ip_reass_opts) != 0)
|
||||
{
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (parse_schedule_options(table, &config->sched_opts) != 0)
|
||||
{
|
||||
goto error_out;
|
||||
@@ -367,7 +287,6 @@ void stellar_config_print(const struct stellar_config *config)
|
||||
|
||||
const struct packet_io_options *pkt_io_opts = &config->pkt_io_opts;
|
||||
const struct snowflake_options *snowflake_opts = &config->snowflake_opts;
|
||||
const struct ip_reassembly_options *ip_reass_opts = &config->ip_reass_opts;
|
||||
|
||||
// snowflake config
|
||||
CONFIG_LOG_DEBUG("snowflake->snowflake_base : %d", snowflake_opts->snowflake_base);
|
||||
@@ -390,15 +309,7 @@ void stellar_config_print(const struct stellar_config *config)
|
||||
CONFIG_LOG_DEBUG("packet_io->cpu_mask[%3d] : %d", i, pkt_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);
|
||||
|
||||
// schedule config
|
||||
CONFIG_LOG_DEBUG("schedule->free_expired_ip_frag_interval : %ld", config->sched_opts.free_expired_ip_frag_interval);
|
||||
CONFIG_LOG_DEBUG("schedule->free_expired_ip_frag_batch : %ld", config->sched_opts.free_expired_ip_frag_batch);
|
||||
CONFIG_LOG_DEBUG("schedule->merge_stat_interval : %ld", config->sched_opts.merge_stat_interval);
|
||||
CONFIG_LOG_DEBUG("schedule->output_stat_interval : %ld", config->sched_opts.output_stat_interval);
|
||||
CONFIG_LOG_DEBUG("schedule->packet_io_yield_interval : %ld", config->sched_opts.packet_io_yield_interval);
|
||||
|
||||
Reference in New Issue
Block a user