channel:Fix get channel ciphersuite - payloadtypes
Issue: Get channel CipherSuite command passed with invalid payload type
Fix: Added the check now to allow only valid payload types
Tested:
Command: ipmitool raw 0x06 0x54 0x01 0xff 0x80
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0 cmd=0x54
rsp=0x80): Unknown (0x80)
Command: ipmitool raw 0x06 0x54 0x01 0x12 0x80
Response: 01 c0 03 01 41 81 c0 11 03 44 81
Command: ipmitool raw 0x06 0x54 0x01 0x09 0x80
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0 cmd=0x54
rsp=0x80): Unknown (0x80)
Command: ipmitool raw 0x06 0x54 0x01 0x02 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0x6 lun=0x0 cmd=0x54
rsp=0x80): Unknown (0x80)
Command: ipmitool raw 0x06 0x54 0x01 0x12 0x00
Response: 01 01 03 41 44 81
Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I552250736d7e898191ddbb45fd1bff42681b9c63
diff --git a/app/channel.cpp b/app/channel.cpp
index 1fa5b52..51e953d 100644
--- a/app/channel.cpp
+++ b/app/channel.cpp
@@ -128,6 +128,12 @@
{
return ipmi::responseInvalidFieldRequest();
}
+ if (!ipmi::isValidPayloadType(static_cast<ipmi::PayloadType>(payloadType)))
+ {
+ log<level::DEBUG>("Get channel cipher suites - Invalid payload type");
+ constexpr uint8_t ccPayloadTypeNotSupported = 0x80;
+ return ipmi::response(ccPayloadTypeNotSupported);
+ }
if (!recordInit)
{