Commit 0ae6fa60 authored by Michael Ott's avatar Michael Ott
Browse files

Add support for IPMI 2.0 LAN connections

parent 9a02c42f
......@@ -299,6 +299,8 @@ Explanation of the values specific for the IPMI plugin:
| retransmissiontimeout | Retransmission timeout value for the IPMI-connection
| username | For the remote IPMI-connection login credentials are required
| password | For the remote IPMI-connection login credentials are required
| ipmiversion | IPMI version to use for LAN connections (1 or 2)
| cipher | Cipher to use for IPMI 2.0 LAN connections (currently supported: 0, 1, 2, 3, 6, 7, 8, 11, 12)
| cmd | One can define a raw IPMI-command (in hex-notation) to be sent. In this case also the start and stop fields for the response have to be defined. Alternatively, one can define the record-ID of the sensor (see below).
| start | Required if raw command is sent
| stop | Required if raw command is sent
......
......@@ -48,6 +48,8 @@ void IPMIConfigurator::sensorEntity(IPMIHost& s, CFG_VAL config) {
ATTRIBUTE("username", setUserName);
ATTRIBUTE("password", setPassword);
ATTRIBUTE("mqttPart", setMqttPart);
ATTRIBUTE("cipher", setCipher);
ATTRIBUTE("ipmiVersion", setIpmiVersion);
}
}
......
......@@ -33,6 +33,8 @@ IPMIHost::IPMIHost() {
_cache = "";
_auth = IPMI_AUTHENTICATION_TYPE_MD5;
_priv = IPMI_PRIVILEGE_LEVEL_ADMIN;
_cipher = 3;
_ipmiVersion = 1;
_mqttPart = "";
_retransmissionTimeout = 0;
_sessionTimeout = 0;
......@@ -58,8 +60,14 @@ int IPMIHost::connect() {
}
int workaround_flags = 0;
int flags = 0;
if (ipmi_ctx_open_outofband(_ipmiCtx, _hostName.c_str(), _userName.c_str(), _password.c_str(), _auth, _priv, _sessionTimeout, _retransmissionTimeout, workaround_flags, flags) < 0) {
int flags = IPMI_FLAGS_DEFAULT;
int rc;
if (_ipmiVersion == 1) {
rc = ipmi_ctx_open_outofband(_ipmiCtx, _hostName.c_str(), _userName.c_str(), _password.c_str(), _auth, _priv, _sessionTimeout, _retransmissionTimeout, workaround_flags, flags);
} else {
rc = ipmi_ctx_open_outofband_2_0(_ipmiCtx, _hostName.c_str(), _userName.c_str(), _password.c_str(), NULL, 0, _priv, _cipher, _sessionTimeout, _retransmissionTimeout, workaround_flags, flags);
}
if (rc < 0) {
_errorMsg = "Error opening IPMI connection: " + std::string(ipmi_ctx_errormsg(_ipmiCtx));
ipmi_ctx_close(_ipmiCtx);
ipmi_ctx_destroy(_ipmiCtx);
......
......@@ -34,6 +34,8 @@ public:
void setPassword(const std::string& password) { _password = password; }
void setCache(const std::string& cacheDir) { _cache = cacheDir + ".ipmiPluginSdrCache." + _hostName; }
void setPriv(uint8_t priv) { _priv = priv; }
void setCipher(const std::string& cipher) { _cipher = stoi(cipher); }
void setIpmiVersion(const std::string& ipmiVersion) { _ipmiVersion = stoi(ipmiVersion); }
void setUserName(const std::string& userName) { _userName = userName; }
void setMqttPart(const std::string& mqttPart) {
_mqttPart = mqttPart;
......@@ -54,6 +56,8 @@ public:
const std::string& getPassword() const { return _password; }
const std::string& getCache() const { return _cache; }
uint8_t getPriv() const { return _priv; }
uint8_t getCipher() const { return _cipher; }
uint8_t getIpmiVersion() const { return _ipmiVersion; }
const std::string& getUserName() const { return _userName; }
const std::string& getMqttPart() const { return _mqttPart; }
boost::asio::io_service::strand* getStrand() const { return _strand; }
......@@ -78,6 +82,8 @@ private:
std::string _cache;
uint8_t _auth;
uint8_t _priv;
uint8_t _cipher;
uint8_t _ipmiVersion;
std::string _mqttPart;
uint32_t _sessionTimeout;
uint32_t _retransmissionTimeout;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment