summaryrefslogtreecommitdiff
path: root/lib/ipmi_channel.c
diff options
context:
space:
mode:
authorAlexander Amelkin <alexander@amelkin.msk.ru>2019-06-17 17:20:04 +0300
committerAlexander Amelkin <mocbuhtig@amelkin.msk.ru>2019-07-02 13:50:12 +0300
commitc396a310ba5ca8487f32979a3397a155eefcdf12 (patch)
tree06ded28d64080a9e3002977845442a7bd70bd5f5 /lib/ipmi_channel.c
parent002e1d95f50462efa92fe025080544467dc72407 (diff)
downloadipmitool-c396a310ba5ca8487f32979a3397a155eefcdf12.tar.gz
event: Fix event submission via SSIF
IPMI 2.0 specification is quite inconsistent about system interfaces. They have section 1.7.16 "System Interfaces" that clearly states that there are FOUR system interfaces (KCS, SMIC, BT and SSIF), but then they have section 1.7.31 saying that "It is mandatory to implement a system interface that is compatible with one of the **three** specified system interfaces" without specifying which three of the four interfaces are meant. Then in section 6 "IPMI Messaging interfaces" they again say that "As mentioned earlier, there are three System Interface implementations specified for the BMC: SMIC, KCS, and BT". Is all looks like during update from 1.5 to 2.0 they have updated section 1.7.16, but forgot to update Table 6-3, section 1.7.31 and section 6. Yet again, there is 'Get System Interface Capabilities' command that has a parameter 'System Interface Type' that can specify that SI is of SSIF type. All that have lead to a situation where some BMC manufacturers treated the specification as if it prohibited specifying media type 0xC (which is "System Interface") for system interfaces using SSIF (SMBus Sustem Interface), and so they specified an SMBUS media type for their system interface channels. As a result, ipmitool failed to properly send event data via such system interfaces as it treated them as non-system and didn't add the required Generator ID. To mitigate the inconsistency of IPMI specification and yet not ask BMC manufacturers to alter their code, thus increasing compatibility with legacy BMCs, this commit adds checking of current interface number. The system interface, according to Table 6-1 of IPMI Specification is required to have channel number 15 (0Fh). So with this commit the generator ID is added for any interfaces that are either marked as media type 0Ch 'System Interface' or have channel number 0Fh. Resolves ipmitool/ipmitool#111 Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
Diffstat (limited to 'lib/ipmi_channel.c')
-rw-r--r--lib/ipmi_channel.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/lib/ipmi_channel.c b/lib/ipmi_channel.c
index 65da32a..a6a6a42 100644
--- a/lib/ipmi_channel.c
+++ b/lib/ipmi_channel.c
@@ -244,10 +244,28 @@ ipmi_1_5_authtypes(uint8_t n)
return supportedTypes;
}
-uint8_t
-ipmi_current_channel_medium(struct ipmi_intf *intf)
+void
+ipmi_current_channel_info(struct ipmi_intf *intf,
+ struct channel_info_t *chinfo)
{
- return ipmi_get_channel_medium(intf, 0xE);
+ int ccode = 0;
+
+ chinfo->channel = CH_CURRENT;
+ ccode = _ipmi_get_channel_info(intf, chinfo);
+ if (ccode) {
+ if (ccode != IPMI_CC_INV_DATA_FIELD_IN_REQ) {
+ if (ccode > 0) {
+ lprintf(LOG_ERR, "Get Channel Info command failed: %s",
+ val2str(ccode, completion_code_vals));
+ }
+ else {
+ eval_ccode(ccode);
+ }
+ }
+ chinfo->channel = CH_UNKNOWN;
+ chinfo->medium = IPMI_CHANNEL_MEDIUM_RESERVED;
+ }
+ return;
}
/**
@@ -684,13 +702,16 @@ ipmi_get_channel_medium(struct ipmi_intf *intf, uint8_t channel)
channel_info.channel = channel;
ccode = _ipmi_get_channel_info(intf, &channel_info);
- if (ccode == 0xCC) {
- return IPMI_CHANNEL_MEDIUM_RESERVED;
- } else if (ccode < 0 && eval_ccode(ccode) != 0) {
- return 0;
- } else if (ccode) {
- lprintf(LOG_ERR, "Get Channel Info command failed: %s",
- val2str(ccode, completion_code_vals));
+ if (ccode) {
+ if (ccode != IPMI_CC_INV_DATA_FIELD_IN_REQ) {
+ if (ccode > 0) {
+ lprintf(LOG_ERR, "Get Channel Info command failed: %s",
+ val2str(ccode, completion_code_vals));
+ }
+ else {
+ eval_ccode(ccode);
+ }
+ }
return IPMI_CHANNEL_MEDIUM_RESERVED;
}
lprintf(LOG_DEBUG, "Channel type: %s",