mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
ID: #279 ipmitool sdr list broken
Restoration of the interface target address and channel after a bridged request was incorrectly tied to a non-zero saved target address. This does not work for the Openipmi interface because the default interface target address for the Openipmi interface is zero by default.
This commit is contained in:
parent
ac9513025c
commit
45d0a4255a
@ -2941,7 +2941,8 @@ int
|
||||
ipmi_fru_print(struct ipmi_intf * intf, struct sdr_record_fru_locator * fru)
|
||||
{
|
||||
char desc[17];
|
||||
uint32_t save_addr = 0;
|
||||
uint8_t bridged_request = 0;
|
||||
uint32_t save_addr;
|
||||
uint32_t save_channel;
|
||||
int rc = 0;
|
||||
|
||||
@ -2984,6 +2985,7 @@ ipmi_fru_print(struct ipmi_intf * intf, struct sdr_record_fru_locator * fru)
|
||||
case 0x02:
|
||||
if (BRIDGE_TO_SENSOR(intf, fru->dev_slave_addr,
|
||||
fru->channel_num)) {
|
||||
bridged_request = 1;
|
||||
save_addr = intf->target_addr;
|
||||
intf->target_addr = fru->dev_slave_addr;
|
||||
save_channel = intf->target_channel;
|
||||
@ -2991,7 +2993,7 @@ ipmi_fru_print(struct ipmi_intf * intf, struct sdr_record_fru_locator * fru)
|
||||
}
|
||||
/* print FRU */
|
||||
rc = __ipmi_fru_print(intf, fru->device_id);
|
||||
if (save_addr) {
|
||||
if (bridged_request) {
|
||||
intf->target_addr = save_addr;
|
||||
intf->target_channel = save_channel;
|
||||
}
|
||||
|
@ -456,10 +456,12 @@ ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, uint8_t sensor,
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs *rsp;
|
||||
uint32_t save_addr = 0;
|
||||
uint8_t bridged_request = 0;
|
||||
uint32_t save_addr;
|
||||
uint32_t save_channel;
|
||||
|
||||
if ( BRIDGE_TO_SENSOR(intf, target, channel) ) {
|
||||
bridged_request = 1;
|
||||
save_addr = intf->target_addr;
|
||||
intf->target_addr = target;
|
||||
save_channel = intf->target_channel;
|
||||
@ -474,7 +476,7 @@ ipmi_sdr_get_sensor_thresholds(struct ipmi_intf *intf, uint8_t sensor,
|
||||
req.msg.data_len = sizeof (sensor);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if ( save_addr ) {
|
||||
if (bridged_request) {
|
||||
intf->target_addr = save_addr;
|
||||
intf->target_channel = save_channel;
|
||||
}
|
||||
@ -498,10 +500,12 @@ ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, uint8_t sensor,
|
||||
struct ipmi_rq req;
|
||||
uint8_t rqdata[2];
|
||||
struct ipmi_rs *rsp;
|
||||
uint32_t save_addr = 0;
|
||||
uint8_t bridged_request = 0;
|
||||
uint32_t save_addr;
|
||||
uint32_t save_channel;
|
||||
|
||||
if ( BRIDGE_TO_SENSOR(intf, target, channel) ) {
|
||||
bridged_request = 1;
|
||||
save_addr = intf->target_addr;
|
||||
intf->target_addr = target;
|
||||
save_channel = intf->target_channel;
|
||||
@ -519,7 +523,7 @@ ipmi_sdr_get_sensor_hysteresis(struct ipmi_intf *intf, uint8_t sensor,
|
||||
req.msg.data_len = 2;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if ( save_addr ) {
|
||||
if (bridged_request) {
|
||||
intf->target_addr = save_addr;
|
||||
intf->target_channel = save_channel;
|
||||
}
|
||||
@ -564,10 +568,17 @@ ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, uint8_t sensor,
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs *rsp;
|
||||
uint32_t save_addr = 0;
|
||||
uint8_t bridged_request = 0;
|
||||
uint32_t save_addr;
|
||||
uint32_t save_channel;
|
||||
|
||||
if ( BRIDGE_TO_SENSOR(intf, target, channel) ) {
|
||||
lprintf(LOG_DEBUG,
|
||||
"Bridge to Sensor "
|
||||
"Intf my/%#x tgt/%#x:%#x Sdr tgt/%#x:%#x\n",
|
||||
intf->my_addr, intf->target_addr, intf->target_channel,
|
||||
target, channel);
|
||||
bridged_request = 1;
|
||||
save_addr = intf->target_addr;
|
||||
intf->target_addr = target;
|
||||
save_channel = intf->target_channel;
|
||||
@ -581,7 +592,7 @@ ipmi_sdr_get_sensor_reading_ipmb(struct ipmi_intf *intf, uint8_t sensor,
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if ( save_addr ) {
|
||||
if (bridged_request) {
|
||||
intf->target_addr = save_addr;
|
||||
intf->target_channel = save_channel;
|
||||
}
|
||||
@ -604,10 +615,12 @@ ipmi_sdr_get_sensor_event_status(struct ipmi_intf *intf, uint8_t sensor,
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs *rsp;
|
||||
uint32_t save_addr = 0;
|
||||
uint8_t bridged_request = 0;
|
||||
uint32_t save_addr;
|
||||
uint32_t save_channel;
|
||||
|
||||
if ( BRIDGE_TO_SENSOR(intf, target, channel) ) {
|
||||
bridged_request = 1;
|
||||
save_addr = intf->target_addr;
|
||||
intf->target_addr = target;
|
||||
save_channel = intf->target_channel;
|
||||
@ -621,7 +634,7 @@ ipmi_sdr_get_sensor_event_status(struct ipmi_intf *intf, uint8_t sensor,
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if ( save_addr ) {
|
||||
if (bridged_request) {
|
||||
intf->target_addr = save_addr;
|
||||
intf->target_channel = save_channel;
|
||||
}
|
||||
@ -644,10 +657,12 @@ ipmi_sdr_get_sensor_event_enable(struct ipmi_intf *intf, uint8_t sensor,
|
||||
{
|
||||
struct ipmi_rq req;
|
||||
struct ipmi_rs *rsp;
|
||||
uint32_t save_addr = 0;
|
||||
uint8_t bridged_request = 0;
|
||||
uint32_t save_addr;
|
||||
uint32_t save_channel;
|
||||
|
||||
if ( BRIDGE_TO_SENSOR(intf, target, channel) ) {
|
||||
bridged_request = 1;
|
||||
save_addr = intf->target_addr;
|
||||
intf->target_addr = target;
|
||||
save_channel = intf->target_channel;
|
||||
@ -662,7 +677,7 @@ ipmi_sdr_get_sensor_event_enable(struct ipmi_intf *intf, uint8_t sensor,
|
||||
req.msg.data_len = 1;
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if ( save_addr ) {
|
||||
if (bridged_request) {
|
||||
intf->target_addr = save_addr;
|
||||
intf->target_channel = save_channel;
|
||||
}
|
||||
|
@ -110,7 +110,8 @@ ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
|
||||
struct ipmi_rq req;
|
||||
static struct sensor_set_thresh_rq set_thresh_rq;
|
||||
struct ipmi_rs *rsp;
|
||||
uint32_t save_addr = 0;
|
||||
uint8_t bridged_request = 0;
|
||||
uint32_t save_addr;
|
||||
uint32_t save_channel;
|
||||
|
||||
memset(&set_thresh_rq, 0, sizeof (set_thresh_rq));
|
||||
@ -132,6 +133,7 @@ ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
|
||||
return NULL;
|
||||
|
||||
if (BRIDGE_TO_SENSOR(intf, target, channel)) {
|
||||
bridged_request = 1;
|
||||
save_addr = intf->target_addr;
|
||||
intf->target_addr = target;
|
||||
save_channel = intf->target_channel;
|
||||
@ -145,7 +147,7 @@ ipmi_sensor_set_sensor_thresholds(struct ipmi_intf *intf,
|
||||
req.msg.data_len = sizeof (set_thresh_rq);
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (save_addr) {
|
||||
if (bridged_request) {
|
||||
intf->target_addr = save_addr;
|
||||
intf->target_channel = save_channel;
|
||||
}
|
||||
|
@ -187,8 +187,9 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
/* use IPMB address if needed */
|
||||
ipmb_addr.slave_addr = intf->target_addr;
|
||||
ipmb_addr.lun = req->msg.lun;
|
||||
lprintf(LOG_DEBUG, "Sending request to "
|
||||
lprintf(LOG_DEBUG, "Sending request 0x%x to "
|
||||
"IPMB target @ 0x%x:0x%x (from 0x%x)",
|
||||
req->msg.cmd,
|
||||
intf->target_addr,intf->target_channel, intf->my_addr);
|
||||
|
||||
if(intf->transit_addr != 0 && intf->transit_addr != intf->my_addr) {
|
||||
@ -257,8 +258,8 @@ ipmi_openipmi_send_cmd(struct ipmi_intf * intf, struct ipmi_rq * req)
|
||||
_req.addr_len = sizeof(ipmb_addr);
|
||||
} else {
|
||||
/* otherwise use system interface */
|
||||
lprintf(LOG_DEBUG+2, "Sending request to "
|
||||
"System Interface");
|
||||
lprintf(LOG_DEBUG+2, "Sending request 0x%x to "
|
||||
"System Interface", req->msg.cmd);
|
||||
bmc_addr.lun = req->msg.lun;
|
||||
_req.addr = (unsigned char *) &bmc_addr;
|
||||
_req.addr_len = sizeof(bmc_addr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user