diff --git a/ipmitool/ChangeLog b/ipmitool/ChangeLog index 1bd21cc..64562da 100644 --- a/ipmitool/ChangeLog +++ b/ipmitool/ChangeLog @@ -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 diff --git a/ipmitool/lib/ipmi_sol.c b/ipmitool/lib/ipmi_sol.c index c4a95c5..a6a45ec 100644 --- a/ipmitool/lib/ipmi_sol.c +++ b/ipmitool/lib/ipmi_sol.c @@ -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");