inet icon indicating copy to clipboard operation
inet copied to clipboard

QueueingPacketDelayer is broken in multiple ways

Open haug-den-lucas opened this issue 2 years ago • 0 comments

Hello,

I think the QueueingPacketDelayer seems to be broken in multiple ways.

Initial Situation

I'm using the TimeAwareShaper showcase and want to use the QueueingPacketDelayer as the delayer in *.switch.bridging.directionReverser.delayer.

What works

The following code (using the normal PacketDelayer) works just fine and produces the intended results:

*.switch.bridging.directionReverser.delayer.typename = "PacketDelayer"
*.switch.bridging.directionReverser.delayer.delay = uniform(0ms,1ms)

What does not work:

However, if i replace the PacketDelayer with the QueueingPacketDelayer everything breaks:

*.switch.bridging.directionReverser.delayer.typename = "QueueingPacketDelayer"
*.switch.bridging.directionReverser.delayer.delay = uniform(0ms,1ms)

If you want to replicate the errors, these are the only two lines I've changed in the omnetpp.ini for the TimeAwareShaper showcase.

As to my understanding, as both implement the IPacketDelayer interface they should be interchangeable, especially if the definition explicitly expects a type of this interface: https://github.com/inet-framework/inet/blob/a97d9403982774eceb39f746920ec83ac8e1d3cb/src/inet/linklayer/ethernet/common/DirectionReverserLayer.ned#L38 I would like to fix the issue myself and create a PR, however the problems dive deeper into the code than my understanding of it, so I'm summarizing what problems I already figured out:

Problem 1: No clockModule defined

As specified in the QueueingPacketDelayer.cc, the clockModule parameter should be optional: https://github.com/inet-framework/inet/blob/a97d9403982774eceb39f746920ec83ac8e1d3cb/src/inet/queueing/common/QueueingPacketDelayer.ned#L17 However, this is not the case, if I do not specify a clockModule, the simulation fails directly after startup with:

Cannot assign parameter 'clockModule': Parameter refers to itself in its assignment (did you mean 'parent.clockModule'?) -- at /home/haugls/workspaces/d6g/inet/src/inet/queueing/common/QueueingPacketDelayer.ned:19 -- in module (inet::queueing::PacketServer) TsnLinearNetwork.switch.bridging.directionReverser.delayer.server (id=194), during network setup

As I do not need the clockModule by now, I tried a hacky fix and simply removed the following L17 and L19 from the code: https://github.com/inet-framework/inet/blob/a97d9403982774eceb39f746920ec83ac8e1d3cb/src/inet/queueing/common/QueueingPacketDelayer.ned#L17-L19 I should be able to fix this myself properly though if necessary.

Problem 2: QueueingPacketDelayer links to (wrong) class

As to my understanding as QueueingPacketDelayer is not a simple module there shouldn't be any direct C++-Code involved, however it links to the PacketDelayer class: https://github.com/inet-framework/inet/blob/a97d9403982774eceb39f746920ec83ac8e1d3cb/src/inet/queueing/common/QueueingPacketDelayer.ned#L20 This class isn't compatible at all, so the simulation crashes with

Unknown parameter 'displayStringTextFormat' -- in module (inet::queueing::PacketDelayer) TsnLinearNetwork.switch.bridging.directionReverser.delayer (id=186), during network initialization

I assume simply removing this line is the proper fix for it, so I did exactly that.

Problem 3: Inserting the QueueingPacketDelayer has unwanted side effects

With my two fixes above the simulation now starts up properly. However, the simulation fails with:

handlePacket(): Unknown protocol: protocolId = 38, protocolName = ipv4, servicePrimitive = INDICATION, pathStartGate = TsnLinearNetwork.switch.ieee8021q.qTagHeaderChecker.out, pathEndGate = TsnLinearNetwork.switch.bl.in[1] -- in module (inet::MessageDispatcher) TsnLinearNetwork.switch.bl (id=165), at t=0.00008037s, event #21

Here is the Event log for #21:

