src/internet/model/ipv6-l3-protocol.cc
changeset 7161 7cc4506fb853
parent 7158 4fe055d32d78
child 7176 9f2663992e99
--- a/src/internet/model/ipv6-l3-protocol.cc	Thu May 12 23:14:54 2011 -0700
+++ b/src/internet/model/ipv6-l3-protocol.cc	Fri May 13 00:21:25 2011 -0700
@@ -910,31 +910,30 @@
   NS_LOG_FUNCTION (this << mrtentry << p << header);
   NS_LOG_LOGIC ("Multicast forwarding logic for node: " << m_node->GetId ());
 
-  // The output interfaces we could forward this onto are encoded
-  // in the OutputTtl of the Ipv6MulticastRoute
-  for (uint32_t i = 0 ; i < Ipv6MulticastRoute::MAX_INTERFACES ; i++)
+  std::map<uint32_t, uint32_t> ttlMap = mrtentry->GetOutputTtlMap();
+  std::map<uint32_t, uint32_t>::iterator mapIter;
+
+  for (mapIter = ttlMap.begin(); mapIter != ttlMap.end(); mapIter++)
     {
-      if (mrtentry->GetOutputTtl (i) < Ipv6MulticastRoute::MAX_TTL)
+      uint32_t interfaceId = mapIter->first;
+      //uint32_t outputTtl = mapIter->second;  // Unused for now
+      Ptr<Packet> packet = p->Copy ();
+      Ipv6Header h = header;
+      h.SetHopLimit (header.GetHopLimit () - 1);
+      if (h.GetHopLimit () == 0)
         {
-          Ptr<Packet> packet = p->Copy ();
-          Ipv6Header h = header;
-          h.SetHopLimit (header.GetHopLimit () - 1);
-          if (h.GetHopLimit () == 0)
-            {
-              NS_LOG_WARN ("TTL exceeded.  Drop.");
-              m_dropTrace (header, packet, DROP_TTL_EXPIRED, m_node->GetObject<Ipv6> (), i);
-              return;
-            }
-
-          NS_LOG_LOGIC ("Forward multicast via interface " << i);
-          Ptr<Ipv6Route> rtentry = Create<Ipv6Route> ();
-          rtentry->SetSource (h.GetSourceAddress ());
-          rtentry->SetDestination (h.GetDestinationAddress ());
-          rtentry->SetGateway (Ipv6Address::GetAny ());
-          rtentry->SetOutputDevice (GetNetDevice (i));
-          SendRealOut (rtentry, packet, h);
-          continue;
+          NS_LOG_WARN ("TTL exceeded.  Drop.");
+          m_dropTrace (header, packet, DROP_TTL_EXPIRED, m_node->GetObject<Ipv6> (), interfaceId);
+          return;
         }
+      NS_LOG_LOGIC ("Forward multicast via interface " << interfaceId);
+      Ptr<Ipv6Route> rtentry = Create<Ipv6Route> ();
+      rtentry->SetSource (h.GetSourceAddress ());
+      rtentry->SetDestination (h.GetDestinationAddress ());
+      rtentry->SetGateway (Ipv6Address::GetAny ());
+      rtentry->SetOutputDevice (GetNetDevice (interfaceId));
+      SendRealOut (rtentry, packet, h);
+      continue;
     }
 }