Assert raises exception when chosen message size is exactly 8192 bytes
Description
When configuring the toolkit, using 8192 for the SOPC_MAX_MESSAGE_LENGTH
raises an exception when establishing a connection.
The following assert in csrc/secure_channels/sopc_secure_connection_state_mgr.c
is triggered:
bool SC_InitNewConnection(uint32_t* newConnectionIdx)
{
[...]
// Initialize TCP message properties
scConnection->tcpMsgProperties.protocolVersion = SOPC_PROTOCOL_VERSION;
assert(SOPC_MAX_MESSAGE_LENGTH > SOPC_TCP_UA_MIN_BUFFER_SIZE);
[...]
}
Analysis
SOPC_TCP_UA_MIN_BUFFER_SIZE
is set to 8192, and corresponds to the minimum chunk size as prescribed by the OPC-UA standard.
The connection should be accepted when SOPC_MAX_MESSAGE_LENGTH = 8192
.
This assert comes from an error in the 1.03 standard that is now fixed (non public #Mantis3447). The previous minimum size for chunks was set to 8196 bytes.
Proposed fixes
- Move the assert to
csrc/configuration/sopc_config_constants_check.h
- Remove mentions to #Mantis3447 in
csrc/secure_channels/sopc_secure_connection_state_mgr.c