Display message and exit if keepalive fails during SOL

This commit is contained in:
Duncan Laurie 2006-03-19 18:29:07 +00:00
parent d80fa31411
commit 64af2f2bdb
2 changed files with 22 additions and 3 deletions

View File

@ -7,6 +7,7 @@ version 1.8.7
* Add support for IBM OEM SEL messages
* Disable file paranoia checks on read files by default
* Support IPMIv2 SOL on older Intel boxes
* Display message and exit if keepalive fails during SOL
version 1.8.6
* Fix memory corruption when sending encrypted SOL traffic

View File

@ -1278,17 +1278,20 @@ processSolUserInput(
}
static void
static int
ipmi_sol_keepalive(struct ipmi_intf * intf)
{
struct timeval end;
int ret = 0;
gettimeofday(&end, 0);
if (end.tv_sec - _start_keepalive.tv_sec > SOL_KEEPALIVE_TIMEOUT) {
intf->keepalive(intf);
ret = intf->keepalive(intf);
gettimeofday(&_start_keepalive, 0);
}
return ret;
}
@ -1307,6 +1310,7 @@ ipmi_sol_red_pill(struct ipmi_intf * intf)
struct timeval tv;
int retval;
int buffer_size = intf->session->sol_data.max_inbound_payload_size;
int keepAliveRet = 0;
buffer = (char*)malloc(buffer_size);
if (buffer == NULL) {
@ -1326,7 +1330,13 @@ ipmi_sol_red_pill(struct ipmi_intf * intf)
FD_SET(intf->fd, &read_fds);
/* Send periodic keepalive packet */
ipmi_sol_keepalive(intf);
keepAliveRet = ipmi_sol_keepalive(intf);
if (keepAliveRet != 0)
{
/* no response to keepalive message */
bShouldExit = 1;
continue;
}
/* Wait up to half a second */
tv.tv_sec = 0;
@ -1401,6 +1411,14 @@ ipmi_sol_red_pill(struct ipmi_intf * intf)
leave_raw_mode();
if (keepAliveRet != 0)
{
lprintf(LOG_ERR, "Error: No response to keepalive - Terminating session");
/* attempt to clean up anyway */
ipmi_sol_deactivate(intf);
exit(1);
}
if (bBmcClosedSession)
{
lprintf(LOG_ERR, "SOL session closed by BMC");