Lines 910-940
void Ipv6L3Protocol::IpMulticastForward (Ptr<Ipv6MulticastRoute> mrtentry, Ptr<c
|
Link Here
|
---|
|
910 |
NS_LOG_FUNCTION (this << mrtentry << p << header); |
910 |
NS_LOG_FUNCTION (this << mrtentry << p << header); |
911 |
NS_LOG_LOGIC ("Multicast forwarding logic for node: " << m_node->GetId ()); |
911 |
NS_LOG_LOGIC ("Multicast forwarding logic for node: " << m_node->GetId ()); |
912 |
|
912 |
|
913 |
// The output interfaces we could forward this onto are encoded |
913 |
std::map<uint32_t, uint32_t> ttlMap = mrtentry->GetOutputTtlMap(); |
914 |
// in the OutputTtl of the Ipv6MulticastRoute |
914 |
std::map<uint32_t, uint32_t>::iterator mapIter; |
915 |
for (uint32_t i = 0 ; i < Ipv6MulticastRoute::MAX_INTERFACES ; i++) |
915 |
|
|
|
916 |
for (mapIter = ttlMap.begin(); mapIter != ttlMap.end(); mapIter++) |
916 |
{ |
917 |
{ |
917 |
if (mrtentry->GetOutputTtl (i) < Ipv6MulticastRoute::MAX_TTL) |
918 |
uint32_t interfaceId = mapIter->first; |
918 |
{ |
919 |
//uint32_t outputTtl = mapIter->second; // We never use this, do we? |
919 |
Ptr<Packet> packet = p->Copy (); |
|
|
920 |
Ipv6Header h = header; |
921 |
h.SetHopLimit (header.GetHopLimit () - 1); |
922 |
if (h.GetHopLimit () == 0) |
923 |
{ |
924 |
NS_LOG_WARN ("TTL exceeded. Drop."); |
925 |
m_dropTrace (header, packet, DROP_TTL_EXPIRED, i); |
926 |
return; |
927 |
} |
928 |
|
920 |
|
929 |
NS_LOG_LOGIC ("Forward multicast via interface " << i); |
921 |
Ptr<Packet> packet = p->Copy (); |
930 |
Ptr<Ipv6Route> rtentry = Create<Ipv6Route> (); |
922 |
Ipv6Header h = header; |
931 |
rtentry->SetSource (h.GetSourceAddress ()); |
923 |
h.SetHopLimit (header.GetHopLimit () - 1); |
932 |
rtentry->SetDestination (h.GetDestinationAddress ()); |
924 |
if (h.GetHopLimit () == 0) |
933 |
rtentry->SetGateway (Ipv6Address::GetAny ()); |
925 |
{ |
934 |
rtentry->SetOutputDevice (GetNetDevice (i)); |
926 |
NS_LOG_WARN ("TTL exceeded. Drop."); |
935 |
SendRealOut (rtentry, packet, h); |
927 |
m_dropTrace (header, packet, DROP_TTL_EXPIRED, interfaceId); |
936 |
continue; |
928 |
return; |
937 |
} |
929 |
} |
|
|
930 |
NS_LOG_LOGIC ("Forward multicast via interface " << interfaceId); |
931 |
Ptr<Ipv6Route> rtentry = Create<Ipv6Route> (); |
932 |
rtentry->SetSource (h.GetSourceAddress ()); |
933 |
rtentry->SetDestination (h.GetDestinationAddress ()); |
934 |
rtentry->SetGateway (Ipv6Address::GetAny ()); |
935 |
rtentry->SetOutputDevice (GetNetDevice (interfaceId)); |
936 |
SendRealOut (rtentry, packet, h); |
937 |
continue; |
938 |
} |
938 |
} |
939 |
} |
939 |
} |
940 |
|
940 |
|