#21	0.000'080'370	eth[0] --> li	best effort-0	10.0.0.1:1025	10.0.0.2:1000	UDP		996 B	(UNKNOWN) 946 B | 1025->1000, payload:946 B | IPv4 id:0 ttl:32 payload:udp 954 B | (UNIMPLEMENTED IEEE 802.1Q C-TAG) (inet::Ieee8021qTagEpdHeader) pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | (Eth) (inet::EthernetMacHeader) typeOrLength = 33024
#21	0.000'080'370	eth[0] --> li	best effort-0	10.0.0.1:1025	10.0.0.2:1000	UDP		996 B	(UNKNOWN) 946 B | 1025->1000, payload:946 B | IPv4 id:0 ttl:32 payload:udp 954 B | (UNIMPLEMENTED IEEE 802.1Q C-TAG) (inet::Ieee8021qTagEpdHeader) pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | (Eth) (inet::EthernetMacHeader) typeOrLength = 33024
#21	0.000'080'370	li --> ethernet	best effort-0	10.0.0.1:1025	10.0.0.2:1000	UDP		996 B	(UNKNOWN) 946 B | 1025->1000, payload:946 B | IPv4 id:0 ttl:32 payload:udp 954 B | (UNIMPLEMENTED IEEE 802.1Q C-TAG) (inet::Ieee8021qTagEpdHeader) pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | (Eth) (inet::EthernetMacHeader) typeOrLength = 33024
#21	0.000'080'370	ethernet --> bl	best effort-0	10.0.0.1:1025	10.0.0.2:1000	UDP		978 B	(UNKNOWN) 946 B | 1025->1000, payload:946 B | IPv4 id:0 ttl:32 payload:udp 954 B | (UNIMPLEMENTED IEEE 802.1Q C-TAG) (inet::Ieee8021qTagEpdHeader) pcp = 0, dei = false, vid = 0, typeOrLength = 2048
#21	0.000'080'370	bl --> li	best effort-0	10.0.0.1:1025	10.0.0.2:1000	UDP		978 B	(UNKNOWN) 946 B | 1025->1000, payload:946 B | IPv4 id:0 ttl:32 payload:udp 954 B | (UNIMPLEMENTED IEEE 802.1Q C-TAG) (inet::Ieee8021qTagEpdHeader) pcp = 0, dei = false, vid = 0, typeOrLength = 2048
#21	0.000'080'370	li --> ieee8021q	best effort-0	10.0.0.1:1025	10.0.0.2:1000	UDP		978 B	(UNKNOWN) 946 B | 1025->1000, payload:946 B | IPv4 id:0 ttl:32 payload:udp 954 B | (UNIMPLEMENTED IEEE 802.1Q C-TAG) (inet::Ieee8021qTagEpdHeader) pcp = 0, dei = false, vid = 0, typeOrLength = 2048
#21	0.000'080'370	ieee8021q --> bl	best effort-0	10.0.0.1:1025	10.0.0.2:1000	UDP		974 B	(UNKNOWN) 946 B | 1025->1000, payload:946 B | IPv4 id:0 ttl:32 payload:udp 954 B

And the log itself:

** Event #21  t=0.00008037  TsnLinearNetwork.switch.eth[0].phyLayer.receiver (PacketReceiver, id=264)  on best effort-0 (inet::physicallayer::Signal, id=87)

INFO: Receiving signal from channel, signal = (Signal)best effort-0 (80.32 us 1004 B)(Packet)best effort-0 (1004 B) [EthernetPhyHeader | EthernetMacHeader | Ieee8021qTagEpdHeader | Ipv4Header | UdpHeader | ByteCountChunk | EthernetFcs].
INFO (EthernetPhyHeaderChecker)TsnLinearNetwork.switch.eth[0].phyLayer.phyHeaderChecker: Passing through packet, packet = (Packet)best effort-0 (996 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].
INFO (EthernetFcsChecker)TsnLinearNetwork.switch.eth[0].macLayer.fcsChecker: Passing through packet, packet = (Packet)best effort-0 (996 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].
INFO (MessageDispatcher)TsnLinearNetwork.switch.li: Dispatching packet to protocol, protocol = ethernetmac(12), servicePrimitive = 2, inGate = (omnetpp::cGate)in[4] <-- eth[0].upperLayerOut, outGate = (omnetpp::cGate)out[0] --> ethernet.lowerLayerIn, packet = (Packet)best effort-0 (996 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].
INFO (EthernetFcsChecker)TsnLinearNetwork.switch.ethernet.fcsChecker: Passing through packet, packet = (Packet)best effort-0 (992 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].
INFO (EthernetMacHeaderChecker)TsnLinearNetwork.switch.ethernet.macHeaderChecker: Passing through packet, packet = (Packet)best effort-0 (978 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].
INFO (MessageDispatcher)TsnLinearNetwork.switch.bl: Dispatching packet to protocol, protocol = ieee8021qctag(31), servicePrimitive = 2, inGate = (omnetpp::cGate)in[3] <-- ethernet.upperLayerOut, outGate = (omnetpp::cGate)out[0] --> li.in[3], packet = (Packet)best effort-0 (978 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].
INFO (MessageDispatcher)TsnLinearNetwork.switch.li: Dispatching packet to protocol, protocol = ieee8021qctag(31), servicePrimitive = 2, inGate = (omnetpp::cGate)in[3] <-- bl.out[0], outGate = (omnetpp::cGate)out[1] --> ieee8021q.lowerLayerIn, packet = (Packet)best effort-0 (978 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].
INFO (Ieee8021qTagEpdHeaderChecker)TsnLinearNetwork.switch.ieee8021q.qTagHeaderChecker: Passing through packet, packet = (Packet)best effort-0 (974 B) [EthernetPhyHeader | EthernetMacHeader, typeOrLength = 33024 | Ieee8021qTagEpdHeader, pcp = 0, dei = false, vid = 0, typeOrLength = 2048 | Ipv4Header, version = 4, headerLength = 20 B, typeOfService = 0, totalLengthField = 974 B, identification = 0, reservedBit = false, moreFragments = false, dontFragment = false, fragmentOffset = 0, timeToLive = 32, protocolId = 17 (IP_PROT_UDP), crc = 49165, crcMode = 1 (CRC_DECLARED_CORRECT), srcAddress = 10.0.0.1, destAddress = 10.0.0.2, options =  | UdpHeader, srcPort = 1025, destPort = 1000, totalLengthField = 954 B, crc = c00d, crcMode = 1 (CRC_DECLARED_CORRECT) | ByteCountChunk, length = 946 B, data = 63 | EthernetFcs, fcs = 3222126605, fcsMode = 1 (FCS_DECLARED_CORRECT)].

This seems like an unwanted side effect. Also at this point I don't have a deep enough knowledge of the INET codebase to fix it myself. So I'd be glad if this problem gets fixed or someone provides me with more information so I can fix it myself, so I can create a PR.

haug-den-lucas avatar Oct 19 '23 15:10 haug-den-lucas