-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add-ptp-protocol #4640
base: master
Are you sure you want to change the base?
Feature/add-ptp-protocol #4640
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
A few comments. It's a good start !
scapy/layers/ptp_v2.py
Outdated
ByteField("logMessageInterval", 0) | ||
] | ||
|
||
def guess_payload_class(self, payload): # type: (bytes) -> Type[Packet] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We typically reserve guess_payloaf
for complex cases. Here a simpler approach with bind_layers
is enough, and it also handles building.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed classes for individual message types and integrated their fields directly as a Conditional Field. Because all these fields are part of the PTP layer rather than being separate layers
scapy/layers/ptp_v2.py
Outdated
""" | ||
|
||
|
||
class FollowUp(Packet): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the packets really are empty, you don't need to include them. Having an enum in the parent that shows this type is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not empty., I have to implement fields in those packets.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4640 +/- ##
==========================================
+ Coverage 80.71% 81.62% +0.90%
==========================================
Files 359 360 +1
Lines 86052 86253 +201
==========================================
+ Hits 69461 70404 +943
+ Misses 16591 15849 -742
|
4eb7a14
to
3c72f1a
Compare
@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_build
function to calculate and insert message length field.Let me know if I have followed the correct approach.
fixes #4637