Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scapy/layers/dot11.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ class Dot11(Packet):
["next_tbtt", "comp_ssid", "ano"]),
lambda pkt: (pkt.type, pkt.subtype) == (3, 1)
),
ShortField("ID", 0),
LEShortField("ID", 0),
_Dot11MacField("addr1", ETHER_ANY, 1),
ConditionalField(
_Dot11MacField("addr2", ETHER_ANY, 2),
Expand Down
9 changes: 9 additions & 0 deletions test/scapy/layers/dot11.uts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ len(dpl_ether) == 1 and Ether in dpl_ether[0]
s = raw(Dot11())
s == b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

pkt = Dot11(ID=0x1205)
raw_data = raw(pkt)
expected = b'\x05\x12'
assert raw_data[2:4] == b'\x05\x12', f"Encoded Dot11 ID field is {raw_data[2:4]}, expected {repr(expected)}."

= Dot11 - dissection
p = Dot11(s)
Dot11 in p and p.addr3 == "00:00:00:00:00:00"
Expand All @@ -26,6 +31,10 @@ assert "DA" in p.address_meaning(1)
assert "SA" in p.address_meaning(2)
assert "BSSID" in p.address_meaning(3)

pkt = b'\x00\x00\x05\x12\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
decoded_pkt = Dot11(pkt)
assert decoded_pkt.ID == 0x1205, f"Decoded Dot11 ID field is {hex(decoded_pkt.ID)}, expected 0x1205."

= Dot11QoS - build
s = raw(Dot11()/Dot11QoS(Ack_Policy=1))
assert s == b'\xc8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00'
Expand Down
Loading