Skip to content

Commit

Permalink
be more specific when unloading a neb module
Browse files Browse the repository at this point in the history
Print the current and expected api version number along with the error.
This gives a hint about wether the neb module is too new or too old.
  • Loading branch information
sni committed Aug 29, 2023
1 parent 7558c98 commit c272ec7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/naemon/nebmods.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,14 @@ int neb_load_module(nebmodule *mod)
module_version_ptr = (int *)dlsym(mod->module_handle, "__neb_api_version");

/* check the module API version */
if (module_version_ptr == NULL || ((*module_version_ptr) != CURRENT_NEB_API_VERSION)) {

nm_log(NSLOG_RUNTIME_ERROR, "Error: Module '%s' is using an old or unspecified version of the event broker API. Module will be unloaded.\n", mod->filename);

if (module_version_ptr == NULL) {
nm_log(NSLOG_RUNTIME_ERROR, "Error: Module '%s' did not specify a version of the event broker API. Module will be unloaded.\n", mod->filename);
neb_unload_module(mod, NEBMODULE_FORCE_UNLOAD, NEBMODULE_ERROR_API_VERSION);
return ERROR;
}
if ((*module_version_ptr) != CURRENT_NEB_API_VERSION) {
nm_log(NSLOG_RUNTIME_ERROR, "Error: Module '%s' is using an incompatible version (v%d) of the event broker API (current version v%d). Module will be unloaded.\n", mod->filename, *module_version_ptr, CURRENT_NEB_API_VERSION);
neb_unload_module(mod, NEBMODULE_FORCE_UNLOAD, NEBMODULE_ERROR_API_VERSION);

return ERROR;
}

Expand Down

0 comments on commit c272ec7

Please sign in to comment.