transporthandler:Change for set and get lan config
This patch allows to use self/current channel(0x0E) as input parameter
in set and get lan configuration commands
Tested:
Before:
Command: ipmitool -I lanplus -H <BMC-IP> -U <User> -P <Pwd> raw 0x0c
0x01 0x0E 0xC7 0x01 0x01 0x31 0x71 0x71 0x71 0x71 071 0x71
0x71 0x71 0x71 0x71 0x71 0x71 0x71 0x71
Response: Unable to send RAW command (channel=0x0 netfn=0xc lun=0x0
cmd=0x1 rsp=0xff): Unspecified error
Command: ipmitool -I lanplus -H <BMC-IP> -U <User> -P <Pwd> raw 0x0c
0x02 0x0E 0x16 0x00 0x00
Response: Unable to send RAW command (channel=0x0 netfn=0xc lun=0x0
cmd=0x2 rsp=0xff): Unspecified error
After:
Command: ipmitool -I lanplus -H <BMC-IP> -U <User> -P <Pwd> raw 0x0c
0x01 0x0E 0xC7 0x01 0x01 0x31 0x71 0x71 0x71 0x71 071 0x71 0x71
0x71 0x71 0x71 0x71 0x71 0x71 0x71
Response: //success
Command: ipmitool -I lanplus -H <BMC-IP> -U <User> -P <Pwd> raw 0x0c
0x02 0x0E 0x16 0x00 0x00
Response: 11 02
Signed-off-by: vijayabharathix shetty <vijayabharathix.shetty@intel.com>
Change-Id: Icdffe4b95ade13a4beb9953d8f1994cbadc64993
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 7b88909..4479489 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -1338,12 +1338,14 @@
return true;
}
-RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter,
- message::Payload& req)
+RspType<> setLan(Context::ptr ctx, uint4_t channelBits, uint4_t reserved1,
+ uint8_t parameter, message::Payload& req)
{
- auto channel = static_cast<uint8_t>(channelBits);
- if (!doesDeviceExist(channel))
+ const uint8_t channel = convertCurrentChannelNum(
+ static_cast<uint8_t>(channelBits), ctx->channel);
+ if (reserved1 || !isValidChannel(channel))
{
+ log<level::ERR>("Set Lan - Invalid field in request");
req.trailingOk = true;
return responseInvalidFieldRequest();
}
@@ -1681,7 +1683,8 @@
return response(ccParamNotSupported);
}
-RspType<message::Payload> getLan(uint4_t channelBits, uint3_t, bool revOnly,
+RspType<message::Payload> getLan(Context::ptr ctx, uint4_t channelBits,
+ uint3_t reserved, bool revOnly,
uint8_t parameter, uint8_t set, uint8_t block)
{
message::Payload ret;
@@ -1693,9 +1696,11 @@
return responseSuccess(std::move(ret));
}
- auto channel = static_cast<uint8_t>(channelBits);
- if (!doesDeviceExist(channel))
+ const uint8_t channel = convertCurrentChannelNum(
+ static_cast<uint8_t>(channelBits), ctx->channel);
+ if (reserved || !isValidChannel(channel))
{
+ log<level::ERR>("Get Lan - Invalid field in request");
return responseInvalidFieldRequest();
}