From 9f66ac2cd3321ef90196dcc9922dd1cf65d4249c Mon Sep 17 00:00:00 2001 From: Jean-Michel Audet Date: Tue, 14 Nov 2006 16:08:55 +0000 Subject: [PATCH] - Fix a bug with the keepalive functionallity. When keepAlive GetDeviceId is sent and SOL traffic is received in between the answer, the SOL packet is ignore or use as an answer. - Change the keepalive function to send empty SOL packet instead of sending the getdeviceid command. --- ipmitool/lib/ipmi_sol.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ipmitool/lib/ipmi_sol.c b/ipmitool/lib/ipmi_sol.c index 2ea1286..44e7f2c 100644 --- a/ipmitool/lib/ipmi_sol.c +++ b/ipmitool/lib/ipmi_sol.c @@ -1367,11 +1367,13 @@ processSolUserInput( return retval; } - static int -ipmi_sol_keepalive(struct ipmi_intf * intf) +ipmi_sol_keepalive_using_sol(struct ipmi_intf * intf) { + struct ipmi_v2_payload v2_payload; + struct ipmi_rs * rsp = NULL; struct timeval end; + int ret = 0; if (_disable_keepalive) @@ -1380,10 +1382,14 @@ ipmi_sol_keepalive(struct ipmi_intf * intf) gettimeofday(&end, 0); if (end.tv_sec - _start_keepalive.tv_sec > SOL_KEEPALIVE_TIMEOUT) { - ret = intf->keepalive(intf); - gettimeofday(&_start_keepalive, 0); - } + memset(&v2_payload, 0, sizeof(v2_payload)); + v2_payload.payload.sol_packet.character_count = 0; + + rsp = intf->send_sol(intf, &v2_payload); + + gettimeofday(&_start_keepalive, 0); + } return ret; } @@ -1406,7 +1412,7 @@ ipmi_sol_red_pill(struct ipmi_intf * intf) buffer = (char*)malloc(buffer_size); if (buffer == NULL) { - lprintf(LOG_ERR, "ipmitool: malloc failure"); + lprintf(LOG_ERR, "ipmitool: malloc failure"); return -1; } @@ -1422,7 +1428,7 @@ ipmi_sol_red_pill(struct ipmi_intf * intf) FD_SET(intf->fd, &read_fds); /* Send periodic keepalive packet */ - keepAliveRet = ipmi_sol_keepalive(intf); + keepAliveRet = ipmi_sol_keepalive_using_sol(intf); if (keepAliveRet != 0) { /* no response to keepalive message */