Zdenek, apologies for the inconvenience as I am resubmitting the lanplus
patch again, with an additional change from prior patch. To avoid
confusion I renamed this lanplus_retry_assertion_2. Further testing
caught an omission in lanplus.c/ipmi_lanplus_open_session() where the
return code should be 0,1, or 2 but some errors were returning -1. Now
with this patch the function returns 0, 1, or 2 for error codes, in line
with the _RAKP1 and _RAKP3 functions. With this final fix, the open
session errors retry correctly but also on non-timeout errors will exit
with error correctly.
Regards,
Pat
--- lanplus.c 2014-02-27 13:06:47.322356772 -0600
+++
/home/estes01/pjd/src/ipmitool/ipmitool-1.8.13/src/plugins/lanplus/lanplus.c
2014-03-03 08:37:10.915641365 -0600
@@ -2099,6 +2099,7 @@ ipmi_lanplus_send_payload(
uint8_t * msg_data;
int msg_length;
struct ipmi_session * session = intf->session;
+ struct ipmi_rq_entry * entry = NULL;
int try = 0;
int xmit = 1;
time_t ltime;
@@ -2123,7 +2124,6 @@ ipmi_lanplus_send_payload(
/*
* Build an IPMI v1.5 or v2 command
*/
- struct ipmi_rq_entry * entry;
struct ipmi_rq * ipmi_request =
payload->payload.ipmi_request.request;
lprintf(LOG_DEBUG, "");
@@ -2249,11 +2249,17 @@ ipmi_lanplus_send_payload(
{
case IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST:
session->v2_data.session_state =
LANPLUS_STATE_OPEN_SESSION_SENT;
+ /* not retryable for timeouts, force no retry */
+ try = session->retry;
break;
case IPMI_PAYLOAD_TYPE_RAKP_1:
session->v2_data.session_state =
LANPLUS_STATE_RAKP_1_SENT;
+ /* not retryable for timeouts, force no retry */
+ try = session->retry;
break;
case IPMI_PAYLOAD_TYPE_RAKP_3:
+ /* not retryable for timeouts, force no retry */
+ try = session->retry;
session->v2_data.session_state =
LANPLUS_STATE_RAKP_3_SENT;
break;
}
@@ -2304,6 +2310,10 @@ ipmi_lanplus_send_payload(
if (rsp)
break;
+ /* This payload type is retryable for timeouts. */
+ if ((payload->payload_type == IPMI_PAYLOAD_TYPE_IPMI)
&& entry) {
+ ipmi_req_remove_entry( entry->rq_seq,
entry->req.msg.cmd);
+ }
}
/* only timeout if time exceeds the timeout value */
@@ -2770,7 +2780,7 @@ ipmi_lanplus_open_session(struct ipmi_in
struct ipmi_session * session = intf->session;
uint8_t * msg;
struct ipmi_rs * rsp;
- int rc = 0;
+ int rc = 0; /* 0 = success, 1 = error, 2 = timeout */
/*
@@ -2779,7 +2789,7 @@ ipmi_lanplus_open_session(struct ipmi_in
msg = (uint8_t*)malloc(IPMI_OPEN_SESSION_REQUEST_SIZE);
if (msg == NULL) {
lprintf(LOG_ERR, "ipmitool: malloc failure");
- return -1;
+ return 1;
}
memset(msg, 0, IPMI_OPEN_SESSION_REQUEST_SIZE);
@@ -2809,7 +2819,7 @@ ipmi_lanplus_open_session(struct ipmi_in
session->cipher_suite_id);
free(msg);
msg = NULL;
- return -1;
+ return 1;
}
@@ -2862,14 +2872,17 @@ ipmi_lanplus_open_session(struct ipmi_in
if (verbose)
lanplus_dump_open_session_response(rsp);
-
+ if (rsp == NULL ) {
+ lprintf(LOG_DEBUG, "Timeout in open session response message.");
+ return 2;
+ }
if (rsp->payload.open_session_response.rakp_return_code !=
IPMI_RAKP_STATUS_NO_ERRORS)
{
lprintf(LOG_WARNING, "Error in open session response message :
%s\n",
val2str(rsp->payload.open_session_response.rakp_return_code,
ipmi_rakp_return_codes));
- return -1;
+ return 1;
}
else
{
@@ -2903,7 +2916,7 @@ ipmi_lanplus_open_session(struct ipmi_in
"not what we requested 0x%02x\n",
rsp->payload.open_session_response.auth_alg,
session->v2_data.requested_auth_alg);
- rc = -1;
+ rc = 1;
}
else if (rsp->payload.open_session_response.integrity_alg !=
session->v2_data.requested_integrity_alg)
@@ -2912,7 +2925,7 @@ ipmi_lanplus_open_session(struct ipmi_in
"not what we requested 0x%02x\n",
rsp->payload.open_session_response.integrity_alg,
session->v2_data.requested_integrity_alg);
- rc = -1;
+ rc = 1;
}
else if (rsp->payload.open_session_response.crypt_alg !=
session->v2_data.requested_crypt_alg)
@@ -2921,7 +2934,7 @@ ipmi_lanplus_open_session(struct ipmi_in
"not what we requested 0x%02x\n",
rsp->payload.open_session_response.crypt_alg,
session->v2_data.requested_crypt_alg);
- rc = -1;
+ rc = 1;
}
}
@@ -2955,7 +2968,7 @@ ipmi_lanplus_rakp1(struct ipmi_intf * in
struct ipmi_session * session = intf->session;
uint8_t * msg;
struct ipmi_rs * rsp;
- int rc = 0;
+ int rc = 0; /* 0 = success, 1 = error, 2 = timeout */
/*
* Build a RAKP 1 message
@@ -3035,8 +3048,8 @@ ipmi_lanplus_rakp1(struct ipmi_intf * in
if (rsp == NULL)
{
- lprintf(LOG_INFO, "> Error: no response from RAKP 1 message");
- return 1;
+ lprintf(LOG_WARNING, "> Error: no response from RAKP 1
message");
+ return 2;
}
session->v2_data.session_state = LANPLUS_STATE_RAKP_2_RECEIVED;
@@ -3208,8 +3221,8 @@ ipmi_lanplus_rakp3(struct ipmi_intf * in
}
else if (rsp == NULL)
{
- lprintf(LOG_INFO, "> Error: no response from RAKP 3 message");
- return 1;
+ lprintf(LOG_WARNING, "> Error: no response from RAKP 3
message");
+ return 2;
}
@@ -3333,6 +3346,7 @@ int
ipmi_lanplus_open(struct ipmi_intf * intf)
{
int rc;
+ int retry;
struct get_channel_auth_cap_rsp auth_cap;
struct sockaddr_in addr;
struct ipmi_session *session;
@@ -3360,7 +3374,6 @@ ipmi_lanplus_open(struct ipmi_intf * int
/* Setup our lanplus session state */
- session->v2_data.session_state = LANPLUS_STATE_PRESESSION;
session->v2_data.auth_alg = IPMI_AUTH_RAKP_NONE;
session->v2_data.crypt_alg = IPMI_CRYPT_NONE;
session->v2_data.console_id = 0x00;
@@ -3436,39 +3449,54 @@ ipmi_lanplus_open(struct ipmi_intf * int
goto fail;
}
-
/*
- * Open session
+ * If the open/rakp1/rakp3 sequence encounters a timeout, the whole
sequence
+ * needs to restart. The individual messages are not individually
retryable,
+ * as the session state is advancing.
*/
- if (ipmi_lanplus_open_session(intf)){
- intf->close(intf);
- goto fail;
- }
-
- /*
- * RAKP 1
- */
- if (ipmi_lanplus_rakp1(intf)){
- intf->close(intf);
- goto fail;
- }
-
-
- /*
- * RAKP 3
- */
- if (ipmi_lanplus_rakp3(intf)){
- intf->close(intf);
- goto fail;
+ for (retry = 0; retry < IPMI_LAN_RETRY; retry++) {
+ session->v2_data.session_state = LANPLUS_STATE_PRESESSION;
+ /*
+ * Open session
+ */
+ if ((rc = ipmi_lanplus_open_session(intf)) == 1) {
+ intf->close(intf);
+ goto fail;
+ }
+ if (rc == 2) {
+ lprintf(LOG_DEBUG, "Retry lanplus open session, %d",
retry);
+ continue;
+ }
+ /*
+ * RAKP 1
+ */
+ if ((rc = ipmi_lanplus_rakp1(intf)) == 1) {
+ intf->close(intf);
+ goto fail;
+ }
+ if (rc == 2) {
+ lprintf(LOG_DEBUG, "Retry lanplus rakp1, %d", retry);
+ continue;
+ }
+ /*
+ * RAKP 3
+ */
+ if ((rc = ipmi_lanplus_rakp3(intf)) == 1) {
+ intf->close(intf);
+ goto fail;
+ }
+ if (rc == 0) break;
+ lprintf(LOG_DEBUG,"Retry lanplus rakp3, %d", retry);
}
-
lprintf(LOG_DEBUG, "IPMIv2 / RMCP+ SESSION OPENED SUCCESSFULLY\n");
if (!ipmi_oem_active(intf, "i82571spt")) {
rc = ipmi_set_session_privlvl_cmd(intf);
- if (rc < 0)
+ if (rc < 0) {
+ intf->close(intf);
goto fail;
+ }
}
intf->manufacturer_id = ipmi_get_oem(intf);
bridgePossible = 1;
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel