Index: Includes/eip_dbg_log.h =================================================================== --- Includes/eip_dbg_log.h (revision 131657) +++ Includes/eip_dbg_log.h (working copy) @@ -11,7 +11,7 @@ #define EIP_DBG_LOG_H /* uncomment to enable debug log indications toward the host */ -//#define EIP_ENABLE_DBG_LOG +#define EIP_ENABLE_DBG_LOG /* EIP_DBG_LOG_BACKEND_SYSLOG will be completely handled by the preprocessor to substitute any eip_dbg_log() call directly with DbgLog_Print* and is asynchronous/nonblocking, but has the drawback that all non-primitive pointer arguments Index: Sources/eip_tls_encap.c =================================================================== --- Sources/eip_tls_encap.c (revision 131657) +++ Sources/eip_tls_encap.c (working copy) @@ -669,7 +669,7 @@ else { TP(TP_CB_CLOSED, &ptTlsConn->tTcpConn, ptTlsConn->tTcpConn.usConnSeqNum, TLSTM23); - EIP_DBG_LOG_INFO("TLS connection %d closed", ptTlsConn - &((EIP_RESOURCES_T *)ptTcpConn->hEip)->tTlsRsc.ptDyn->patTlsConnections[0]); + EIP_DBG_LOG_INFO("TLS connection %d closed", ptTlsConn - &((EIP_RESOURCES_T *)ptTlsConn->tTcpConn.hEip)->tTlsRsc.ptDyn->patTlsConnections[0]); PS_Worker_QueueJob( ptTlsConn->tTcpConn.hEip->hWorker_LowPrio, &ptTlsConn->tTcpConn.tTcpSetConnectionClosedJob ); } } Index: Sources/Objects/Assembly/cip_as.c =================================================================== --- Sources/Objects/Assembly/cip_as.c (revision 131657) +++ Sources/Objects/Assembly/cip_as.c (working copy) @@ -981,7 +981,11 @@ if (!CipCommon_PathParser_ParseEPath(ptNewMember->bPathSize, &ptNewMember->abPath[0], &tMemberRequest, false, NULL)) { - ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; + EIP_DBG_LOG_INFO("BAD PATH: AS_AddMember OBSOLETE"); + ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; //done, obsolete anyway + ptResponse->tError.bAddErrorSize = 2; + ptResponse->tError.pusAddError[0] = 3; + ptResponse->tError.pusAddError[1] = 3; } else { Index: Sources/Objects/cip_common_pathparser.c =================================================================== --- Sources/Objects/cip_common_pathparser.c (revision 131657) +++ Sources/Objects/cip_common_pathparser.c (working copy) @@ -16,6 +16,7 @@ #include "cip_common.h" #include "cip_object_dictionary_core.h" #include "eip_cm.h" +#include "eip_dbg_log.h" #define PARSE_CLASS(ppbPath, pbPathLen, fPadded, pulParsedValue, pbStatus) CipCommon_PathParser_ParseLogicalSegment(ppbPath, pbPathLen, fPadded, CIP_SEG_LOG_TYP_CLASS, pulParsedValue, pbStatus) @@ -132,6 +133,7 @@ if ((**ppbPath & CIP_SEG_MASK) != CIP_SEG_NETWORK) { + /* This is not a network segment */ *pbStatus = CIP_GSR_BAD_PATH; return true; } @@ -908,6 +910,10 @@ if (!CipCommon_PathParser_ParseElectronicKey(&pbPath, &usPathLen, ptElectronicKey, &bStatus)) { assert(bStatus != CIP_GSR_SUCCESS); + if (bStatus == CIP_GSR_BAD_PATH) + { + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseElectronicKey"); + } return bStatus; } @@ -916,6 +922,10 @@ if (!CipCommon_PathParser_ParseTargetNetworkSegment(&pbPath, &usPathLen, &bStatus, ptConnParam)) { assert(bStatus != CIP_GSR_SUCCESS); + if (bStatus == CIP_GSR_BAD_PATH) + { + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseTargetNetworkSegment"); + } return bStatus; } } while (bStatus == CIP_GSR_SUCCESS); @@ -924,6 +934,10 @@ if (!CipCommon_PathParser_ParseApplicationPath(&pbPath, &usPathLen, true, &bStatus, &tParsedApplicationPaths[0]) || (bStatus != CIP_GSR_SUCCESS)) { assert(bStatus != CIP_GSR_SUCCESS); + if (bStatus == CIP_GSR_BAD_PATH) + { + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseApplicationPath"); + } return bStatus; } @@ -934,6 +948,10 @@ if (!CipCommon_PathParser_ParseApplicationPath(&pbPath, &usPathLen, true, &bStatus, &tParsedApplicationPaths[1])) { assert(bStatus != CIP_GSR_SUCCESS); + if (bStatus == CIP_GSR_BAD_PATH) + { + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseApplicationPath"); + } return bStatus; } @@ -947,6 +965,10 @@ if (!CipCommon_PathParser_ParseApplicationPath(&pbPath, &usPathLen, true, &bStatus, &tParsedApplicationPaths[2])) { assert(bStatus != CIP_GSR_SUCCESS); + if (bStatus == CIP_GSR_BAD_PATH) + { + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseApplicationPath"); + } return bStatus; } @@ -958,6 +980,10 @@ if (!CipCommon_PathParser_ParseSimpleDataSegment(&pbPath, &usPathLen, &bStatus, ptConnParam)) { assert(bStatus != CIP_GSR_SUCCESS); + if (bStatus == CIP_GSR_BAD_PATH) + { + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseSimpleDataSegment"); + } return bStatus; } @@ -964,6 +990,10 @@ if (!CipCommon_PathParser_ParseSafetyNetworkSegment(&pbPath, &usPathLen, &bStatus)) { assert(bStatus != CIP_GSR_SUCCESS); + if (bStatus == CIP_GSR_BAD_PATH) + { + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseSafetyNetworkSegment"); + } return bStatus; } @@ -1016,6 +1046,7 @@ break; case 2: case 3: + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseConnectionPath - invalid number of application paths for ping connection"); bStatus = CIP_GSR_BAD_PATH; break; default: @@ -1035,6 +1066,7 @@ ptConnParam->tConsumptionPath = tParsedApplicationPaths[1].t; break; case 3: + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseConnectionPath - invalid number of application paths for O2T connection with data segment"); bStatus = CIP_GSR_BAD_PATH; break; default: @@ -1050,6 +1082,7 @@ break; case 2: case 3: + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseConnectionPath - invalid number of application paths for O2T connection without data segment"); bStatus = CIP_GSR_BAD_PATH; break; default: @@ -1069,6 +1102,7 @@ ptConnParam->tProductionPath = tParsedApplicationPaths[1].t; break; case 3: + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseConnectionPath - invalid number of application paths for T2O connection with data segment"); bStatus = CIP_GSR_BAD_PATH; break; default: @@ -1084,6 +1118,7 @@ break; case 2: case 3: + EIP_DBG_LOG_INFO("BAD PATH: CipCommon_PathParser_ParseConnectionPath - invalid number of application paths for T2O connection without data segment"); bStatus = CIP_GSR_BAD_PATH; break; default: Index: Sources/Objects/cip_object_dictionary.c =================================================================== --- Sources/Objects/cip_object_dictionary.c (revision 131657) +++ Sources/Objects/cip_object_dictionary.c (working copy) @@ -714,7 +714,11 @@ if (ptSyncRequest->tRequest.ulFlags & CIP_FLG_PATH_NOT_DECODED) { /* path was not decoded in the first place */ - ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; + EIP_DBG_LOG_INFO("BAD PATH: REQUESTASYNC JOB"); + ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; //done + ptResponse->tError.bAddErrorSize = 2; + ptResponse->tError.pusAddError[0] = 1; + ptResponse->tError.pusAddError[1] = 1; } else { @@ -1230,7 +1234,8 @@ if (false == CipCommon_PathParser_ParseEPath( 2*ptPath->bPathWordSize, ptPath->abPath, &tRequest, fPadded, NULL )) { - ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; + EIP_DBG_LOG_INFO("BAD PATH: PARSING FAILED FOR SYNC"); + ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; //done, internal } else { Index: Sources/Objects/ConnectionManager/eip_cm.c =================================================================== --- Sources/Objects/ConnectionManager/eip_cm.c (revision 131657) +++ Sources/Objects/ConnectionManager/eip_cm.c (working copy) @@ -2034,7 +2034,9 @@ } else if (ptConnection->tCommon.tParameter.tConfigPath.ulConnPoint != 0) { - bStatus = CIP_GSR_BAD_PATH; + EIP_DBG_LOG_INFO("BAD PATH: NO CONNECTION POINT"); + bStatus = CIP_GSR_BAD_PATH; //done + EipEncap_SetExtendedStatusAndSize(&ptConnection->tCommon.tStatus, 0xABCD); } else if( (ptConnection->tCommon.tParameter.bTriggerType & EIP_CM_TYPTRIG_DIR_MASK) != EIP_CM_TYPTRIG_DIR_SERVER ) { Index: Sources/Objects/HilscherObjects/cip_pdc.c =================================================================== --- Sources/Objects/HilscherObjects/cip_pdc.c (revision 131657) +++ Sources/Objects/HilscherObjects/cip_pdc.c (working copy) @@ -370,7 +370,11 @@ if (ptInstance == NULL) { /* No such combination of connection points found */ - bStatus = CIP_GSR_BAD_PATH; + EIP_DBG_LOG_INFO("BAD PATH: PDC_TEST_CONNECTION"); + bStatus = CIP_GSR_BAD_PATH; //done + ptResponse->tError.bAddErrorSize = 3; + ptResponse->tError.pusAddError[0] = 5; + ptResponse->tError.pusAddError[1] = 5; } else if( (ptInstance->bConnectionCnt != 0) && (ptInstance->tConfig.bConnType == CIP_CTYPE_EXCLUSIVE_OWNER) ) Index: Sources/Objects/MessageRouter/cip_mr.c =================================================================== --- Sources/Objects/MessageRouter/cip_mr.c (revision 131657) +++ Sources/Objects/MessageRouter/cip_mr.c (working copy) @@ -23,6 +23,7 @@ #include "cip_security.h" #include "cip_timesync.h" #include "eip_linkage.h" +#include "eip_dbg_log.h" /* uncomment to allow all explicit messages over DTLS (not only FwOpen, FwClose) */ //#define CIP_MR_ALLOW_ALL_EXPLICIT_MESSAGES_OVER_DTLS @@ -147,6 +148,7 @@ else { /* Path not decoded, we dispatch anyway for user application to decode eventually */ + EIP_DBG_LOG_INFO("BAD PATH: CIPMR_DecodeRequest - path failed to parse, dispatching with CIP_FLG_PATH_NOT_DECODED"); ptRequest->ulFlags |= CIP_FLG_PATH_NOT_DECODED; } } @@ -268,6 +270,7 @@ /* send error reply in case of failure */ if (tError.bGrc != CIP_GSR_SUCCESS) { + EIP_DBG_LOG_INFO("BAD PATH?: EARLY ERROR"); CIP_OBJ_RESPONSE_T tResponse = {{0,},}; tResponse.tError.bGrc = tError.bGrc; tResponse.tError.bAddErrorSize = tError.bAddErrorSize; Index: Sources/Objects/Security/cip_security_common.c =================================================================== --- Sources/Objects/Security/cip_security_common.c (revision 131657) +++ Sources/Objects/Security/cip_security_common.c (working copy) @@ -26,6 +26,7 @@ #include "mbedtls/pk.h" #include "eip_tls_common_private.h" #include "Auth_CrtDB_X509_Utils.h" +#include "eip_dbg_log.h" static uint8_t s_abCertContentBuffer[8192]; @@ -123,7 +124,8 @@ if (false == CipCommon_PathParser_ParseEPath( 2 * ptCrtMngInstancePath->bPathWordSize, ((CIP_EPATH_T*)ptCrtMngInstancePath)->abPath, &tRequest, true, NULL )) { - return CIP_GSR_BAD_PATH; + EIP_DBG_LOG_INFO("BAD PATH: SECURITY INSTALL"); + return CIP_GSR_BAD_PATH; //dont need ESR here. purely internal } assert(CIP_CERT_MNG_CLASS_NUMBER == tRequest.ulClass); @@ -745,7 +747,11 @@ if (false == CipCommon_PathParser_ParseEPath( 2*ptPath->bPathWordSize, ptPath->abPath, &tRequest, fPadded, NULL )) { - ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; + EIP_DBG_LOG_INFO("BAD PATH: SECURITY"); + ptResponse->tError.bGrc = CIP_GSR_BAD_PATH; //done + ptResponse->tError.bAddErrorSize = 4; + ptResponse->tError.pusAddError[0] = 6; + ptResponse->tError.pusAddError[1] = 6; } else {