src/internet/model/icmpv6-l4-protocol.cc
changeset 9870 6543f3876ff5
parent 9817 cfb7c304cf2d
child 9874 3d1472bae52c
equal deleted inserted replaced
9869:126d9cf86d71 9870:6543f3876ff5
   166   if (!m_alwaysDad)
   166   if (!m_alwaysDad)
   167     {
   167     {
   168       return;
   168       return;
   169     }
   169     }
   170 
   170 
   171   /* TODO : disable multicast loopback to prevent NS probing to be received by the sender */
   171   /** \todo disable multicast loopback to prevent NS probing to be received by the sender */
   172 
   172 
   173   Ptr<Packet> p = ForgeNS ("::",Ipv6Address::MakeSolicitedAddress (target), target, interface->GetDevice ()->GetAddress ());
   173   Ptr<Packet> p = ForgeNS ("::",Ipv6Address::MakeSolicitedAddress (target), target, interface->GetDevice ()->GetAddress ());
   174 
   174 
   175   /* update last packet UID */
   175   /* update last packet UID */
   176   interface->SetNsDadUid (target, p->GetUid ());
   176   interface->SetNsDadUid (target, p->GetUid ());
   220       HandleEchoRequest (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
   220       HandleEchoRequest (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
   221       break;
   221       break;
   222     case Icmpv6Header::ICMPV6_ECHO_REPLY:
   222     case Icmpv6Header::ICMPV6_ECHO_REPLY:
   223       // EchoReply does not contain any info about L4
   223       // EchoReply does not contain any info about L4
   224       // so we can not forward it up.
   224       // so we can not forward it up.
   225       // TODO: implement request / reply consistency check.
   225       /// \todo implement request / reply consistency check.
   226       break;
   226       break;
   227     case Icmpv6Header::ICMPV6_ERROR_DESTINATION_UNREACHABLE:
   227     case Icmpv6Header::ICMPV6_ERROR_DESTINATION_UNREACHABLE:
   228       HandleDestinationUnreachable (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
   228       HandleDestinationUnreachable (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
   229       break;
   229       break;
   230     case Icmpv6Header::ICMPV6_ERROR_PACKET_TOO_BIG:
   230     case Icmpv6Header::ICMPV6_ERROR_PACKET_TOO_BIG:
   250 {
   250 {
   251   NS_LOG_FUNCTION (this << source << icmp << info << ipHeader << payload);
   251   NS_LOG_FUNCTION (this << source << icmp << info << ipHeader << payload);
   252 
   252 
   253   Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
   253   Ptr<Ipv6L3Protocol> ipv6 = m_node->GetObject<Ipv6L3Protocol> ();
   254 
   254 
   255   // TODO assuming the ICMP is carrying a extensionless IP packet
   255   /// \todo assuming the ICMP is carrying a extensionless IP packet
   256 
   256 
   257   uint8_t nextHeader = ipHeader.GetNextHeader ();
   257   uint8_t nextHeader = ipHeader.GetNextHeader ();
   258 
   258 
   259   Ptr<IpL4Protocol> l4 = ipv6->GetProtocol (nextHeader);
   259   Ptr<IpL4Protocol> l4 = ipv6->GetProtocol (nextHeader);
   260   if (l4 != 0)
   260   if (l4 != 0)
  1372        */
  1372        */
  1373       Ptr<Ipv6> ipv6 = icmpv6->m_node->GetObject<Ipv6> ();
  1373       Ptr<Ipv6> ipv6 = icmpv6->m_node->GetObject<Ipv6> ();
  1374 
  1374 
  1375       if (!ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())) && addr.IsLinkLocal ())
  1375       if (!ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())) && addr.IsLinkLocal ())
  1376         {
  1376         {
  1377           /* XXX because all nodes start at the same time, there will be many of RS arround 1 second of simulation time
  1377           /* \todo Add random delays before sending RS
  1378            * TODO Add random delays before sending RS
  1378            * because all nodes start at the same time, there will be many of RS arround 1 second of simulation time
  1379            */
  1379            */
  1380           Simulator::Schedule (Seconds (0.0), &Icmpv6L4Protocol::SendRS, PeekPointer (icmpv6), ifaddr.GetAddress (), Ipv6Address::GetAllRoutersMulticast (), interface->GetDevice ()->GetAddress ());
  1380           Simulator::Schedule (Seconds (0.0), &Icmpv6L4Protocol::SendRS, PeekPointer (icmpv6), ifaddr.GetAddress (), Ipv6Address::GetAllRoutersMulticast (), interface->GetDevice ()->GetAddress ());
  1381         }
  1381         }
  1382     }
  1382     }
  1383 }
  1383 }