OpENer
OpENer copied to clipboard
cip: accept the first consumed sequence number unconditionally
Accept the first consumed sequence number without comparing it to 0.
ODVA CT18.1 will send sequence numbers that starts at 0x80000000, which will not pass SEQ_GT32 when compared to 0.
This commit adds a boolean flag to the cip_connection_object that indicates if the eip_level_sequence_count_consuming counter was initialized with data from the client.
Signed-off-by: Charles Perry [email protected]
Hello!
Let me know if you have any questions of comments on this. This is one thing I needed to change to make the ODVA tool happy.
Reviewed-by: Joachim Wiberg [email protected]
Hi, sorry, I was on vacation. I don't get it why the boolean is needed. Is the comparison signed or unsigned? If unsigned it should work, if it is signed, then it would be needed to change is to an unsigned comparison, wouldn't it?
Just checked the macro, it comes directly from the ODVA specification, so that's how it shall be... Then I would guess the sequence number needs to be initialized with the provided value when the connection object is created
Could you provide a wireshark trace from starting from the Forward Open until the error happens?
Hello @CapXilinx,
I agree with you that the SEQ_GT32 is correct and doesn't have to be changed.
The problem is that this macro takes two argument and the assumption that we can use 0 for the previous sequence number when receiving the first sequence number might not be correct.
Wireshark:
opener-seq-number-0x80000000-filtered.zip
OpENer logs:
[OpENer ] networkhandler: new TCP connection
[OpENer ] >>> network handler: accepting new TCP socket: 10
[OpENer ] networkhandler: opened new TCP connection on fd 10
[OpENer ] Entering HandleDataOnTcpSocket for socket: 10
[OpENer ] Data received on TCP: 28
[OpENer ] Handles data for TCP socket: 10
[OpENer ] Register session
[OpENer ] Adds socket 10 to socket timers
[OpENer ] Sets time stamp for socket 10
[OpENer ] Sets time stamp for socket 10
[OpENer ] TCP reply: send 28 bytes on 10
[OpENer ] Sets time stamp for socket 10
[OpENer ] Entering HandleDataOnTcpSocket for socket: 10
[OpENer ] Data received on TCP: 130
[OpENer ] Handles data for TCP socket: 10
[OpENer ] Send Request/Reply Data
[OpENer ] Sockaddr type id: 8000
[OpENer ] Sockaddr type id: 8001
[OpENer ] NotifyMessageRouter: routing unconnected message
[OpENer ] NotifyMessageRouter: calling notify function of class 'connection manager'
[OpENer ] notify: found instance 1
[OpENer ] notify: calling ForwardOpen service
[OpENer ] ForwardOpen: ConConnID 0, ProdConnID 0, ConnSerNo 691
[OpENer ] We have a Non-Null request
[OpENer ] We have a Non-Matching request
[OpENer ] Received connection path size: 4
[OpENer ] classid 4 (assembly)
[OpENer ] Configuration instance id 0
[OpENer ] assembly: type bidirectional
[OpENer ] connection point 150
[OpENer ] connection point 100
[OpENer ] Resulting PIT value: 256
[OpENer ] IO Exclusive Owner connection requested
[OpENer ] No PIT segment available
[OpENer ] networkhandler: UDP socket 11
[OpENer ] networkhandler: bind UDP socket 11
[OpENer ] networkhandler: UDP socket 12
[OpENer ] connection manager: connect succeeded
[OpENer ] assembleFWDOpenResponse: sending success response
[OpENer ] notifyMR: notify function of class 'connection manager' returned a reply
[OpENer ] Sets time stamp for socket 10
[OpENer ] TCP reply: send 110 bytes on 10
[OpENer ] Sets time stamp for socket 10
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] UDP port to be sent to: 8ae
[OpENer ] Processing UDP consuming message
[OpENer ] >>>>>>>>>>Connection ConnNr: 691 timed out
[OpENer ] Setting extended status: 30
[OpENer ] Close all instance type 3 only connections
[OpENer ] Close all instance type 4 only connections
ODVA CT18.1 logs:
3464 CIP I/O Injection test
3465 Test with Initial Sequence Number 0x80000000
3466 Sending
3467 Encapsulation Header 65 00 04 00 00 00 00 00 00 00 00 00 74 D6 0A 00 00 00 00 00 00 00 00 00
3468 Command Specific Data 01 00 00 00
3469 Received
3470 Encapsulation Header 65 00 04 00 01 00 00 00 00 00 00 00 74 D6 0A 00 00 00 00 00 00 00 00 00
3471 Command Specific Data 01 00 00 00
3472 Sending
3473 Encapsulation Header 6F 00 6A 00 01 00 00 00 00 00 00 00 75 D6 0A 00 00 00 00 00 00 00 00 00
3474 Command Specific Data 00 00 00 00 41 00 04 00 00 00 00 00 B2 00 32 00
3475 CIP Data 54 02 20 06 24 01 06 28 00 00 00 00 00 00 00 00 B3 02 18 00 78 56 34 12 00 00 00 00 A0 86 01 00
E2 49 A0 86 01 00 EA 29 01 04 20 04 24 00 2C 96 2C 64 00 80 10 00 00 02 08 AE 00 00 00 00 00 00
00 00 00 00 00 00 01 80 10 00 00 02 08 AE 00 00 00 00 00 00 00 00 00 00 00 00
3476 Received
3477 Encapsulation Header 6F 00 56 00 01 00 00 00 00 00 00 00 75 D6 0A 00 00 00 00 00 00 00 00 00
3478 Command Specific Data 00 00 00 00 00 00 04 00 00 00 00 00 B2 00 1E 00
3479 CIP Data D4 00 00 00 79 00 67 45 7A 00 67 45 B3 02 18 00 78 56 34 12 A0 86 01 00 A0 86 01 00 00 00 00 80
10 00 00 02 08 AE 00 00 00 00 00 00 00 00 00 00 00 00 01 80 10 00 00 02 08 AE EF C0 02 20 00 00
00 00 00 00 00 00
3480 1> *** Did not receive T->O I/O packets 437 ms after packet with Sequence Number 99! Time since last HeartBeat 107 ms.
3481 ***** Found 3 Warnings *****
3482 ***** Found 1 Errors *****
3483 End: Object Test
3484 ***** Found 3 Warnings in Object *****
3485 ***** Found 1 Errors in Object *****
Oh ok, now I get the problem