diff --git a/config/stack_config.h b/config/stack_config.h index c5c9fd1a..f3186c1b 100644 --- a/config/stack_config.h +++ b/config/stack_config.h @@ -41,7 +41,7 @@ * * WARNING: If set to 1 normal single- and multi-threaded server are no longer working! */ -#define CONFIG_MMS_THREADLESS_STACK 0 +#define CONFIG_MMS_THREADLESS_STACK 1 /* number of concurrent MMS client connections the server accepts, -1 for no limit */ #define CONFIG_MAXIMUM_TCP_CLIENT_CONNECTIONS 5 diff --git a/src/iec61850/server/mms_mapping/reporting.c b/src/iec61850/server/mms_mapping/reporting.c index 2e86fa43..c30c4a8a 100644 --- a/src/iec61850/server/mms_mapping/reporting.c +++ b/src/iec61850/server/mms_mapping/reporting.c @@ -1100,29 +1100,33 @@ updateOwner(ReportControl* rc, MmsServerConnection connection) if (DEBUG_IED_SERVER) printf("IED_SERVER: reporting.c: set owner to %s\n", clientAddressString); if (strchr(clientAddressString, '.') != NULL) { - if (DEBUG_IED_SERVER) printf("IED_SERVER: reporting.c: client address is IPv4 address\n"); - { - uint8_t ipV4Addr[4]; + if (DEBUG_IED_SERVER) + printf("IED_SERVER: reporting.c: client address is IPv4 address\n"); - int addrElementCount = 0; + uint8_t ipV4Addr[4]; - char* separator = clientAddressString; + int addrElementCount = 0; - while (separator != NULL && addrElementCount < 4) { - int intVal = atoi(separator); + char* separator = clientAddressString; - separator = strchr(separator, '.'); + while (separator != NULL && addrElementCount < 4) { + int intVal = atoi(separator); - ipV4Addr[addrElementCount] = intVal; + ipV4Addr[addrElementCount] = intVal; - addrElementCount ++; - } + separator = strchr(separator, '.'); - if (addrElementCount == 4) - MmsValue_setOctetString(owner, ipV4Addr, 4); - else - MmsValue_setOctetString(owner, ipV4Addr, 0); + if (separator != NULL) + separator++; // skip '.' character + + addrElementCount ++; } + + if (addrElementCount == 4) + MmsValue_setOctetString(owner, ipV4Addr, 4); + else + MmsValue_setOctetString(owner, ipV4Addr, 0); + } else { uint8_t ipV6Addr[16]; @@ -1227,7 +1231,7 @@ Reporting_RCBWriteAccessHandler(MmsMapping* self, ReportControl* rc, char* eleme goto exit_function; } else { - retVal = DATA_ACCESS_ERROR_OBJECT_ATTRIBUTE_INCONSISTENT; + retVal = DATA_ACCESS_ERROR_TEMPORARILY_UNAVAILABLE; goto exit_function; } }