Skip to content

Commit

Permalink
PimDm: Replaced ASSERT(route) statements with conditional warnings be…
Browse files Browse the repository at this point in the history
…cause it depends on packet data.
  • Loading branch information
levy committed Feb 7, 2024
1 parent 8e47511 commit 2c1fa83
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions src/inet/routing/pim/modes/PimDm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,23 +491,27 @@ void PimDm::processJoinPrunePacket(Packet *pk)
int numRpfNeighbors = pimNbt->getNumNeighbors(incomingInterface->getInterfaceId());

for (unsigned int i = 0; i < pkt->getJoinPruneGroupsArraySize(); i++) {
JoinPruneGroup group = pkt->getJoinPruneGroups(i);
Ipv4Address groupAddr = group.getGroupAddress().groupAddress.toIpv4();
JoinPruneGroup joinPruneGroup = pkt->getJoinPruneGroups(i);
Ipv4Address group = joinPruneGroup.getGroupAddress().groupAddress.toIpv4();

// go through list of joined sources
for (unsigned int j = 0; j < group.getJoinedSourceAddressArraySize(); j++) {
const auto& source = group.getJoinedSourceAddress(j);
Route *route = findRoute(source.sourceAddress.toIpv4(), groupAddr);
ASSERT(route);
processJoin(route, incomingInterface->getInterfaceId(), numRpfNeighbors, upstreamNeighborAddress);
for (unsigned int j = 0; j < joinPruneGroup.getJoinedSourceAddressArraySize(); j++) {
Ipv4Address source = joinPruneGroup.getJoinedSourceAddress(j).sourceAddress.toIpv4();
Route *route = findRoute(source, group);
if (route != nullptr)
processJoin(route, incomingInterface->getInterfaceId(), numRpfNeighbors, upstreamNeighborAddress);
else
EV_WARN << "Route not found for join" << EV_FIELD(source) << EV_FIELD(group) << std::endl;
}

// go through list of pruned sources
for (unsigned int j = 0; j < group.getPrunedSourceAddressArraySize(); j++) {
const auto& source = group.getPrunedSourceAddress(j);
Route *route = findRoute(source.sourceAddress.toIpv4(), groupAddr);
ASSERT(route);
processPrune(route, incomingInterface->getInterfaceId(), pkt->getHoldTime(), numRpfNeighbors, upstreamNeighborAddress);
for (unsigned int j = 0; j < joinPruneGroup.getPrunedSourceAddressArraySize(); j++) {
Ipv4Address source = joinPruneGroup.getPrunedSourceAddress(j).sourceAddress.toIpv4();
Route *route = findRoute(source, group);
if (route != nullptr)
processPrune(route, incomingInterface->getInterfaceId(), pkt->getHoldTime(), numRpfNeighbors, upstreamNeighborAddress);
else
EV_WARN << "Route not found for prune" << EV_FIELD(source) << EV_FIELD(group) << std::endl;
}
}

Expand Down Expand Up @@ -713,7 +717,10 @@ void PimDm::processGraft(Ipv4Address source, Ipv4Address group, Ipv4Address send
EV_DEBUG << "Processing Graft(S=" << source << ", G=" << group << "), sender=" << sender << "incoming if=" << incomingInterfaceId << endl;

Route *route = findRoute(source, group);
ASSERT(route);
if (route == nullptr) {
EV_WARN << "Route not found for graft" << EV_FIELD(source) << EV_FIELD(group) << std::endl;
return;
}

UpstreamInterface *upstream = route->upstreamInterface;

Expand Down Expand Up @@ -1288,7 +1295,10 @@ void PimDm::multicastPacketArrivedOnRpfInterface(int interfaceId, Ipv4Address gr
EV_DETAIL << "Multicast datagram arrived: source=" << source << ", group=" << group << ".\n";

Route *route = findRoute(source, group);
ASSERT(route);
if (route == nullptr) {
EV_WARN << "Route not found for packet on RPF interface" << EV_FIELD(source) << EV_FIELD(group) << std::endl;
return;
}
UpstreamInterface *upstream = route->upstreamInterface;

// RFC 3973 4.5.2.2
Expand Down

0 comments on commit 2c1fa83

Please sign in to comment.