From 342ebce798fe98ede64939a49bbc3770d8214649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 8 May 2016 22:59:02 +0200 Subject: Imported Upstream version 1.8.17 --- src/plugins/lanplus/lanplus.c | 54 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/plugins/lanplus/lanplus.c') diff --git a/src/plugins/lanplus/lanplus.c b/src/plugins/lanplus/lanplus.c index 8776212..2a89a14 100644 --- a/src/plugins/lanplus/lanplus.c +++ b/src/plugins/lanplus/lanplus.c @@ -57,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -606,7 +607,7 @@ ipmiv2_lan_ping(struct ipmi_intf * intf) * Receive whatever comes back. Ignore received packets that don't correspond * to a request we've sent. * - * Returns: the ipmi_rs packet describing the/a reponse we expect. + * Returns: the ipmi_rs packet describing the/a response we expect. */ static struct ipmi_rs * ipmi_lan_poll_single(struct ipmi_intf * intf) @@ -651,7 +652,7 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) * * 1) An IPMI 1.5 packet (the response to our GET CHANNEL * AUTHENTICATION CAPABILITIES request) - * 2) An RMCP+ message with an IPMI reponse payload + * 2) An RMCP+ message with an IPMI response payload * 3) AN RMCP+ open session response * 4) An RAKP-2 message (response to an RAKP 1 message) * 5) An RAKP-4 message (response to an RAKP 3 message) @@ -662,6 +663,21 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) read_session_data(rsp, &offset, intf->session); + /* + * Skip packets that are not intended for this session + */ + if ((session->v2_data.session_state == LANPLUS_STATE_ACTIVE) && + (rsp->session.authtype == IPMI_SESSION_AUTHTYPE_RMCP_PLUS) && + (rsp->session.id != intf->session->v2_data.console_id)) + { + lprintf(LOG_INFO, "packet session id 0x%x does not " + "match active session 0x%0x", + rsp->session.id, intf->session->v2_data.console_id); + lprintf(LOG_ERR, "ERROR: Received an Unexpected message ID"); + /* read one more packet */ + return (struct ipmi_rs *)1; + } + if (lanplus_has_valid_auth_code(rsp, intf->session) == 0) { lprintf(LOG_ERR, "ERROR: Received message with invalid authcode!"); return NULL; @@ -681,7 +697,7 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) } /* - * Handle IPMI responses (case #1 and #2) -- all IPMI reponses + * Handle IPMI responses (case #1 and #2) -- all IPMI responses */ if (rsp->session.payloadtype == IPMI_PAYLOAD_TYPE_IPMI) { struct ipmi_rq_entry * entry; @@ -863,7 +879,7 @@ ipmi_lan_poll_single(struct ipmi_intf * intf) * Receive whatever comes back. Ignore received packets that don't correspond * to a request we've sent. * - * Returns: the ipmi_rs packet describing the/a reponse we expect. + * Returns: the ipmi_rs packet describing the/a response we expect. */ static struct ipmi_rs * ipmi_lan_poll_recv(struct ipmi_intf * intf) @@ -881,7 +897,7 @@ ipmi_lan_poll_recv(struct ipmi_intf * intf) /* - * read_open_session_reponse + * read_open_session_response * * Initialize the ipmi_rs from the IPMI 2.x open session response data. * @@ -903,7 +919,7 @@ read_open_session_response(struct ipmi_rs * rsp, int offset) /* Message tag */ rsp->payload.open_session_response.message_tag = rsp->data[offset]; - /* RAKP reponse code */ + /* RAKP response code */ rsp->payload.open_session_response.rakp_return_code = rsp->data[offset + 1]; /* Maximum privilege level */ @@ -970,7 +986,7 @@ read_rakp2_message( /* Message tag */ rsp->payload.rakp2_message.message_tag = rsp->data[offset]; - /* RAKP reponse code */ + /* RAKP response code */ rsp->payload.rakp2_message.rakp_return_code = rsp->data[offset + 1]; /* Console session ID */ @@ -1051,7 +1067,7 @@ read_rakp4_message( /* Message tag */ rsp->payload.rakp4_message.message_tag = rsp->data[offset]; - /* RAKP reponse code */ + /* RAKP response code */ rsp->payload.rakp4_message.rakp_return_code = rsp->data[offset + 1]; /* Console session ID */ @@ -1162,19 +1178,6 @@ read_session_data_v2x( #endif - /* - * Verify that the session ID is what we think it should be - */ - if ((s->v2_data.session_state == LANPLUS_STATE_ACTIVE) && - (rsp->session.id != s->v2_data.console_id)) - { - lprintf(LOG_ERR, "packet session id 0x%x does not " - "match active session 0x%0x", - rsp->session.id, s->v2_data.console_id); - assert(0); - } - - /* Ignored, so far */ memcpy(&rsp->session.seq, rsp->data + *offset, 4); *offset += 4; @@ -1399,10 +1402,6 @@ void getIpmiPayloadWireRep( msg[len++] = IPMI_REMOTE_SWID; msg[len++] = curr_seq << 2; msg[len++] = 0x34; /* Send Message rqst */ - #if 0 /* From lan.c example */ - entry->req.msg.target_cmd = entry->req.msg.cmd; /* Save target command */ - entry->req.msg.cmd = 0x34; /* (fixup request entry) */ - #endif msg[len++] = (0x40|intf->target_channel); /* Track request*/ payload->payload_length += 7; @@ -2101,7 +2100,7 @@ ipmi_lanplus_send_payload( struct ipmi_v2_payload * payload) { struct ipmi_rs * rsp = NULL; - uint8_t * msg_data; + uint8_t * msg_data = NULL; int msg_length; struct ipmi_session * session = intf->session; struct ipmi_rq_entry * entry = NULL; @@ -2341,6 +2340,7 @@ ipmi_lanplus_send_payload( case IPMI_PAYLOAD_TYPE_RMCP_OPEN_REQUEST: case IPMI_PAYLOAD_TYPE_RAKP_1: case IPMI_PAYLOAD_TYPE_RAKP_3: + case IPMI_PAYLOAD_TYPE_SOL: free(msg_data); msg_data = NULL; break; @@ -3416,7 +3416,7 @@ ipmi_lanplus_open(struct ipmi_intf * intf) if (!ipmi_oem_active(intf, "i82571spt") && ipmi_get_auth_capabilities_cmd(intf, &auth_cap)) { lprintf(LOG_INFO, "Error issuing Get Channel " - "Authentication Capabilies request"); + "Authentication Capabilities request"); goto fail; } -- cgit v1.2.3