Set the current interface number based on the channel name
Now that netipmid is launched with -c <channel_name>, it is possible
to look up the channel number for the 'current channel' 0x0e for
commands that get handled for session init/fini. This is needed for
tools that request channel access info for the current channel.
Tested-by: run ipmitool to establish a session, using -vvvvv
see that the get channel auth command returns the correct
channel ID.
In this config, eth0 is channel 3 and eth1 is channel 1.
As is evident by the highlighted <0X> byte in each of the
returned responses, the value of the current channel byte
went from a hard-coded value 03 to a value that changed with
the current channel.
Before:
ipmitool -H <ip of eth0> ... mc info
...
>> sending packet (23 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 09 20 18
c8 81 00 38 0e 04 35
<< received packet (31 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 10 81 1c
63 20 00 38 00<03>80 04 02 00 00 00 00 1f 00
ipmitool -H <ip of eth1> ... mc info
...
>> sending packet (23 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 09 20 18
c8 81 00 38 0e 04 35
<< received packet (31 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 10 81 1c
63 20 00 38 00<03>80 04 02 00 00 00 00 1f 00
After:
ipmitool -H <ip of eth0> ... mc info
...
>> sending packet (23 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 09 20 18
c8 81 00 38 8e 04 b5
<< received packet (31 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 10 81 1c
63 20 00 38 00<03>80 04 02 00 00 00 00 1f 00
ipmitool -H <ip of eth1> ... mc info
...
>> sending packet (23 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 09 20 18
c8 81 00 38 8e 04 b5
<< received packet (31 bytes)
06 00 ff 07 00 00 00 00 00 00 00 00 00 10 81 1c
63 20 00 38 00<01>80 04 02 00 00 00 00 21 00
Change-Id: I743260a6924606b9ad3eeb8b49bda424dc0ba3d7
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/command/channel_auth.cpp b/command/channel_auth.cpp
index 67ad8c7..f719452 100644
--- a/command/channel_auth.cpp
+++ b/command/channel_auth.cpp
@@ -19,7 +19,10 @@
std::vector<uint8_t> errorPayload{IPMI_CC_REQ_DATA_LEN_INVALID};
return errorPayload;
}
- uint8_t chNum = ipmi::convertCurrentChannelNum(request->channelNumber);
+ constexpr unsigned int channelMask = 0x0f;
+ uint8_t chNum = ipmi::convertCurrentChannelNum(
+ request->channelNumber & channelMask, getInterfaceIndex());
+
if (!ipmi::isValidChannel(chNum) ||
(ipmi::EChannelSessSupported::none ==
ipmi::getChannelSessionSupport(chNum)) ||