From eac44cbe921761b04295837c88443e2d671114b3 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Sat, 2 Jan 2021 12:16:27 +0100 Subject: [PATCH] IED server: fixed problem with CONFIG_IEC61850_RCB_ALLOW_ONLY_PRECONFIGURED_CLIENT configuration option enabled --- src/iec61850/server/mms_mapping/reporting.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c index da8798b5..27261195 100644 --- a/src/iec61850/server/mms_mapping/reporting.c +++ b/src/iec61850/server/mms_mapping/reporting.c @@ -1373,6 +1373,10 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme rc->reserved = true; rc->clientConnection = connection; } + else { + if (DEBUG_IED_SERVER) + printf("IED_SERVER: client IP not matching with pre-assigned owner\n"); + } #else rc->reserved = true; rc->clientConnection = connection; @@ -1406,6 +1410,18 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme goto exit_function; } +#if (CONFIG_IEC61850_RCB_ALLOW_ONLY_PRECONFIGURED_CLIENT == 1) + if (isIpAddressMatchingWithOwner(rc, MmsServerConnection_getClientAddress(connection)) == false) { + retVal = DATA_ACCESS_ERROR_OBJECT_ACCESS_DENIED; + + if (DEBUG_IED_SERVER) + printf("IED_SERVER: client IP not matching with pre-assigned owner --> write access denied!\n"); + + goto exit_function; + } +#endif + + if (strcmp(elementName, "RptEna") == 0) { if (value->value.boolean == true) {