Skip to content

Commit da6f7ee

Browse files
committed
Add unit tests for verify encoding and decoding of Dot11 ID field
1 parent cbd3535 commit da6f7ee

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/scapy/layers/dot11.uts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ len(dpl_ether) == 1 and Ether in dpl_ether[0]
1818
s = raw(Dot11())
1919
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'
2020

21+
pkt = Dot11(ID=0x1205)
22+
raw_data = raw(pkt)
23+
expected = b'\x05\x12'
24+
assert raw_data[2:4] == b'\x05\x12', f"Encoded Dot11 ID field is {raw_data[2:4]}, expected {repr(expected)}."
25+
2126
= Dot11 - dissection
2227
p = Dot11(s)
2328
Dot11 in p and p.addr3 == "00:00:00:00:00:00"
@@ -26,6 +31,10 @@ assert "DA" in p.address_meaning(1)
2631
assert "SA" in p.address_meaning(2)
2732
assert "BSSID" in p.address_meaning(3)
2833

34+
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'
35+
decoded_pkt = Dot11(pkt)
36+
assert decoded_pkt.ID == 0x1205, f"Decoded Dot11 ID field is {hex(decoded_pkt.ID)}, expected 0x1205."
37+
2938
= Dot11QoS - build
3039
s = raw(Dot11()/Dot11QoS(Ack_Policy=1))
3140
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'

0 commit comments

Comments
 (0)