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
diff --git a/transporthandler.cpp b/transporthandler.cpp
index d0768ac..8795c1a 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -428,7 +428,12 @@
     // 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 @@
     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
     {