From 0fce45fb848ac1f76d6707de468f183495f064b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Gonz=C3=A1lez=20L=C3=B3pez?= Date: Sun, 31 May 2026 21:39:46 +0200 Subject: [PATCH] [FIX] [IPv6] Use correct destination address so packets with multicast destination are properly handled --- src/inet/networklayer/ipv6/Ipv6.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/inet/networklayer/ipv6/Ipv6.cc b/src/inet/networklayer/ipv6/Ipv6.cc index a45f4fdd267..90b72a28737 100644 --- a/src/inet/networklayer/ipv6/Ipv6.cc +++ b/src/inet/networklayer/ipv6/Ipv6.cc @@ -403,7 +403,10 @@ void Ipv6::datagramLocalOut(Packet *packet, const NetworkInterface *destIE, Ipv6 const auto& ipv6Header = packet->peekAtFront(); // route packet if (destIE != nullptr) - fragmentPostRouting(packet, destIE, MacAddress::BROADCAST_ADDRESS, true); // FIXME what MAC address to use? + if(!ipv6Header->getDestAddress().isMulticast()) + fragmentPostRouting(packet, destIE, MacAddress::BROADCAST_ADDRESS, true); + else + fragmentPostRouting(packet, destIE, ipv6Header->getDestAddress().mapToMulticastMacAddress(), true); else if (!ipv6Header->getDestAddress().isMulticast()) routePacket(packet, destIE, nullptr, requestedNextHopAddress, true); else @@ -602,7 +605,7 @@ void Ipv6::routeMulticastPacket(Packet *packet, const NetworkInterface *destIE, for (int i = 0; i < ift->getNumInterfaces(); i++) { NetworkInterface *ie = ift->getInterface(i); if (fromIE != ie && !ie->isLoopback()) - fragmentPostRouting(packet->dup(), ie, MacAddress::BROADCAST_ADDRESS, fromHL); + fragmentPostRouting(packet->dup(), ie, ipv6Header->getDestAddress().mapToMulticastMacAddress(), fromHL); } delete packet;