Repository navigation
Conversation
Alarm_Low and Alarm_High read RTA_SDU from all remaining bytes instead of VarPartLen bytes, and AlarmPayload read items past block_length, so the Ethernet padding of a short alarm frame was dissected as an extra AlarmItem, and an RTA acknowledgement (VarPartLen 0) as an alarm notification. VarPartLen was also written as 0 when building. Bound RTA_SDU by VarPartLen and AlarmPayload by block_length, return the bytes after the RTA-SDU as padding, and compute VarPartLen when it is left unset. AI-Assisted: yes (Claude Opus 5.5, GPT-6.1 Sol)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5254 +/- ##
=======================================
Coverage 80.54% 80.55%
=======================================
Files 375 375
Lines 98399 98403 +4
=======================================
+ Hits 79255 79265 +10
+ Misses 19144 19138 -6
🚀 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
A PROFINET alarm frame shorter than the Ethernet minimum is padded to 60 bytes, and scapy dissects the pad bytes as alarm content.
Alarm_LowandAlarm_HighreadRTA_SDUfrom all remaining bytes instead ofVarPartLenbytes, andAlarmPayloadreads alarm items up to the end of the data instead ofblock_length. A pull alarm gets an extraAlarmItem, and an RTA acknowledgement (VarPartLen=0) is dissected as an alarm notification. When building,VarPartLenstays 0.The fix bounds
RTA_SDUbyVarPartLenandAlarmPayloadbyblock_length, returns the bytes after the RTA-SDU as padding, and computesVarPartLenwhen it is left unset.Before:
After:
tshark dissects the same frames as the patched scapy: no item in the pull alarm, one item in a padded RS alarm, and no notification in the acknowledgement.
A capture built by earlier scapy versions has
VarPartLen=0, so its notification now dissects as padding.This message was written with the help of AI (Claude Opus 5.5).