Skip to content

Commit 9e146f0

Browse files
alpatakangpotter2
authored andcommitted
Add 802.11 VHT Operation Info
- 802.11-2016 9.4.2.159 - Add unit test
1 parent 48148af commit 9e146f0

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

scapy/layers/dot11.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,7 @@ def network_stats(self):
971971
107: "Interworking",
972972
127: "Extendend Capabilities",
973973
191: "VHT Capabilities",
974+
192: "VHT Operation",
974975
221: "Vendor Specific"
975976
}
976977

@@ -1466,6 +1467,39 @@ class Dot11EltOBSS(Dot11Elt):
14661467
]
14671468

14681469

1470+
# 802.11-2016 9.4.2.159
1471+
1472+
class Dot11VHTOperationInfo(Packet):
1473+
name = "802.11 VHT Operation Information"
1474+
fields_desc = [
1475+
ByteField("channel_width", 0),
1476+
ByteField("channel_center0", 36),
1477+
ByteField("channel_center1", 0),
1478+
]
1479+
1480+
def extract_padding(self, s):
1481+
return "", s
1482+
1483+
1484+
class Dot11EltVHTOperation(Dot11Elt):
1485+
name = "802.11 VHT Operation Element"
1486+
fields_desc = [
1487+
ByteEnumField("ID", 192, _dot11_id_enum),
1488+
ByteField("len", 5),
1489+
PacketField(
1490+
"VHT_Operation_Info",
1491+
Dot11VHTOperationInfo(),
1492+
Dot11VHTOperationInfo
1493+
),
1494+
FieldListField(
1495+
"mcs_set",
1496+
[0x00],
1497+
BitField('SS', 0x00, size=2),
1498+
count_from=lambda x: 8
1499+
)
1500+
]
1501+
1502+
14691503
######################
14701504
# 802.11 Frame types #
14711505
######################

test/scapy/layers/dot11.uts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,3 +729,15 @@ assert pkt[Dot11EltOBSS].Passive_Total_Per_Channel == 200
729729
assert pkt[Dot11EltOBSS].Active_Total_Per_Channel == 20
730730
assert pkt[Dot11EltOBSS].Delay == 5
731731
assert pkt[Dot11EltOBSS].Activity_Threshold == 25
732+
733+
= Dot11VHTOperation
734+
735+
pkt = RadioTap(b"\x00\x008\x00/@@\xa0 \x08\x00\xa0 \x08\x00\x00K\x1178\x00\x00\x00\x00\x10\x0c<\x14@\x01\xba\x00\x00\x00\x00\x00\x00\x00\x00\x00\xffj78\x00\x00\x00\x00\x16\x00\x11\x03\xb6\x00\xba\x01\x80\x00\x00\x00\xff\xff\xff\xff\xff\xff`\x8d&\xa6\xd6\x05`\x8d&\xa6\xd6\x05\xb0i~\x96\x9e\x03\x00\x00\x00\x00d\x00\x11\x11\x00\rArc-QA-Lab-5G\x01\x08\x8c\x12\x98$\xb0H`l\x05\x04\x00\x03\x00\x00\x07<AE $\x01\x17(\x01\x17,\x01\x170\x01\x174\x01\x178\x01\x17<\x01\x17@\x01\x17d\x01\x1eh\x01\x1el\x01\x1ep\x01\x1et\x01\x1ex\x01\x1e|\x01\x1e\x80\x01\x1e\x84\x01\x1e\x88\x01\x1e\x8c\x01\x1e \x01\x00#\x02\x19\x000\x18\x01\x00\x00\x0f\xac\x04\x01\x00\x00\x0f\xac\x04\x02\x00\x00\x0f\xac\x02\x00\x0f\xac\x04\x0c\x00\x0b\x05\x00\x00\xad\x00\x00F\x053\x00\x00\x00\x006\x03d\x00\x00-\x1a\xef\x01\x17\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00=\x16$\x05\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7f\n\x04\x00\x08\x80\x01\x00\x00\xc0\x01@\xbf\x0c\xf5i\x8b\x0f\xaa\xff\x00\x00\xaa\xff\x00 \xc0\x05\x01*2\x00\x00\xc3\x05\x035555\xff'#\x05\x00\x08\x12\x00\x10L \x02\xc0o[\x85\x18\x00\x0c\x00\xaa\xff\xaa\xff\xaa\xff\xaa\xff{\x1c\xc7q\x1c\xc7q\x1c\xc7q\x1c\xc7q\xff\x07$\xf4?\x00;\xfc\xff\xff\x0e&\x04\x00\xa4\x08 \xa4\x08@C\x08`2\x08\xdd\x1d\x00P\xf2\x04\x10J\x00\x01\x10\x10D\x00\x01\x02\x10<\x00\x01\x03\x10I\x00\x06\x007*\x00\x01 \xdd\x05\x00\x90L\x04\x17\xdd\n\x00\x10\x18\x02\x00\x00\x1c\x00\x00\x01\xdd\x18\x00P\xf2\x02\x01\x01\x84\x00\x03\xa4\x00\x00'\xa4\x00\x00BC^\x00b2/\x00l\x02\x7f\x00I=\xa4/")
736+
assert Dot11EltVHTOperation in pkt
737+
assert Dot11VHTOperationInfo in pkt
738+
739+
assert pkt[Dot11EltVHTOperation].ID == 192
740+
assert pkt[Dot11EltVHTOperation].VHT_Operation_Info
741+
assert pkt[Dot11EltVHTOperation].VHT_Operation_Info.channel_width == 1
742+
assert pkt[Dot11EltVHTOperation].VHT_Operation_Info.channel_center0 == 42
743+
assert pkt[Dot11EltVHTOperation].VHT_Operation_Info.channel_center1 == 50

0 commit comments

Comments
 (0)