Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace ieee80211 {
// A non-QoS STA shall assign sequence numbers to management frames and data frames (QoS subfield of the
// Subtype field is equal to 0) from a single modulo-4096 counter, starting at 0 and incrementing by 1, for each
// MSDU or MMPDU.
// IEEE Std 802.11-2024, 10.3.2.14.2 and Table 10-5 (SNS1/TR1).
//
void LegacySequenceNumberAssignment::assignSequenceNumber(const Ptr<Ieee80211DataOrMgmtHeader>& header)
{
Expand All @@ -24,4 +25,3 @@ void LegacySequenceNumberAssignment::assignSequenceNumber(const Ptr<Ieee80211Dat

} /* namespace ieee80211 */
} /* namespace inet */

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ namespace ieee80211 {
class INET_API LegacySequenceNumberAssignment : public ISequenceNumberAssignment
{
protected:
SequenceNumberCyclic lastSeqNum = SequenceNumberCyclic(0);
// Store the predecessor so the first increment emits sequence number 0.
SequenceNumberCyclic lastSeqNum = SequenceNumberCyclic(4095);

public:
virtual void assignSequenceNumber(const Ptr<Ieee80211DataOrMgmtHeader>& header) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ void QoSSequenceNumberAssignment::assignSequenceNumber(const Ptr<Ieee80211DataOr
it->second = seqNum = it->second + 1;
}
if (type == SHARED) {
// IEEE Std 802.11-2024, 10.3.2.14.2 and Table 10-5 (SNS1/TR1): advance the shared counter per frame and skip a same-RA duplicate.
seqNum = lastSentSharedCounterSeqNum;
lastSentSharedCounterSeqNum = lastSentSharedCounterSeqNum + 1;
auto it = lastSentSharedSeqNums.find(address);
if (it == lastSentSharedSeqNums.end())
lastSentSharedSeqNums[address] = seqNum = lastSentSharedCounterSeqNum;
else {
if (it->second == lastSentSharedCounterSeqNum)
lastSentSharedCounterSeqNum = lastSentSharedCounterSeqNum + 1; // make it different from the last sequence number sent to that RA (spec: "add 2")
it->second = seqNum = lastSentSharedCounterSeqNum;
if (it != lastSentSharedSeqNums.end() && it->second == seqNum) {
seqNum = lastSentSharedCounterSeqNum;
lastSentSharedCounterSeqNum = lastSentSharedCounterSeqNum + 1; // make it different from the last sequence number sent to that RA (spec: "add 2")
}
lastSentSharedSeqNums[address] = seqNum;
}
else if (type == DATA) {
const Ptr<const Ieee80211DataHeader>& qosDataHeader = dynamicPtrCast<const Ieee80211DataHeader>(header);
Expand All @@ -64,4 +65,3 @@ void QoSSequenceNumberAssignment::assignSequenceNumber(const Ptr<Ieee80211DataOr

} /* namespace ieee80211 */
} /* namespace inet */

148 changes: 74 additions & 74 deletions tests/fingerprint/examples.csv

Large diffs are not rendered by default.

192 changes: 96 additions & 96 deletions tests/fingerprint/showcases.csv

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions tests/fingerprint/tutorials.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
/tutorials/configurator/, -f omnetpp.ini -c Step7A -r 0, 500s, 0000-0000/tplx;0000-0000/~tNl;0000-0000/~tND;0000-0000/tyf, PASS,
/tutorials/configurator/, -f omnetpp.ini -c Step7B -r 0, 500s, 0000-0000/tplx;0000-0000/~tNl;0000-0000/~tND;0000-0000/tyf, PASS,
/tutorials/configurator/, -f omnetpp.ini -c Step7C -r 0, 500s, 0000-0000/tplx;0000-0000/~tNl;0000-0000/~tND;0000-0000/tyf, PASS,
/tutorials/configurator/, -f omnetpp.ini -c Step8A -r 0, 100s, 0b7e-7adc/tplx;12a6-f004/~tNl;8b42-bf7b/~tND;d3f3-ed4c/tyf, PASS, wireless EthernetMac Ipv4 # Step8A extended
/tutorials/configurator/, -f omnetpp.ini -c Step8B -r 0, 100s, b1ac-8912/tplx;12a6-f004/~tNl;96e2-030b/~tND;af16-1150/tyf, PASS, wireless EthernetMac Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step9 -r 0, 100s, 3383-4549/tplx;4ff7-140d/~tNl;75f7-37ae/~tND;c38c-98ef/tyf, PASS, wireless EthernetMac Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step8A -r 0, 100s, 0b7e-7adc/tplx;12a6-f004/~tNl;2eb3-e15e/~tND;d3f3-ed4c/tyf, PASS, wireless EthernetMac Ipv4 # Step8A extended
/tutorials/configurator/, -f omnetpp.ini -c Step8B -r 0, 100s, b1ac-8912/tplx;12a6-f004/~tNl;d4d4-0d3a/~tND;af16-1150/tyf, PASS, wireless EthernetMac Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step9 -r 0, 100s, 3383-4549/tplx;4ff7-140d/~tNl;e44d-7e94/~tND;c38c-98ef/tyf, PASS, wireless EthernetMac Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step10A -r 0, 100s, 4b6f-7cd9/tplx;0000-0000/~tNl;0000-0000/~tND;095d-75bd/tyf, PASS, wireless # Step10A extended
/tutorials/configurator/, -f omnetpp.ini -c Step10B -r 0, 100s, 4b6f-7cd9/tplx;0000-0000/~tNl;0000-0000/~tND;4d60-fcf9/tyf, PASS, wireless # Step10B extended
/tutorials/configurator/, -f omnetpp.ini -c Step10C -r 0, 100s, 71f5-b341/tplx;4a61-20ba/~tNl;707b-bb40/~tND;f078-56fe/tyf, PASS, wireless Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step10C -r 0, 100s, 71f5-b341/tplx;4a61-20ba/~tNl;54d7-cacb/~tND;f078-56fe/tyf, PASS, wireless Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step11A -r 0, 500s, 0000-0000/tplx;0000-0000/~tNl;0000-0000/~tND;0000-0000/tyf, PASS,
/tutorials/configurator/, -f omnetpp.ini -c Step11B -r 0, 500s, 49cf-d241/tplx;725c-f075/~tNl;15a3-3f79/~tND;7082-ff49/tyf, PASS, EthernetMac Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step12 -r 0, 100s, e75f-2a09/tplx;d302-92c4/~tNl;b67b-3f1f/~tND;4b03-e5a1/tyf, PASS, wireless EthernetMac Ipv4
/tutorials/configurator/, -f omnetpp.ini -c Step12 -r 0, 100s, e75f-2a09/tplx;d302-92c4/~tNl;086e-0bdf/~tND;4b03-e5a1/tyf, PASS, wireless EthernetMac Ipv4

/tutorials/rip/, -f omnetpp.ini -c Step1 -r 0, 100s, 2c94-a8bb/tplx;b4e0-1e61/~tNl;4bd3-4530/~tND;1e4a-2625/tyf, PASS,
/tutorials/rip/, -f omnetpp.ini -c Step2 -r 0, 100s, 6019-f318/tplx;9372-788f/~tNl;8293-fb18/~tND;a345-d423/tyf, PASS, # Step2 extended
Expand Down
82 changes: 82 additions & 0 deletions tests/unit/Ieee80211SequenceAllocation_1.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
%description:
Verify shared sequence-space progression, first allocation, modulo wrap and
receiver/TID separation. IEEE Std 802.11-2024, 10.3.2.14.2 and Table 10-5.

%includes:
#include "inet/linklayer/ieee80211/mac/sequencenumberassignment/LegacySequenceNumberAssignment.h"
#include "inet/linklayer/ieee80211/mac/sequencenumberassignment/NonQoSSequenceNumberAssignment.h"
#include "inet/linklayer/ieee80211/mac/sequencenumberassignment/QoSSequenceNumberAssignment.h"

using namespace inet;
using namespace inet::ieee80211;

%global:
static Ptr<Ieee80211MgmtHeader> management(const MacAddress& receiver)
{
auto header = makeShared<Ieee80211MgmtHeader>();
header->setType(ST_AUTHENTICATION);
header->setReceiverAddress(receiver);
return header;
}

static Ptr<Ieee80211DataHeader> qos(const MacAddress& receiver, int tid)
{
auto header = makeShared<Ieee80211DataHeader>();
header->setType(ST_DATA_WITH_QOS);
header->setReceiverAddress(receiver);
header->setTid(tid);
return header;
}

%activity:
const MacAddress a("02:00:00:00:00:01"), b("02:00:00:00:00:02");
LegacySequenceNumberAssignment legacy;
NonQoSSequenceNumberAssignment nonQos;
QoSSequenceNumberAssignment shared;
for (int i = 0; i < 4098; i++) {
for (ISequenceNumberAssignment *allocator : {static_cast<ISequenceNumberAssignment *>(&legacy),
static_cast<ISequenceNumberAssignment *>(&nonQos), static_cast<ISequenceNumberAssignment *>(&shared)}) {
auto header = management(i % 2 ? b : a);
allocator->assignSequenceNumber(header);
ASSERT(header->getSequenceNumber().get() == i % 4096);
}
}

// The QoS individual-data SNS is independent of shared management traffic and
// of both the receiver and TID of other individually addressed QoS streams.
for (int i = 0; i < 3; i++) {
for (const auto& receiver : {a, b}) {
for (int tid : {0, 5}) {
auto header = qos(receiver, tid);
shared.assignSequenceNumber(header);
ASSERT(header->getSequenceNumber().get() == i);
}
}
}

// Table 10-5 TR1: avoid reusing receiver A's last number after the other
// receiver has consumed the remainder of the shared counter's cycle.
for (bool useQos : {false, true}) {
NonQoSSequenceNumberAssignment nonQosCollision;
QoSSequenceNumberAssignment qosCollision;
ISequenceNumberAssignment *allocator = useQos ?
static_cast<ISequenceNumberAssignment *>(&qosCollision) : &nonQosCollision;
auto first = management(a);
allocator->assignSequenceNumber(first);
ASSERT(first->getSequenceNumber().get() == 0);
for (int i = 1; i < 4096; i++) {
auto other = management(b);
allocator->assignSequenceNumber(other);
ASSERT(other->getSequenceNumber().get() == i);
}
auto collision = management(a);
allocator->assignSequenceNumber(collision);
ASSERT(collision->getSequenceNumber().get() == 1);
auto next = management(b);
allocator->assignSequenceNumber(next);
ASSERT(next->getSequenceNumber().get() == 2);
}
EV << "Sequence allocation starts at zero, advances shared spaces and wraps safely.\n";

%contains: stdout
Sequence allocation starts at zero, advances shared spaces and wraps safely.