@cryptotaxi247 / netdata-1 / commits / d127d2f68

Add noauthcodecheck workaround flag to the freeipmi plugin (#10701)

Vladimir Kobal committed Mar 3, 2021 at 16:02 UTC d127d2f6818a6ac96be0d7954d63a882969e76c6
2 files changed +30 -1
collectors/freeipmi.plugin/README.md
+3 -1
@@ -45,7 +45,7 @@ The plugin does a speed test when it starts, to find out the duration needed by
45
46 The plugin supports a few options. To see them, run:
47
48 -```sh
48 +```text
49 # /usr/libexec/netdata/plugins.d/freeipmi.plugin -h
50
51 netdata freeipmi.plugin 1.8.0-546-g72ce5d6b_rolling
@@ -72,6 +72,8 @@ The plugin supports a few options. To see them, run:
72 password PASS connect to remote IPMI host
73 default: local IPMI processor
74
75 + noauthcodecheck don't check the authentication codes returned
76 +
77 driver-type IPMIDRIVER
78 Specify the driver type to use instead of doing an auto selection.
79 The currently available outofband drivers are LAN and LAN_2_0,
collectors/freeipmi.plugin/freeipmi_plugin.c
+27
@@ -1619,6 +1619,14 @@ int parse_outofband_driver_type (const char *str)
1619 return (-1);
1620 }
1621
1622 +int host_is_local(const char *host)
1623 +{
1624 + if (host && (!strcmp(host, "localhost") || !strcmp(host, "127.0.0.1") || !strcmp(host, "::1")))
1625 + return (1);
1626 +
1627 + return (0);
1628 +}
1629 +
1630 int main (int argc, char **argv) {
1631
1632 // ------------------------------------------------------------------------
@@ -1689,6 +1697,8 @@ int main (int argc, char **argv) {
1697 " password PASS connect to remote IPMI host\n"
1698 " default: local IPMI processor\n"
1699 "\n"
1700 + " noauthcodecheck don't check the authentication codes returned\n"
1701 + "\n"
1702 " driver-type IPMIDRIVER\n"
1703 " Specify the driver type to use instead of doing an auto selection. \n"
1704 " The currently available outofband drivers are LAN and LAN_2_0,\n"
@@ -1763,6 +1773,23 @@ int main (int argc, char **argv) {
1773 if(debug) fprintf(stderr, "freeipmi.plugin: inband driver type set to '%d'\n", driver_type);
1774 }
1775 continue;
1776 + } else if (i < argc && strcmp("noauthcodecheck", argv[i]) == 0) {
1777 + if (!hostname || host_is_local(hostname)) {
1778 + if (debug)
1779 + fprintf(
1780 + stderr,
1781 + "freeipmi.plugin: noauthcodecheck workaround flag is ignored for inband configuration\n");
1782 + } else if (protocol_version < 0 || protocol_version == IPMI_MONITORING_PROTOCOL_VERSION_1_5) {
1783 + workaround_flags |= IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_NO_AUTH_CODE_CHECK;
1784 + if (debug)
1785 + fprintf(stderr, "freeipmi.plugin: noauthcodecheck workaround flag enabled\n");
1786 + } else {
1787 + if (debug)
1788 + fprintf(
1789 + stderr,
1790 + "freeipmi.plugin: noauthcodecheck workaround flag is ignored for protocol version 2.0\n");
1791 + }
1792 + continue;
1793 }
1794 else if(i < argc && strcmp("sdr-cache-dir", argv[i]) == 0) {
1795 sdr_cache_directory = argv[++i];