-
-
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
BLE: Add HCI_LE_Meta_Extended_Advertising_Report event #4686
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4686 +/- ##
==========================================
- Coverage 82.13% 78.59% -3.55%
==========================================
Files 361 336 -25
Lines 86829 81635 -5194
==========================================
- Hits 71321 64158 -7163
- Misses 15508 17477 +1969
🚀 New features to boost your workflow:
|
One last comment, this may be quite important: You have implemented an array of a structure with 10+ fields but as I understand from the documentation, it seems that it should be a struct of 10+ arrays... I am not sure this is explanation is easy to understand, please, let me know if I can clarify this comment. Thanks |
You are right that in the Spec is not really clear how this is implemented. Based on empirical observations from captured communications of this event, I concluded this event is implemented as my commit does: It contains It is implemented similarly to HCI_LE_Advertising_Report (Section 7.7.65.2), which is already implemented in Scapy. Hope this clarifies your doubt. |
Yes! It also clarifies that the HCI_LE_Advertising_Report packet may be ok, wich I had my doubts... Thanks! :D |
I renamed fields to Spec names; that makes more sense to me, despite the fact that for other events the field names are shortened. Can somebody clarify if there is a reason for keeping some field names not matching the Specification, or maybe it is legacy? |
scapy/layers/bluetooth.py
Outdated
class HCI_LE_Meta_Extended_Advertising_Report(Packet): | ||
name = "Extended Advertising Report" | ||
fields_desc = [ | ||
LEShortField("type", 0), |
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.
This field would ideally be a bitfield or a bitenumfield. I understand this may not be fun to write and could possibly be added in future improvements.
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.
Done!
scapy/layers/bluetooth.py
Outdated
name = "Extended Advertising Report" | ||
fields_desc = [ | ||
LEShortField("type", 0), | ||
ByteEnumField("atype", 0, {0: "public", 1: "random"}), |
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.
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.
Done!
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.
Just a couple of comments more... Sorry I think i wrongly approved before the last two comments where added...
Thanks for your revision. I pushed a commit including your proposed changes. However, I am not completely sure independent BitFields for event_type is the best option; I'd rather prefer implementing this as something like a named BitField struct. I think this Field is not implemented and would be a nice feature to include. |
AFAIK there is no way to create a composable field in the field list. If you want to group that as a field, you may create a Packet for the type. That would allow you to compose it. It is not a bad solution from my point of view but maybe other maintainers have different ideas. |
Bluetooth Core Specification v6.0 | Vol 4, Part E, Section 7.7.65.13
Example packet
show()