Table Of Contents
Table Of Contents

Changing Packet Length

Some changes in the model, e.g. adding fields to a protocol header, can cause the packet lengths to change. This in turn leads to changes in the tplx fingerprints. The l stands for packet length, and the length of packets anywhere in the network (inlcuding host submodules) is taken into account at every event. If we drop the packet length from the fingerprint ingredients, the fingerprints might still change due to the different timings of the packets.

However, small packets are padded to fit into a minimum-size Ethernet frame of 64 bytes. In this case, the changed protocol header size wouldn’t affect tpx fingerprints, as the Ethernet frame sizes, and thus the timings, are the same. A similar padding effect happens in 802.11 frames. The data contained in the frame is a multiple of the bits/symbol times the number of subcarriers for the given modulation. For QAM-64, this is around 30 bytes. Thus we expect that for small packets the fingerprints wouldn’t change; for larger ones, they would (assuming small changes in the header size).

In the following example, we’ll increase the Udp header size from 8 bytes to 10 bytes.

Before making the change, we drop the packet length from the fingerprints and run the tests:

.,        -f omnetpp.ini -c Ethernet -r 0,               0.2s,         4500-0673/tpx, PASS,
.,        -f omnetpp.ini -c EthernetShortPacket -r 0,    0.2s,         ea97-154f/tpx, PASS,
.,        -f omnetpp.ini -c Wifi -r 0,                     5s,         791d-aba6/tpx, PASS,
.,        -f omnetpp.ini -c WifiShortPacket -r 0,          5s,         d801-fc01/tpx, PASS,
$ inet_fingerprinttest -m ChangingPacketLength
. -f omnetpp.ini -c Ethernet -r 0  ... : FAILED
. -f omnetpp.ini -c Wifi -r 0  ... : FAILED
. -f omnetpp.ini -c WifiShortPacket -r 0  ... : FAILED
. -f omnetpp.ini -c EthernetShortPacket -r 0  ... : FAILED

The tests failed because the values in the .csv file were calculated with the default ingredients. We can update the .csv with the new fingerprints:

$ mv baseline.csv.UPDATED baseline.csv

Then we increase the Udp header size:

--- /docs/doc/src/tutorials/fingerprint/sources/UdpHeader.msg.orig
+++ /docs/doc/src/tutorials/fingerprint/sources/UdpHeader.msg.mod
@@ -14,7 +14,7 @@
 
 
 cplusplus {{
-const B UDP_HEADER_LENGTH = B(8);
+const B UDP_HEADER_LENGTH = B(10);
 }}
 
 //

The change needs to be followed in UdpHeaderSerializer.cc as well: (otherwise the packets couldn’t be serialized, leading to dropped packets)

--- /docs/doc/src/tutorials/fingerprint/sources/UdpHeaderSerializer.cc.orig
+++ /docs/doc/src/tutorials/fingerprint/sources/UdpHeaderSerializer.cc.modified
@@ -20,6 +20,7 @@
     if (crcMode != CRC_DISABLED && crcMode != CRC_COMPUTED)
         throw cRuntimeError("Cannot serialize UDP header without turned off or properly computed CRC, try changing the value of crcMode parameter for Udp");
     stream.writeUint16Be(udpHeader->getCrc());
+    stream.writeUint16Be(0);
 }
 
 const Ptr<Chunk> UdpHeaderSerializer::deserialize(MemoryInputStream& stream) const
@@ -31,6 +32,7 @@
     auto crc = stream.readUint16Be();
     udpHeader->setCrc(crc);
     udpHeader->setCrcMode(crc == 0 ? CRC_DISABLED : CRC_COMPUTED);
+    stream.readUint16Be();
     return udpHeader;
 }
 

We run the fingerprint tests again:

$ inet_fingerprinttest
. -f omnetpp.ini -c Ethernet -r 0  ... : FAILED
. -f omnetpp.ini -c Wifi -r 0  ... : FAILED
. -f omnetpp.ini -c WifiShortPacket -r 0  ... : PASS
. -f omnetpp.ini -c EthernetShortPacket -r 0  ... : PASS

As expected, the tests pass when the packet size is small.