Skip to content

Commit

Permalink
Ipv4NetworkConfigurator: Extended static multicast routes with an add…
Browse files Browse the repository at this point in the history
…itional route for the leaf nodes with no output interfaces.

This prevents packets being reported as dropped because no route is found even though
the packets are delivered locally.
  • Loading branch information
levy committed Mar 22, 2024
1 parent bb1e34d commit 16c05ce
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/inet/networklayer/configurator/ipv4/Ipv4NetworkConfigurator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1933,13 +1933,11 @@ void Ipv4NetworkConfigurator::addStaticMulticastRoutes(Topology& topology, Node
InterfaceInfo *inInterfaceInfo = nullptr;
InterfaceInfo *outInterfaceInfo = nullptr;
Node *node = receiverNode;
while (node != sourceNode && node->getNumPaths() > 0) {
while (true) {
auto link = (Link *)node->getPath(0);
outInterfaceInfo = static_cast<InterfaceInfo *>(link->destinationInterfaceInfo);
node = (Node *)link->getLinkOutRemoteNode();
inInterfaceInfo = node == sourceNode ? nullptr : static_cast<InterfaceInfo *>(((Link *)node->getPath(0))->sourceInterfaceInfo);
inInterfaceInfo = node == sourceNode ? nullptr : static_cast<InterfaceInfo *>(link->sourceInterfaceInfo);
ASSERT(inInterfaceInfo == nullptr || inInterfaceInfo->node == node);
ASSERT(outInterfaceInfo->node == node);
ASSERT(outInterfaceInfo == nullptr || outInterfaceInfo->node == node);

Ipv4Address origin = Ipv4Address::UNSPECIFIED_ADDRESS;
Ipv4Address originNetmask = Ipv4Address::UNSPECIFIED_ADDRESS;
Expand Down Expand Up @@ -1973,15 +1971,25 @@ void Ipv4NetworkConfigurator::addStaticMulticastRoutes(Topology& topology, Node
node->staticMulticastRoutes.push_back(route);
}

bool foundOutInterface = false;
for (unsigned int i = 0; i < route->getNumOutInterfaces(); i++)
if (route->getOutInterface(i)->getInterface() == outInterfaceInfo->networkInterface) {
foundOutInterface = true;
break;
if (outInterfaceInfo != nullptr) {
bool foundOutInterface = false;
for (unsigned int i = 0; i < route->getNumOutInterfaces(); i++) {
if (route->getOutInterface(i)->getInterface() == outInterfaceInfo->networkInterface) {
foundOutInterface = true;
break;
}
}
if (!foundOutInterface) {
route->addOutInterface(new Ipv4MulticastRoute::OutInterface(outInterfaceInfo->networkInterface, false /*TODOisLeaf*/));
EV_INFO << "Extending static multicast route " << *route << " in " << node->module->getFullPath() << endl;
}
if (!foundOutInterface) {
route->addOutInterface(new Ipv4MulticastRoute::OutInterface(outInterfaceInfo->networkInterface, false /*TODOisLeaf*/));
EV_INFO << "Extending static multicast route " << *route << " in " << node->module->getFullPath() << endl;
}

if (node == sourceNode || node->getNumPaths() == 0)
break;
else {
outInterfaceInfo = static_cast<InterfaceInfo *>(link->destinationInterfaceInfo);
node = (Node *)link->getLinkOutRemoteNode();
}
}
}
Expand Down

0 comments on commit 16c05ce

Please sign in to comment.