Skip to content
Open
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
10 changes: 10 additions & 0 deletions WHATSNEW
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,16 @@ Notable backward incompatible changes are the following:
negotiation. The MacQosWithBlockAck example fingerprints are updated; the
QoS and NonQos showcase fingerprint controls remain unchanged.

17. The Proxy Registration flag of a Binding Acknowledgement is at 0x20

MobilityHeaderSerializer wrote and read the Proxy Mobile IPv6 (PMIPv6)
Proxy Registration (P) flag of a Binding Acknowledgement at 0x40, which is
the Mobile Router (R) flag of RFC 3963. It now uses 0x20, as RFC 5213
Section 10 assigns it. Simulations behave as before. The serialized bytes
of every Proxy Binding Acknowledgement change, as a packet capture or the
packet-data fingerprint ingredient shows, and a received Binding
Acknowledgement with the R flag set is no longer read as a proxy one.

Notable backward compatible changes are the following:

1. IEEE 802.11 per-station rate statistics
Expand Down
4 changes: 2 additions & 2 deletions src/inet/networklayer/mipv6/MobilityHeaderSerializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void MobilityHeaderSerializer::serializeFields(MemoryOutputStream& stream, const
auto ba = staticPtrCast<const BindingAcknowledgement>(chunk);
stream.writeByte(ba->getStatus());
stream.writeByte((ba->getKeyManagementFlag() ? 0x80u : 0)
| (ba->getProxyRegistrationFlag() ? 0x40u : 0)); // P-flag (RFC 5213)
| (ba->getProxyRegistrationFlag() ? 0x20u : 0)); // P-flag (RFC 5213 Section 10); 0x40 is NEMO's R-flag
stream.writeUint16Be(ba->getSequenceNumber());
stream.writeUint16Be(std::min(ba->getLifetime() / BINDING_LIFETIME_UNIT, 0xFFFFu));
// RFC 5213 proxy mobility options (only present when this is a Proxy Binding Acknowledgement)
Expand Down Expand Up @@ -315,7 +315,7 @@ const Ptr<Chunk> MobilityHeaderSerializer::deserializeFields(MemoryInputStream&
ba->setStatus(static_cast<BaStatus>(stream.readByte()));
uint8_t kFlag = stream.readByte();
ba->setKeyManagementFlag((kFlag & 0x80u) != 0);
ba->setProxyRegistrationFlag((kFlag & 0x40u) != 0); // P-flag (RFC 5213)
ba->setProxyRegistrationFlag((kFlag & 0x20u) != 0); // P-flag (RFC 5213 Section 10); 0x40 is NEMO's R-flag
ba->setSequenceNumber(stream.readUint16Be());
ba->setLifetime(stream.readUint16Be() * BINDING_LIFETIME_UNIT);
// RFC 5213 proxy mobility options (only present in a Proxy Binding Acknowledgement)
Expand Down
2 changes: 1 addition & 1 deletion tests/fingerprint/examples.csv
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@
/examples/ipv6/mipv6/, -f omnetpp.ini -c Handover -r 0, 70s, dca6-3751/tplx;a44c-17bf/~tNl;96ff-ed7c/~tND;44ef-1a45/tyf, PASS, wireless EthernetMac
/examples/ipv6/mipv6/, -f omnetpp.ini -c RouteOptimizationTwoCNs -r 0, 60s, 1560-028f/tplx;e6db-28c0/~tNl;805b-8a25/~tND;ed3e-17fa/tyf, PASS, wireless EthernetMac
/examples/ipv6/mipv6roaming/, -f omnetpp.ini -c Roaming -r 0, 70s, 342e-5e65/tplx;28ce-974e/~tNl;dcec-ae59/~tND;afae-2b3c/tyf, PASS, wireless EthernetMac
/examples/ipv6/pmipv6/, -f omnetpp.ini -c General -r 0, 60s, 081b-769c/tplx;1064-9bd4/~tNl;bd46-d85c/~tND;0277-d784/tyf, PASS, wireless EthernetMac
/examples/ipv6/pmipv6/, -f omnetpp.ini -c General -r 0, 60s, 081b-769c/tplx;1064-9bd4/~tNl;db46-aa59/~tND;0277-d784/tyf, PASS, wireless EthernetMac

/examples/mobility/, -f omnetpp.ini -c AnsimMobility -r 0, 10000s, 72f8-5c0b/tplx;0000-0000/~tNl;0000-0000/~tND;7dd1-18eb/tyf, PASS,
/examples/mobility, -f omnetpp.ini -c AttachedMobility, 10s, 566c-6355/tplx;0000-0000/~tNl;0000-0000/~tND;fa92-f68c/tyf, PASS,
Expand Down
77 changes: 77 additions & 0 deletions tests/unit/MobilityHeaderSerializer_1.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
%description:
The Proxy Registration (P) flag of a Proxy Mobile IPv6 (PMIPv6, RFC 5213) Binding
Acknowledgement is carried at 0x20 of the octet after the Status field. 0x40 in that octet is
the Mobile Router (R) flag of the Network Mobility (NEMO) Basic Support Protocol, RFC 3963.
RFC 5213 Section 10 assigns the Key Management Mobility Capability (K) flag 0x80, R 0x40 and
P 0x20.

A round trip cannot check this, because the serializer and the deserializer would agree on any
bit. The test compares the bytes with the RFC layout instead, in both directions: a Binding
Acknowledgement with only the P flag set serializes to 0x20, a received 0x20 decodes as the
P flag, and a received 0x40 (a NEMO acknowledgement) does not.

%includes:
#include <vector>

#include "inet/common/packet/Packet.h"
#include "inet/common/packet/chunk/BytesChunk.h"
#include "inet/networklayer/mipv6/MobilityHeaderSerializer.h"
#include "inet/networklayer/mipv6/MobilityHeader_m.h"

using namespace inet;

%global:
// Offset of the flags octet in a Binding Acknowledgement: the 6-octet common Mobility
// Header (RFC 6275 Section 6.1), then the Status octet (RFC 6275 Section 6.1.8).
static const int FLAGS_OFFSET = 7;

// A Binding Acknowledgement without proxy options: the common Mobility Header (no next
// header, length 1 = 16 octets, type 6, reserved, checksum), then status 0, the flags
// octet, sequence 1, lifetime 0, and padding.
static std::vector<uint8_t> bindingAcknowledgement(uint8_t flags)
{
return {59, 1, 6, 0, 0, 0, 0, flags, 0, 1, 0, 0, 0, 0, 0, 0};
}

// The same with the P flag set, followed by the proxy options in the model's fixed order:
// Mobile Node Identifier (length-prefixed), Home Network Prefix (prefix length, prefix) and
// Timestamp -- 6 + 6 + 16 + 17 + 8 = 53 octets, padded to 56 (length field 6).
static std::vector<uint8_t> proxyBindingAcknowledgement()
{
std::vector<uint8_t> bytes = {59, 6, 6, 0, 0, 0, 0, 0x20, 0, 1, 0, 0};
const char *nai = "mn1@example.com";
bytes.push_back(15);
bytes.insert(bytes.end(), nai, nai + 15);
bytes.push_back(64);
bytes.insert(bytes.end(), {0x20, 0x01, 0x0d, 0xb8, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0});
bytes.insert(bytes.end(), 8 + 3, 0); // timestamp, padding
return bytes;
}

%activity:
auto pba = makeShared<BindingAcknowledgement>();
pba->setMobilityHeaderType(BINDING_ACKNOWLEDGEMENT);
pba->setProxyRegistrationFlag(true);
pba->setMobileNodeIdentifier("mn1@example.com");
pba->setChunkLength(MobilityHeaderSerializer::getProxyBindingAcknowledgementLength(15));
Packet output("output", pba);
auto bytes = output.peekAllAsBytes()->getBytes();
EV << "serialized: type " << (int)bytes[2] << ", flags octet 0x" << std::hex << (int)bytes[FLAGS_OFFSET] << std::dec << "\n";

Packet proxy("proxy", makeShared<BytesChunk>(proxyBindingAcknowledgement()));
auto decodedProxy = proxy.peekAtFront<BindingAcknowledgement>();
EV << "decoded 0x20: P " << decodedProxy->getProxyRegistrationFlag() << ", K " << decodedProxy->getKeyManagementFlag()
<< ", identifier " << decodedProxy->getMobileNodeIdentifier() << "\n";

Packet nemo("nemo", makeShared<BytesChunk>(bindingAcknowledgement(0x40)));
auto decodedNemo = nemo.peekAtFront<BindingAcknowledgement>();
EV << "decoded 0x40: P " << decodedNemo->getProxyRegistrationFlag() << "\n";

%contains: stdout
serialized: type 6, flags octet 0x20

%contains: stdout
decoded 0x20: P 1, K 0, identifier mn1@example.com

%contains: stdout
decoded 0x40: P 0
Loading