ID:407 - Avoid assert on mismatched session ID

Move the logic that checks the session ID from read_session_data_v2x
function to the ipmi_lan_poll_single function in order to avoid calling
assert in this case. We can continue with the next packet if we detect
a session ID mismatch.

Signed-off-by: Boris Ranto <branto@redhat.com>
This commit is contained in:
Boris Ranto 2016-01-05 13:15:43 +01:00 committed by Zdenek Styblik
parent 4e707af583
commit 9289aeb8c2

View File

@ -662,6 +662,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;
@ -1162,19 +1177,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;