pldmd: fix crash on PLDM loopback request via AF_MCTP Sending a PLDM request to own EID causes the message to loop back to the requester with no mappable TID, returning PLDM_REQUESTER_RECV_FAIL. This incorrectly caused pldmd to exit. PLDM_REQUESTER_RECV_FAIL is not fatal in the AF_MCTP case. Log a warning and continue instead. Change-Id: I79d136aa8258a5b3adca47c40fb9cf5cd6d3f911 Signed-off-by: Vishnunithyasoundhar S <vishnunithyasoundhar.s@intel.com>
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp index a1b4595..d63a459 100644 --- a/pldmd/pldmd.cpp +++ b/pldmd/pldmd.cpp
@@ -403,6 +403,7 @@ // TODO check that we get here if mctp-demux dies? else if (returnCode == PLDM_REQUESTER_RECV_FAIL) { +#if defined(PLDM_TRANSPORT_WITH_MCTP_DEMUX) // MCTP daemon has closed the socket this daemon is connected to. // This may or may not be an error scenario, in either case the // recovery mechanism for this daemon is to restart, and hence exit @@ -412,6 +413,14 @@ "MCTP daemon closed the socket, IO exiting with response code '{RC}'", "RC", returnCode); io.get_event().exit(0); +#elif defined(PLDM_TRANSPORT_WITH_AF_MCTP) + // With AF_MCTP, a recv failure is not fatal. A common cause is a + // loopback message (e.g. pldmtool sending to own EID) where the + // source arrives with ifindex=0, which cannot be mapped to a TID. + warning( + "Failed to receive PLDM message, ignoring: response code '{RC}'", + "RC", returnCode); +#endif } else {