Describe the bug
A clear and concise description of what the bug is.
Please DO NOT report ANYTHING about 1.8.18, it is outdated. Please first check your alleged bug with the latest code from the top of the master branch here.
IPMITOOL Version
Make sure you're reporting a bug in the latest code taken from master branch here, NOT a bug
that you've found in some version that you've got from your OS vendor or any source other than this repository.
$ ipmitool -V
ipmitool version 1.8.19
To Reproduce
Steps to reproduce the behavior:
- I have two BMC (OpenBMC) connected with IPMB over I2C. Their IPs are bmc_ip1/2.
- Run
ipmitool -I lanplus -H <bmc_ip1> -U xxx -P xxx -b 0 -t 4 sensor list
- Observe the abnormal reply:
FAN1_PWM | 23.000 | percent | ok | na | na | na | na | na | na
FAN2_PWM | 31.000 | percent | ok | na | na | na | na | na | na
FAN3_PWM | 22.000 | percent | ok | na | na | na | na | na | na
FAN4_PWM | 29.000 | percent | ok | na | na | na | na | na | na
FAN1_F_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN1_R_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN2_F_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN2_R_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN3_F_RPM | 15996.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN3_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_F_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
......
- Run
ipmitool -I lanplus -H <bmc_ip2> -U xxx -P xxx sensor list
- Observe the normal reply:
FAN1_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN2_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN3_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN4_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN1_F_RPM | 15996.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN1_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN2_F_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN2_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN3_F_RPM | 15996.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN3_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_F_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
......
- Generally other commands are handled normally, except for 'sdr list', 'sensor list' and 'fru print'
Expected behavior
Two results are the same.
Additional context
When I study the code of ipmitool, I observe that it's the MACRO 'BRIDGE_TO_SENSOR' in include/ipmi_sdr.h that affected the result. If I manually set 'BRIDGE_TO_SENSOR' to false, the result of ipmitool command is normal.
#define BRIDGE_TO_SENSOR(_intf, _addr, _chan) \
( !((_chan == 0 && _intf->target_ipmb_addr && \
_intf->target_ipmb_addr == _addr) || \
(_addr == _intf->target_addr && _chan == _intf->target_channel)) )
I add some print, and see the values in the MACRO:
_chan = 0
_intf->target_ipmb_addr = 0
_addr = 0x20
_intf->target_addr = 4
_intf->target_channel = 0
It seems that _intf->target_ipmb_addr is obtained via netFn 0x2C cmd 0x01 (in ipmi_picmg_ipmb_address, or 0x40 in ipmi_vita_ipmb_address), which is not a standard command to get target_ipmb_addr?
**Describe the bug**
A clear and concise description of what the bug is.
*Please **DO NOT** report ANYTHING about 1.8.18, it is outdated. Please first check your alleged bug with the latest code from the top of the master branch here.*
**IPMITOOL Version**
Make sure you're reporting a bug in the latest code taken from `master` branch here, NOT a bug
that you've found in some version that you've got from your OS vendor or any source other than this repository.
```none
$ ipmitool -V
ipmitool version 1.8.19
```
**To Reproduce**
Steps to reproduce the behavior:
1. I have two BMC (OpenBMC) connected with IPMB over I2C. Their IPs are bmc_ip1/2.
2. Run `ipmitool -I lanplus -H <bmc_ip1> -U xxx -P xxx -b 0 -t 4 sensor list`
3. Observe the abnormal reply:
```none
FAN1_PWM | 23.000 | percent | ok | na | na | na | na | na | na
FAN2_PWM | 31.000 | percent | ok | na | na | na | na | na | na
FAN3_PWM | 22.000 | percent | ok | na | na | na | na | na | na
FAN4_PWM | 29.000 | percent | ok | na | na | na | na | na | na
FAN1_F_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN1_R_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN2_F_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN2_R_RPM | 7310.000 | RPM | ok | na | na | na | na | na | na
FAN3_F_RPM | 15996.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN3_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_F_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
......
```
4. Run `ipmitool -I lanplus -H <bmc_ip2> -U xxx -P xxx sensor list`
5. Observe the normal reply:
```none
FAN1_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN2_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN3_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN4_PWM | 85.000 | percent | ok | na | na | na | na | na | na
FAN1_F_RPM | 15996.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN1_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN2_F_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN2_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN3_F_RPM | 15996.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN3_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_F_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
FAN4_R_RPM | 15910.000 | RPM | ok | na | 430.000 | na | na | na | na
......
```
6. Generally other commands are handled normally, except for 'sdr list', 'sensor list' and 'fru print'
**Expected behavior**
Two results are the same.
**Additional context**
When I study the code of ipmitool, I observe that it's the MACRO 'BRIDGE_TO_SENSOR' in include/ipmi_sdr.h that affected the result. If I manually set 'BRIDGE_TO_SENSOR' to false, the result of ipmitool command is normal.
```none
#define BRIDGE_TO_SENSOR(_intf, _addr, _chan) \
( !((_chan == 0 && _intf->target_ipmb_addr && \
_intf->target_ipmb_addr == _addr) || \
(_addr == _intf->target_addr && _chan == _intf->target_channel)) )
```
I add some print, and see the values in the MACRO:
```none
_chan = 0
_intf->target_ipmb_addr = 0
_addr = 0x20
_intf->target_addr = 4
_intf->target_channel = 0
```
It seems that _intf->target_ipmb_addr is obtained via netFn 0x2C cmd 0x01 (in ipmi_picmg_ipmb_address, or 0x40 in ipmi_vita_ipmb_address), which is not a standard command to get target_ipmb_addr?