Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When validating the configuration, ensure that the keepalive is valid #372

Merged
merged 4 commits into from
Apr 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
When validating the configuration, ensure that the keepalive is valid
  • Loading branch information
danielealbano committed Apr 29, 2023
commit 4d40518dbf29fc1580c1eaca9f71662034a5b638
33 changes: 33 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,38 @@ bool config_validate_after_load_modules_network_tls(
return_result = false;
}

bool config_validate_after_load_modules_network_keepalive(
config_module_t *module) {
bool return_result = true;

if (module->network->keepalive == NULL) {
return true;
}

if (module->network->keepalive->time == 0) {
LOG_E(
TAG,
"In module <%s>, the keepalive time has to be greater than zero",
config_module_type_schema_strings[module->type].str);
return_result = false;
}

if (module->network->keepalive->interval == 0) {
LOG_E(
TAG,
"In module <%s>, the keepalive interval has to be greater than zero",
config_module_type_schema_strings[module->type].str);
return_result = false;
}

if (module->network->keepalive->probes == 0) {
LOG_E(
TAG,
"In module <%s>, the keepalive probes has to be greater than zero",
config_module_type_schema_strings[module->type].str);
return_result = false;
}

return return_result;
}

Expand Down Expand Up @@ -618,6 +650,7 @@ bool config_validate_after_load_modules(
config_module_t *module = &config->modules[module_index];

if (config_validate_after_load_modules_network_timeout(module) == false
|| config_validate_after_load_modules_network_keepalive(module) == false
|| config_validate_after_load_modules_network_tls(module) == false
|| config_validate_after_load_modules_network_bindings(module) == false
|| config_validate_after_load_modules_redis(module) == false) {
Expand Down