Repository navigation
Conversation
PNIORealTimeAcyclicPDUHeader declared PDUTypeType before PDUTypeVersion, so the type was read from and written to bits 4-7. IEC 61158-6-10 and Wireshark put the type in bits 0-3 and the version in bits 4-7: an ACK (0x13) dissected as DATA version 3, and PDUTypeType=3 with PDUTypeVersion=1 was written as 0x31. AI-Assisted: yes (Claude Opus 5.5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5297 +/- ##
==========================================
+ Coverage 80.06% 80.15% +0.08%
==========================================
Files 375 375
Lines 98775 98775
==========================================
+ Hits 79083 79169 +86
+ Misses 19692 19606 -86
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PNIORealTimeAcyclicPDUHeaderdeclaresPDUTypeTypebeforePDUTypeVersion(pnio_rpc.py#L1356-L1357), so scapy reads the type from the high nibble of the PDUType octet. Wireshark (masks) and the rt-labs p-net stack (reader) put the type in bits 0-3 and the version in bits 4-7. A received RTA acknowledgement (0x13, ACK version 1) dissects asRTA_TYPE_DATAversion 3, andAlarm_Low(PDUTypeType=3, PDUTypeVersion=1)writes0x31, which Wireshark reads as a Data-RTA-PDU version 3. The existing tests do not check these two fields: the alarm captures use0x11, where both orders agree, and the acknowledgement test uses0x13without asserting the type or version.This PR swaps the two fields so the version is the high nibble.
Before:
After:
tshark 4.6.9 decodes the PDUType of an
Alarm_Lowframe for each of the 256 octet values the same way scapy does after this change (before, only the 16 values with equal nibbles matched). A test is added totest/contrib/pnio_rpc.uts.This message was written with the help of AI (Claude Opus 5.5).