FYI, in my experience, if you have to retry RAKP packets, many BMCs will
not produce sane behavior.  E.g. if I send RAKP2, BMC receives and sends me
RAKP3 but network drops RAKP3, many BMCs will never ever accept a
retransmit of RAKP2.  I've found that if you are in the RAKP stage, any
missed messages are best handled by restarting from open rmcp+ request.
IIRC I could interpret the spec as suggesting this is the expected case,
that the correct behavior is to restart login process if it should fail.



From:   Masatake YAMATO <yam...@redhat.com>
To:     ipmitool-devel@lists.sourceforge.net,
Date:   11/22/2012 05:05 AM
Subject:        [Ipmitool-devel] [resend] ipmilan.c: avoiding assertion hit in
            retransmission



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

------------------------------------------------------------------------------

Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

<<inline: graycol.gif>>

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to