Hi, 

I'd like you to review my patch and merge it to the official
source tree.

I wrote the patch based on code reading. I didn't test it at all.

See ipmi_lanplus_send_payload function of lanplus.c.
An assertion is hit when retransmitting datagram with
IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST, IPMI_PAYLOAD_TYPE_RAKP_1, or
IPMI_PAYLOAD_TYPE_RAKP_2 typed payload.

After initial sending those type of datagram, the state of session is
transited with following code:

                /* Remember our connection state */
                switch (payload->payload_type)
                {
                case IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST:
                        session->v2_data.session_state = 
LANPLUS_STATE_OPEN_SESSION_SENT;
                        break;
                case IPMI_PAYLOAD_TYPE_RAKP_1:
                        session->v2_data.session_state = 
LANPLUS_STATE_RAKP_1_SENT;
                        break;
                case IPMI_PAYLOAD_TYPE_RAKP_3:
                        session->v2_data.session_state = 
LANPLUS_STATE_RAKP_3_SENT;
                        break;
                }

And when retransmitting following assert statements which checks the
session_state may be hit.

                        else if (payload->payload_type == 
IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST)
                        {
                                lprintf(LOG_DEBUG, ">> SENDING AN OPEN SESSION 
REQUEST\n");
                                assert(session->v2_data.session_state == 
LANPLUS_STATE_PRESESSION);

                        else if (payload->payload_type == 
IPMI_PAYLOAD_TYPE_RAKP_1)
                        {
                                lprintf(LOG_DEBUG, ">> SENDING A RAKP 1 
MESSAGE\n");
                                assert(session->v2_data.session_state ==
                                                 
LANPLUS_STATE_OPEN_SESSION_RECEIEVED);

                        else if (payload->payload_type == 
IPMI_PAYLOAD_TYPE_RAKP_3)
                        {
                                lprintf(LOG_DEBUG, ">> SENDING A RAKP 3 
MESSAGE\n");
                                assert(session->v2_data.session_state ==
                                                 LANPLUS_STATE_RAKP_2_RECEIVED);


The patch is for the code in impitool cvs repository. The intent is
obvious.  In a local variable `last_session_state' the state before transition 
is recorded.
The value stored in `last_session_state' is restored to 
session->v2_data.session_state
when retransmitting is needed.

*** lanplus.c.~1.72.~   2012-07-11 01:01:09.000000000 +0900
--- lanplus.c   2012-11-06 14:02:04.382135857 +0900
***************
*** 2091,2096 ****
--- 2091,2097 ----
        int                   xmit = 1;
        time_t                ltime;
        uint32_t              timeout;
+       enum LANPLUS_SESSION_STATE last_session_state;
  
        if (!intf->opened && intf->open && intf->open(intf) < 0)
                return NULL;
***************
*** 2233,2238 ****
--- 2234,2240 ----
                usleep(100);                    /* Not sure what this is for */
  
                /* Remember our connection state */
+               last_session_state = session->v2_data.session_state;
                switch (payload->payload_type)
                {
                case IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST:
***************
*** 2302,2307 ****
--- 2304,2318 ----
                if (xmit) {
                        /* increment session timeout by 1 second each retry */
                        timeout++;
+                       /* Roll back the last state transition */
+                       switch (payload->payload_type)
+                       {
+                       case IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST:
+                       case IPMI_PAYLOAD_TYPE_RAKP_1:
+                       case IPMI_PAYLOAD_TYPE_RAKP_3:
+                               session->v2_data.session_state = 
last_session_state;
+                               break
+                       }
                }
  
                try++;

Masatake YAMATO

------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to