netipmid: SOL payload activation control.
Activate the SOL payload session only if 'user payload access' allows.
IPMI Spec reference: Section 24.6, 24.7.
Tested-by:
1. For user 15 in channel 3, Disable SOL payload and activate sol.
// Command - (channel 3 is of LAN channel type)
ipmitool -I lanplus...raw 0x4C 3 0x4F 0x2 0 0 0
// Try to launch SOL session.
ipmitool -v -I lanplus -U saravanan...sol activate
Info: SOL payload disabled. <Compl Code : 0x81> // Response
2. For user 15 in channel 3, Enable SOL payload and activate sol.
// Command
ipmitool -I lanplus...raw 0x4C 3 0xF 0x2 0 0 0
// Try to launch SOL session.
ipmitool -I lanplus -U saravanan...sol activate
[SOL Session operational. Use ~? for help] // Response
Signed-off-by: Saravanan Palanisamy <saravanan.palanisamy@linux.intel.com>
Change-Id: I5436572349b116ffc2e4f1605db8233186c0bd3d
diff --git a/command/payload_cmds.cpp b/command/payload_cmds.cpp
index c32a510..683d21a 100644
--- a/command/payload_cmds.cpp
+++ b/command/payload_cmds.cpp
@@ -56,6 +56,18 @@
return outPayload;
}
+ // Is SOL Payload enabled for this user & channel.
+ auto userId = ipmi::ipmiUserGetUserId(session->userName);
+ ipmi::PayloadAccess payloadAccess = {};
+ if ((ipmi::ipmiUserGetUserPayloadAccess(session->channelNum(), userId,
+ payloadAccess) != IPMI_CC_OK) ||
+ !(payloadAccess.stdPayloadEnables1[static_cast<uint8_t>(
+ message::PayloadType::SOL)]))
+ {
+ response->completionCode = IPMI_CC_PAYLOAD_TYPE_DISABLED;
+ return outPayload;
+ }
+
auto status = std::get<sol::Manager&>(singletonPool)
.isPayloadActive(request->payloadInstance);
if (status)