Conversation
gpotter2
left a comment
There was a problem hiding this comment.
Thanks for the PR!
A few comments. It's a good start !
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4640 +/- ##
=======================================
Coverage 80.27% 80.28%
=======================================
Files 375 376 +1
Lines 92480 92498 +18
=======================================
+ Hits 74242 74258 +16
- Misses 18238 18240 +2
🚀 New features to boost your workflow:
|
4eb7a14 to
3c72f1a
Compare
|
Hi, found this when going over the issues in the repository. I suggest you use the following logic I implemented way back during my thesis on IEEE 1588 security - eyalitki/ptpd@4e46fe9#diff-bf2c30fee47c7daecd502ee34e25bc6324ff333f293f9d539d3ec4277764acaf. You can ignore the "encryption" fields as they were part of my thesis and weren't adopted by the IEEE 1588 security committee. Still, the layer implements all non-control messages + Announce, so it should become handy. It served me well in my python scripts for sending/receiving packets, so it is well tested (even if old). I hereby grant full access rights for this code and its derivatives to be used as part of the Scapy repository in any way the maintainers of the repository deem to be fit. Enjoy. |
|
@gpotter2 What do you think? |
|
Looks promising although it should be in |
|
@gpotter2 |
|
@satveerbrar Could you please move the layer into contrib/ |
3c72f1a to
3764966
Compare
|
@polybassa Moved it to contrib/ |
There was a problem hiding this comment.
Pull request overview
Adds an initial Scapy contrib implementation for Precision Time Protocol v2 (PTPv2) to address #4637, along with regression tests to validate basic parsing/field behavior.
Changes:
- Introduces a new
scapy.contrib.ptp_v2layer with PTPv2 header fields, message-type-specific conditional fields, UDP bindings, and apost_buildlength fixup. - Adds a new UTS regression test suite covering
haslayer/getlayerand dissection of several PTP message types from raw bytes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
scapy/contrib/ptp_v2.py |
New PTPv2 packet layer definition, conditional body fields, post_build message length handling, and UDP port bindings. |
test/contrib/ptp_v2.uts |
New regression tests for PTP layer presence and dissection across multiple message types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@polybassa @gpotter2
Here is the draft PR to add PTP protocol.
Currently this includes basic PTP header and Sync message type.
Planned additions in future commits:
post_buildfunction to calculate and insert message length field.Let me know if I have followed the correct approach.
fixes #4637