Index: b/lib/ipmi_sol.c =================================================================== --- a/lib/ipmi_sol.c +++ b/lib/ipmi_sol.c @@ -1487,8 +1487,20 @@ ipmi_sol_keepalive_using_sol(struct ipmi v2_payload.payload.sol_packet.character_count = 0; + /* ipmi_lanplus_send_so returns zero when BMC fails to ack sol keepalive packet */ rsp = intf->send_sol(intf, &v2_payload); + if ((! rsp) && (_keepalive_retries < SOL_KEEPALIVE_RETRIES) ) { + _keepalive_retries++; + ret = -1; + } + else if ((! rsp) && (_keepalive_retries >= SOL_KEEPALIVE_RETRIES) ) { + ret = -1; + } + else if (( rsp ) && (_keepalive_retries > 0)) + _keepalive_retries = 0; + + /* reset the start time of the keepalive timeout */ gettimeofday(&_start_keepalive, 0); } return ret; @@ -1506,9 +1518,9 @@ ipmi_sol_keepalive_using_getdeviceid(str gettimeofday(&end, 0); if (end.tv_sec - _start_keepalive.tv_sec > SOL_KEEPALIVE_TIMEOUT) { + /* returns -1 on fail, returns 0 on success */ ret = intf->keepalive(intf); if ( (ret!=0) && (_keepalive_retries < SOL_KEEPALIVE_RETRIES) ) { - ret = 0; _keepalive_retries++; } else if ((ret==0) && (_keepalive_retries > 0)) @@ -1564,8 +1576,8 @@ ipmi_sol_red_pill(struct ipmi_intf * int keepAliveRet = ipmi_sol_keepalive_using_sol(intf); } - if (keepAliveRet != 0) - { + lprintf(LOG_DEBUG , "ipmitool-sol.c : keepAliveRet %d | _keepalive_retries %d", keepAliveRet, _keepalive_retries); + /* * Retrying the keep Alive before declaring a communication * lost state with the IPMC. Helpful when the payload is @@ -1574,22 +1586,15 @@ ipmi_sol_red_pill(struct ipmi_intf * int * this down time when the connection is restarting, SOL will * exit even though the IPMC is available and the session is open. */ - if (retrySol == MAX_SOL_RETRY) - { - /* no response to Get Device ID keepalive message */ + + + /* use static var to track whether a keepalive failure has occurred */ + if (_keepalive_retries >= SOL_KEEPALIVE_RETRIES) { + /* no response to keepalive messages */ bShouldExit = 1; + lprintf(LOG_ERR , "Error: ipmitool SOL too many keepalive retries"); continue; } - else - { - retrySol++; - } - } - else - { - /* if the keep Alive is successful reset retries to zero */ - retrySol = 0; - } /* Wait up to half a second */ tv.tv_sec = 0;