sensorhandler: Enable mutability based set function
Resolves openbmc/openbmc#2980
Change-Id: I67afd4e84ec96e5cfc2dd315604d70f41c67a438
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 3a47e20..1a66a1e 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -379,6 +379,13 @@
try
{
+ if (ipmi::sensor::Mutability::Write !=
+ (iter->second.mutability & ipmi::sensor::Mutability::Write))
+ {
+ log<level::ERR>("Sensor Set operation is not allowed",
+ entry("SENSOR_NUM=%d", cmdData.number));
+ return IPMI_CC_ILLEGAL_COMMAND;
+ }
return iter->second.updateFunc(cmdData, iter->second);
}
catch (InternalFailure& e)