Skip to content

Commit

Permalink
bluetooth: Add EIR Advertising Interval (secdev#4612)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovazquezblanco authored Dec 22, 2024
1 parent a8583a5 commit f793b27
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scapy/layers/bluetooth.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,13 @@ class EIR_PublicTargetAddress(EIR_Element):
]


class EIR_AdvertisingInterval(EIR_Element):
name = "Advertising Interval"
fields_desc = [
LEShortField("advertising_interval", 0)
]


class EIR_ServiceData32BitUUID(EIR_Element):
name = 'EIR Service Data - 32-bit UUID'
fields_desc = [
Expand Down Expand Up @@ -2376,6 +2383,7 @@ class HCI_LE_Meta_Long_Term_Key_Request(Packet):
bind_layers(EIR_Hdr, EIR_ServiceSolicitation128BitUUID, type=0x15)
bind_layers(EIR_Hdr, EIR_ServiceData16BitUUID, type=0x16)
bind_layers(EIR_Hdr, EIR_PublicTargetAddress, type=0x17)
bind_layers(EIR_Hdr, EIR_AdvertisingInterval, type=0x1a)
bind_layers(EIR_Hdr, EIR_ServiceData32BitUUID, type=0x20)
bind_layers(EIR_Hdr, EIR_ServiceData128BitUUID, type=0x21)
bind_layers(EIR_Hdr, EIR_Manufacturer_Specific_Data, type=0xff)
Expand Down
5 changes: 5 additions & 0 deletions test/scapy/layers/bluetooth.uts
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ p = HCI_Hdr(hex_bytes('043e1402010001554433221100080717ffeeddccbbaaaa'))
assert EIR_PublicTargetAddress in p
assert p[EIR_PublicTargetAddress].bd_addr == 'aa:bb:cc:dd:ee:ff'

= Parse EIR_AdvertisingInterval
p = HCI_Event_Hdr(hex_bytes('3e23020100002e4961121110170201060f0954656c6553617420283432453229031a9001a3'))
assert EIR_AdvertisingInterval in p
assert p[EIR_AdvertisingInterval].advertising_interval == 400

= Parse EIR_ServiceData32BitUUID

p = HCI_Hdr(hex_bytes('042fff01c47c80894df801000c0128a269a30c4a125d13f30196894df80c012820f61a1a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'))
Expand Down

0 comments on commit f793b27

Please sign in to comment.