From dbd2db71f227a5c0a0926bd5cd8ccb03ccd59f2a Mon Sep 17 00:00:00 2001 From: Zdenek Styblik Date: Sun, 7 Jul 2013 15:28:13 +0000 Subject: [PATCH] ID: 253 - Fix lanplus retransmission Retransmission of lanplus request is broken. ipmi_lanplus_send_payload() keeps current timeout in local variable 'timeout' and increases it by one with each retransmission. But ipmi_lan_poll_recv() waits for response for session->timeout seconds, which is not incremented -> the request is retransmitted only once, when timeout and session->timeout equals. No other retransmissions are ever sent. In addition, the time is measured in seconds, therefore 'time(NULL) - ltime' often equals 'timeout' and retransmission should be sent in this case (i.e. 'xmit' should be set). Commit for Jan Safranek --- ipmitool/src/plugins/lanplus/lanplus.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ipmitool/src/plugins/lanplus/lanplus.c b/ipmitool/src/plugins/lanplus/lanplus.c index 0323151..03ed199 100644 --- a/ipmitool/src/plugins/lanplus/lanplus.c +++ b/ipmitool/src/plugins/lanplus/lanplus.c @@ -2102,7 +2102,7 @@ ipmi_lanplus_send_payload( int try = 0; int xmit = 1; time_t ltime; - uint32_t timeout; + uint32_t saved_timeout; if (!intf->opened && intf->open && intf->open(intf) < 0) return NULL; @@ -2111,7 +2111,7 @@ ipmi_lanplus_send_payload( * The session timeout is initialized in the above interface open, * so it will only be valid after the open completes. */ - timeout = session->timeout; + saved_timeout = session->timeout; while (try < session->retry) { //ltime = time(NULL); @@ -2307,17 +2307,18 @@ ipmi_lanplus_send_payload( } /* only timeout if time exceeds the timeout value */ - xmit = ((time(NULL) - ltime) > timeout); + xmit = ((time(NULL) - ltime) >= session->timeout); usleep(5000); if (xmit) { /* increment session timeout by 1 second each retry */ - timeout++; + session->timeout++; } try++; } + session->timeout = saved_timeout; /* IPMI messages are deleted under ipmi_lan_poll_recv() */ switch (payload->payload_type) {