From 7644baf240d46ae76ff7f4b2b0cea0b15f038858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levente=20M=C3=A9sz=C3=A1ros?= Date: Mon, 9 Oct 2023 15:27:32 +0200 Subject: [PATCH] L3NetworkConfiguratorBase: Fixed #913, copied frame creation code from "errorRate" to "delay" autoroute metric. This fix is a temporary kludge but currently there's no other way to make this work. --- .../configurator/base/L3NetworkConfiguratorBase.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/inet/networklayer/configurator/base/L3NetworkConfiguratorBase.cc b/src/inet/networklayer/configurator/base/L3NetworkConfiguratorBase.cc index 5d68f221de5..2511880c470 100644 --- a/src/inet/networklayer/configurator/base/L3NetworkConfiguratorBase.cc +++ b/src/inet/networklayer/configurator/base/L3NetworkConfiguratorBase.cc @@ -383,7 +383,14 @@ double L3NetworkConfiguratorBase::computeWirelessLinkWeight(Link *link, const ch cModule *receiverInterfaceModule = receiverInterfaceInfo->networkInterface; const IRadio *transmitterRadio = check_and_cast(transmitterInterfaceModule->getSubmodule("radio")); const IRadio *receiverRadio = check_and_cast(receiverInterfaceModule->getSubmodule("radio")); - const Packet *macFrame = new Packet(); + Packet *macFrame = new Packet(); + auto byteCountChunk = makeShared(B(transmitterInterfaceInfo->networkInterface->getMtu())); + macFrame->insertAtBack(byteCountChunk); + + // KLUDGE the frame must contain the PHY header to create a transmission + macFrame->addTag()->setProtocol(&Protocol::ackingMac); + check_and_cast(transmitterRadio)->encapsulate(macFrame); + const IRadioMedium *radioMedium = receiverRadio->getMedium(); const ITransmission *transmission = transmitterRadio->getTransmitter()->createTransmission(transmitterRadio, macFrame, simTime()); const IArrival *arrival = radioMedium->getPropagation()->computeArrival(transmission, receiverRadio->getAntenna()->getMobility()); @@ -409,7 +416,7 @@ double L3NetworkConfiguratorBase::computeWirelessLinkWeight(Link *link, const ch auto byteCountChunk = makeShared(B(transmitterInterfaceInfo->networkInterface->getMtu())); transmittedFrame->insertAtBack(byteCountChunk); - // KLUDGE + // KLUDGE the frame must contain the PHY header to create a transmission transmittedFrame->addTag()->setProtocol(&Protocol::ackingMac); check_and_cast(transmitterRadio)->encapsulate(transmittedFrame);