ID:319 - Interface safe re-open

Currently, interface-management code in the ipmitool does not allow safe
interface re-opening (i.e. closing and opening again). It is because the session
is allocated in the interface setup callback while is freed in the close
callback. So, normal re-opening of the interface, which can be required for
example durng the HPM.1 upgrade, leads to segmentation fault. That's why in the
ipmi_hpmfwupg.c instead of normal closing interface, directly access the
interface data for subsequent re-opening.

Commit for Dmitry Bazhenov
This commit is contained in:
Zdenek Styblik
2015-03-11 19:41:34 +01:00
parent 9caa78be38
commit eb54136775
14 changed files with 290 additions and 339 deletions

View File

@@ -2194,18 +2194,15 @@ HpmfwupgSendCmd(struct ipmi_intf *intf, struct ipmi_rq req,
lprintf(LOG_DEBUG, "HPM: try to re-open IOL session");
{
/* force session re-open */
intf->opened = 0;
intf->session->authtype = IPMI_SESSION_AUTHTYPE_NONE;
intf->session->session_id = 0;
intf->session->in_seq = 0;
intf->session->out_seq = 0;
intf->session->active = 0;
intf->session->retry = 10;
intf->abort = 1;
intf->close(intf);
while (intf->open(intf) == HPMFWUPG_ERROR
&& inaccessTimeoutCounter < inaccessTimeout) {
inaccessTimeoutCounter += (time(NULL) - timeoutSec1);
timeoutSec1 = time(NULL);
}
/* Fake timeout to retry command */
fakeRsp.ccode = 0xc3;
rsp = &fakeRsp;