summaryrefslogtreecommitdiff
path: root/lib/ipmi_hpmfwupg.c
diff options
context:
space:
mode:
authorZdenek Styblik <stybla@turnovfree.net>2015-03-11 19:41:34 +0100
committerZdenek Styblik <stybla@turnovfree.net>2015-03-11 19:41:34 +0100
commiteb54136775f63a6a159f3c55ee4772d7aa363cc4 (patch)
treeda4c45775bbf5143e5e1e9ec093b826c152ad557 /lib/ipmi_hpmfwupg.c
parent9caa78be38f2bdf1f3c03571f0c7310a1cb486b7 (diff)
downloadipmitool-eb54136775f63a6a159f3c55ee4772d7aa363cc4.tar.gz
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
Diffstat (limited to 'lib/ipmi_hpmfwupg.c')
-rw-r--r--lib/ipmi_hpmfwupg.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/ipmi_hpmfwupg.c b/lib/ipmi_hpmfwupg.c
index 9dfa0f3..2a4925c 100644
--- a/lib/ipmi_hpmfwupg.c
+++ b/lib/ipmi_hpmfwupg.c
@@ -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;