summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuryakanth Sekar <suryakanth.sekar@linux.intel.com>2019-08-08 15:16:52 +0530
committerTom Joseph <tomjoseph@in.ibm.com>2019-08-27 11:42:26 +0000
commite405440f87a4748a7ec116eb3ec44693ede8cf79 (patch)
tree40cf863ed9b17a43aa2622151305231107bc8cea
parentc2b7fc1fc67cc18f8e602eb6bd232b65c991a6e2 (diff)
downloadphosphor-host-ipmid-e405440f87a4748a7ec116eb3ec44693ede8cf79.tar.gz
phosphor-host-ipmid-e405440f87a4748a7ec116eb3ec44693ede8cf79.zip
Set/Get LAN conf 0xCC return for invalid LAN chnl
In set /get LAN configuration Channel number should be validate before process the request and we have to handle only LAN medium Channel. Tested: In Get/ Set LAN configuraion,0xCC should be return for non LAN channel numbers. Trying to set the IP Source to the Invalid /Valid LAN channel ipmitool raw 0xc 0x1 <Invalid LAN channel> 0x4 2 Response : 0xCC ipmitool raw 0xc 0x1 <valid LAN channel number> 4 2 Response : 0x00 Signed-off-by: Suryakanth Sekar <suryakanth.sekar@linux.intel.com> Change-Id: I6d173f1ddaf22a5ee221b15dd3a4c7b2793ab0b5
-rw-r--r--transporthandler.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/transporthandler.cpp b/transporthandler.cpp
index d0768ac..8795c1a 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -428,7 +428,12 @@ ipmi_ret_t ipmi_transport_set_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
// channel number is the lower nibble
int channel = reqptr->channel & CHANNEL_MASK;
auto ethdevice = ipmi::getChannelName(channel);
- if (ethdevice.empty())
+ ipmi::ChannelInfo chInfo;
+ ipmi::getChannelInfo(channel, chInfo);
+
+ if (ethdevice.empty() ||
+ chInfo.mediumType !=
+ static_cast<uint8_t>(ipmi::EChannelMediumType::lan8032))
{
return IPMI_CC_INVALID_FIELD_REQUEST;
}
@@ -556,6 +561,13 @@ ipmi_ret_t ipmi_transport_get_lan(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
get_lan_t* reqptr = (get_lan_t*)request;
// channel number is the lower nibble
int channel = reqptr->rev_channel & CHANNEL_MASK;
+ ipmi::ChannelInfo chInfo;
+ ipmi::getChannelInfo(channel, chInfo);
+ if (chInfo.mediumType !=
+ static_cast<uint8_t>(ipmi::EChannelMediumType::lan8032))
+ {
+ return IPMI_CC_INVALID_FIELD_REQUEST;
+ }
if (reqptr->rev_channel & 0x80) // Revision is bit 7
{
OpenPOWER on IntegriCloud