mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
open: checking received msg id against expectation
Check the received IPMI response message id against the id expected given the IPMI request. They need to match. It is possible that request A times out, request B is sent, and then request A responds to the request B. The value for request B may be behind it in the queue. Note: This may only be possible if the file is kept open between multiple IPMI messages (a common occurrence). Resolves: #82 Signed-off-by: Patrick Venture <venture@google.com>
This commit is contained in:
parent
3bfa1da201
commit
51634fd77c
@ -341,6 +341,7 @@ ipmi_openipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
|
|||||||
FD_SET(intf->fd, &rset);
|
FD_SET(intf->fd, &rset);
|
||||||
read_timeout.tv_sec = IPMI_OPENIPMI_READ_TIMEOUT;
|
read_timeout.tv_sec = IPMI_OPENIPMI_READ_TIMEOUT;
|
||||||
read_timeout.tv_usec = 0;
|
read_timeout.tv_usec = 0;
|
||||||
|
do {
|
||||||
do {
|
do {
|
||||||
retval = select(intf->fd + 1, &rset, NULL, NULL, &read_timeout);
|
retval = select(intf->fd + 1, &rset, NULL, NULL, &read_timeout);
|
||||||
} while (retval < 0 && errno == EINTR);
|
} while (retval < 0 && errno == EINTR);
|
||||||
@ -385,6 +386,18 @@ ipmi_openipmi_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the message received wasn't expected, try to grab the
|
||||||
|
* next message until it's out of messages. -EAGAIN is
|
||||||
|
* returned if the list empty, but basically if it returns a
|
||||||
|
* message, check if it's alright.
|
||||||
|
*/
|
||||||
|
if (_req.msgid != recv.msgid) {
|
||||||
|
lprintf(LOG_NOTICE,
|
||||||
|
"Received a response with unexpected ID %ld vs. %ld",
|
||||||
|
recv.msgid, _req.msgid);
|
||||||
|
}
|
||||||
|
} while (_req.msgid != recv.msgid);
|
||||||
|
|
||||||
if (verbose > 4) {
|
if (verbose > 4) {
|
||||||
fprintf(stderr, "Got message:");
|
fprintf(stderr, "Got message:");
|
||||||
fprintf(stderr, " type = %d\n", recv.recv_type);
|
fprintf(stderr, " type = %d\n", recv.recv_type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user