Эх сурвалжийг харах

Fix: GetConnectionId() returned only the lower 16 bit of the connection id

The function GetConnectionId() shall create a unique (even over reboots)
Connection Id of 32 bit length. This function uses g_incarnation_id as
proposed in Vol. 2 Section 3-3.7.1.2 "Using an Incarnation ID" to create
a 32 bit Connection Id.

The failure of the implementation was only to return the lower 16 bit of
the created value! Therefore after a reboot even if the g_incarnation_id
changed the changed part of the Connection Id was stripped from the
result on return from the function.

Now that my device can do a reboot the Conformance Test of the Connection
Manager failed.

Signed-off-by: Stefan Mätje <stefan.maetje@esd.eu>
Stefan Mätje 6 жил өмнө
parent
commit
63d13f5fb8

+ 2 - 2
source/src/cip/cipconnectionmanager.c

@@ -164,9 +164,9 @@ unsigned int GetPaddedLogicalPath(const EipUint8 **logical_path_segment) {
  *
  * A unique connectionID is formed from the boot-time-specified "incarnation ID"
  * and the per-new-connection-incremented connection number/counter.
- * @return new connection id
+ * @return new 32-bit connection id
  */
-CipUint GetConnectionId(void) {
+CipUdint GetConnectionId(void) {
   static CipUint connection_id = 18;
   connection_id++;
   return ( g_incarnation_id | (connection_id & 0x0000FFFF) );

+ 1 - 1
source/src/cip/cipconnectionmanager.h

@@ -219,7 +219,7 @@ void AddNewActiveConnection(CipConnectionObject *const connection_object);
 void RemoveFromActiveConnections(CipConnectionObject *const connection_object);
 
 
-CipUint GetConnectionId(void);
+CipUdint GetConnectionId(void);
 
 typedef void (*CloseSessionFunction)(const CipConnectionObject *const
                                      connection_object);