diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-31 12:58:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-31 12:58:11 +0000 |
commit | f99c4526d94d3e04124c5c48ab4a3da6ca53a458 (patch) | |
tree | a2ed8860030cc49f492b09b3222d593c65619800 /collectors/freeipmi.plugin/freeipmi_plugin.c | |
parent | Adding upstream version 1.29.3. (diff) | |
download | netdata-c0ecfccbffe7a59dafa73d092f44c3a9333256e4.tar.xz netdata-c0ecfccbffe7a59dafa73d092f44c3a9333256e4.zip |
Adding upstream version 1.30.0.upstream/1.30.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/freeipmi.plugin/freeipmi_plugin.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/collectors/freeipmi.plugin/freeipmi_plugin.c b/collectors/freeipmi.plugin/freeipmi_plugin.c index bd3c533ca..e9702e785 100644 --- a/collectors/freeipmi.plugin/freeipmi_plugin.c +++ b/collectors/freeipmi.plugin/freeipmi_plugin.c @@ -26,8 +26,6 @@ #include <unistd.h> #include <sys/time.h> -#ifdef HAVE_FREEIPMI - #define IPMI_PARSE_DEVICE_LAN_STR "lan" #define IPMI_PARSE_DEVICE_LAN_2_0_STR "lan_2_0" #define IPMI_PARSE_DEVICE_LAN_2_0_STR2 "lan20" @@ -1621,6 +1619,14 @@ int parse_outofband_driver_type (const char *str) return (-1); } +int host_is_local(const char *host) +{ + if (host && (!strcmp(host, "localhost") || !strcmp(host, "127.0.0.1") || !strcmp(host, "::1"))) + return (1); + + return (0); +} + int main (int argc, char **argv) { // ------------------------------------------------------------------------ @@ -1691,6 +1697,8 @@ int main (int argc, char **argv) { " password PASS connect to remote IPMI host\n" " default: local IPMI processor\n" "\n" + " noauthcodecheck don't check the authentication codes returned\n" + "\n" " driver-type IPMIDRIVER\n" " Specify the driver type to use instead of doing an auto selection. \n" " The currently available outofband drivers are LAN and LAN_2_0,\n" @@ -1765,6 +1773,23 @@ int main (int argc, char **argv) { if(debug) fprintf(stderr, "freeipmi.plugin: inband driver type set to '%d'\n", driver_type); } continue; + } else if (i < argc && strcmp("noauthcodecheck", argv[i]) == 0) { + if (!hostname || host_is_local(hostname)) { + if (debug) + fprintf( + stderr, + "freeipmi.plugin: noauthcodecheck workaround flag is ignored for inband configuration\n"); + } else if (protocol_version < 0 || protocol_version == IPMI_MONITORING_PROTOCOL_VERSION_1_5) { + workaround_flags |= IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_NO_AUTH_CODE_CHECK; + if (debug) + fprintf(stderr, "freeipmi.plugin: noauthcodecheck workaround flag enabled\n"); + } else { + if (debug) + fprintf( + stderr, + "freeipmi.plugin: noauthcodecheck workaround flag is ignored for protocol version 2.0\n"); + } + continue; } else if(i < argc && strcmp("sdr-cache-dir", argv[i]) == 0) { sdr_cache_directory = argv[++i]; @@ -1861,11 +1886,3 @@ int main (int argc, char **argv) { if(now_monotonic_sec() - started_t > 14400) exit(0); } } - -#else // !HAVE_FREEIPMI - -int main(int argc, char **argv) { - fatal("freeipmi.plugin is not compiled."); -} - -#endif // !HAVE_FREEIPMI |