A Discrete-Event Network Simulator
API
icmpv6-l4-protocol.cc
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) 2007-2009 Strasbourg University
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
19  * David Gross <gdavid.devel@gmail.com>
20  * Mehdi Benamor <benamor.mehdi@ensi.rnu.tn>
21  * Tommaso Pecorella <tommaso.pecorella@unifi.it>
22  */
23 
24 #include "ns3/log.h"
25 #include "ns3/assert.h"
26 #include "ns3/packet.h"
27 #include "ns3/node.h"
28 #include "ns3/boolean.h"
29 #include "ns3/ipv6-routing-protocol.h"
30 #include "ns3/ipv6-route.h"
31 #include "ns3/pointer.h"
32 #include "ns3/string.h"
33 
35 #include "ipv6-l3-protocol.h"
36 #include "ipv6-interface.h"
37 #include "icmpv6-l4-protocol.h"
38 #include "ndisc-cache.h"
39 
40 namespace ns3 {
41 
42 NS_LOG_COMPONENT_DEFINE ("Icmpv6L4Protocol");
43 
44 NS_OBJECT_ENSURE_REGISTERED (Icmpv6L4Protocol);
45 
46 const uint8_t Icmpv6L4Protocol::PROT_NUMBER = 58;
47 
52 const uint32_t Icmpv6L4Protocol::MAX_RA_DELAY_TIME = 500; /* millisecond */
53 
57 
62 const uint32_t Icmpv6L4Protocol::REACHABLE_TIME = 30000;
63 const uint32_t Icmpv6L4Protocol::RETRANS_TIMER = 1000;
65 const double Icmpv6L4Protocol::MIN_RANDOM_FACTOR = 0.5;
66 const double Icmpv6L4Protocol::MAX_RANDOM_FACTOR = 1.5;
67 
69 {
70  static TypeId tid = TypeId ("ns3::Icmpv6L4Protocol")
72  .AddConstructor<Icmpv6L4Protocol> ()
73  .AddAttribute ("DAD", "Always do DAD check.",
74  BooleanValue (true),
77  .AddAttribute ("SolicitationJitter", "The jitter in ms a node is allowed to wait before sending any solicitation . Some jitter aims to prevent collisions. By default, the model will wait for a duration in ms defined by a uniform random-variable between 0 and SolicitationJitter",
78  StringValue ("ns3::UniformRandomVariable[Min=0.0|Max=10.0]"),
80  MakePointerChecker<RandomVariableStream> ())
81 
82  ;
83  return tid;
84 }
85 
87  : m_node (0)
88 {
89  NS_LOG_FUNCTION (this);
90 }
91 
93 {
94  NS_LOG_FUNCTION (this);
95 }
96 
98 {
99  NS_LOG_FUNCTION (this);
100  for (CacheList::const_iterator it = m_cacheList.begin (); it != m_cacheList.end (); it++)
101  {
102  Ptr<NdiscCache> cache = *it;
103  cache->Dispose ();
104  cache = 0;
105  }
106  m_cacheList.clear ();
108 
109  m_node = 0;
111 }
112 
113 int64_t Icmpv6L4Protocol::AssignStreams (int64_t stream)
114 {
115  NS_LOG_FUNCTION (this << stream);
117  return 1;
118 }
119 
121 {
122  NS_LOG_FUNCTION (this);
123  if (m_node == 0)
124  {
125  Ptr<Node> node = this->GetObject<Node> ();
126  if (node != 0)
127  {
128  Ptr<Ipv6L3Protocol> ipv6 = this->GetObject<Ipv6L3Protocol> ();
129  if (ipv6 != 0 && m_downTarget.IsNull ())
130  {
131  SetNode (node);
132  ipv6->Insert (this);
133  Ptr<Ipv6RawSocketFactoryImpl> rawFactory = CreateObject<Ipv6RawSocketFactoryImpl> ();
134  ipv6->AggregateObject (rawFactory);
136  }
137  }
138  }
140 }
141 
143 {
144  NS_LOG_FUNCTION (this << node);
145  m_node = node;
146 }
147 
149 {
151  return PROT_NUMBER;
152 }
153 
155 {
156  NS_LOG_FUNCTION (this);
157  return PROT_NUMBER;
158 }
159 
161 {
162  NS_LOG_FUNCTION (this);
163  return 1;
164 }
165 
167 {
168  NS_LOG_FUNCTION (this);
169  return m_alwaysDad;
170 }
171 
173 {
174  NS_LOG_FUNCTION (this << target << interface);
175  Ipv6Address addr;
177 
178  NS_ASSERT (ipv6);
179 
180  if (!m_alwaysDad)
181  {
182  return;
183  }
184 
187  Ptr<Packet> p = ForgeNS ("::",Ipv6Address::MakeSolicitedAddress (target), target, interface->GetDevice ()->GetAddress ());
188 
189  /* update last packet UID */
190  interface->SetNsDadUid (target, p->GetUid ());
192 }
193 
195 {
196  NS_LOG_FUNCTION (this << packet << header);
198 }
199 
201 {
202  NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << header.GetDestinationAddress () << interface);
203  Ptr<Packet> p = packet->Copy ();
204  Ptr<Ipv6> ipv6 = m_node->GetObject<Ipv6> ();
205 
206  /* very ugly! try to find something better in the future */
207  uint8_t type;
208  p->CopyData (&type, sizeof(type));
209 
210  switch (type)
211  {
213  if (ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())))
214  {
215  HandleRS (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
216  }
217  break;
219  if (!ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())))
220  {
221  HandleRA (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
222  }
223  break;
225  HandleNS (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
226  break;
228  HandleNA (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
229  break;
231  HandleRedirection (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
232  break;
234  HandleEchoRequest (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
235  break;
237  // EchoReply does not contain any info about L4
238  // so we can not forward it up.
240  break;
242  HandleDestinationUnreachable (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
243  break;
245  HandlePacketTooBig (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
246  break;
248  HandleTimeExceeded (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
249  break;
251  HandleParameterError (p, header.GetSourceAddress (), header.GetDestinationAddress (), interface);
252  break;
253  default:
254  NS_LOG_LOGIC ("Unknown ICMPv6 message type=" << type);
255  break;
256  }
257 
258  return IpL4Protocol::RX_OK;
259 }
260 
262  uint32_t info, Ipv6Header ipHeader,
263  const uint8_t payload[8])
264 {
265  NS_LOG_FUNCTION (this << source << icmp << info << ipHeader << payload);
266 
268 
270 
271  uint8_t nextHeader = ipHeader.GetNextHeader ();
272 
273  if (nextHeader != Icmpv6L4Protocol::PROT_NUMBER)
274  {
275  Ptr<IpL4Protocol> l4 = ipv6->GetProtocol (nextHeader);
276  if (l4 != 0)
277  {
278  l4->ReceiveIcmp (source, ipHeader.GetHopLimit (), icmp.GetType (), icmp.GetCode (),
279  info, ipHeader.GetSourceAddress (), ipHeader.GetDestinationAddress (), payload);
280  }
281  }
282 }
283 
285 {
286  NS_LOG_FUNCTION (this << packet << src << dst << interface);
287  Icmpv6Echo request;
288  uint8_t* buf = new uint8_t[packet->GetSize ()];
289 
290  packet->RemoveHeader (request);
291  /* XXX IPv6 extension: obtain a fresh copy of data otherwise it crash... */
292  packet->CopyData (buf, packet->GetSize ());
293  Ptr<Packet> p = Create<Packet> (buf, packet->GetSize ());
294 
295  /* if we send message from ff02::* (link-local multicast), we use our link-local address */
296  SendEchoReply (dst.IsMulticast () ? interface->GetLinkLocalAddress ().GetAddress () : dst, src, request.GetId (), request.GetSeq (), p);
297  delete[] buf;
298 }
299 
300 void Icmpv6L4Protocol::HandleRA (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
301 {
302  NS_LOG_FUNCTION (this << packet << src << dst << interface);
303  Ptr<Packet> p = packet->Copy ();
304  Icmpv6RA raHeader;
307  Icmpv6OptionMtu mtuHdr;
309  bool next = true;
310  bool hasLla = false;
311  bool hasMtu = false;
312  Ipv6Address defaultRouter = Ipv6Address::GetZero ();
313 
314  p->RemoveHeader (raHeader);
315 
316  if (raHeader.GetLifeTime())
317  {
318  defaultRouter = src;
319  }
320 
321  while (next == true)
322  {
323  uint8_t type = 0;
324  p->CopyData (&type, sizeof(type));
325 
326  switch (type)
327  {
329  p->RemoveHeader (prefixHdr);
330  ipv6->AddAutoconfiguredAddress (ipv6->GetInterfaceForDevice (interface->GetDevice ()), prefixHdr.GetPrefix (), prefixHdr.GetPrefixLength (),
331  prefixHdr.GetFlags (), prefixHdr.GetValidTime (), prefixHdr.GetPreferredTime (), defaultRouter);
332  break;
334  /* take in account the first MTU option */
335  if (!hasMtu)
336  {
337  p->RemoveHeader (mtuHdr);
338  hasMtu = true;
340  /* interface->GetDevice ()->SetMtu (m.GetMtu ()); */
341  }
342  break;
344  /* take in account the first LLA option */
345  if (!hasLla)
346  {
347  p->RemoveHeader (llaHdr);
348  ReceiveLLA (llaHdr, src, dst, interface);
349  hasLla = true;
350  }
351  break;
352  default:
353  /* unknow option, quit */
354  next = false;
355  }
356  }
357 }
358 
360 {
361  NS_LOG_FUNCTION (this << lla << src << dst << interface);
362  Address hardwareAddress;
363  NdiscCache::Entry* entry = 0;
364  Ptr<NdiscCache> cache = FindCache (interface->GetDevice ());
365 
366  /* check if we have this address in our cache */
367  entry = cache->Lookup (src);
368 
369  if (!entry)
370  {
371  entry = cache->Add (src);
372  entry->SetRouter (true);
373  entry->SetMacAddress (lla.GetAddress ());
374  entry->MarkReachable ();
375  entry->StartReachableTimer ();
376  }
377  else
378  {
379  std::list<Ptr<Packet> > waiting;
380  if (entry->IsIncomplete ())
381  {
382  entry->StopRetransmitTimer ();
383  // mark it to reachable
384  waiting = entry->MarkReachable (lla.GetAddress ());
385  entry->StopReachableTimer ();
386  entry->StartReachableTimer ();
387  // send out waiting packet
388  for (std::list<Ptr<Packet> >::const_iterator it = waiting.begin (); it != waiting.end (); it++)
389  {
390  cache->GetInterface ()->Send (*it, src);
391  }
392  entry->ClearWaitingPacket ();
393  }
394  else
395  {
396  if (entry->GetMacAddress () != lla.GetAddress ())
397  {
398  entry->SetMacAddress (lla.GetAddress ());
399  entry->MarkStale ();
400  entry->SetRouter (true);
401  }
402  else
403  {
404  if (!entry->IsReachable ())
405  {
406  entry->StopProbeTimer ();
407  entry->StopDelayTimer ();
408  waiting = entry->MarkReachable (lla.GetAddress ());
409  if (entry->IsProbe ())
410  {
411  for (std::list<Ptr<Packet> >::const_iterator it = waiting.begin (); it != waiting.end (); it++)
412  {
413  cache->GetInterface ()->Send (*it, src);
414  }
415  }
416  entry->StopReachableTimer ();
417  entry->StartReachableTimer ();
418  }
419  }
420  }
421  }
422 }
423 
424 void Icmpv6L4Protocol::HandleRS (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
425 {
426  NS_LOG_FUNCTION (this << packet << src << dst << interface);
428  Icmpv6RS rsHeader;
429  packet->RemoveHeader (rsHeader);
430  Address hardwareAddress;
432  NdiscCache::Entry* entry = 0;
433  Ptr<NdiscCache> cache = FindCache (interface->GetDevice ());
434 
435  if (src != Ipv6Address::GetAny ())
436  {
437  /* XXX search all options following the RS header */
438  /* test if the next option is SourceLinkLayerAddress */
439  uint8_t type;
440  packet->CopyData (&type, sizeof(type));
441 
443  {
444  return;
445  }
446  packet->RemoveHeader (lla);
447  NS_LOG_LOGIC ("Cache updated by RS");
448 
449  entry = cache->Lookup (src);
450  if (!entry)
451  {
452  entry = cache->Add (src);
453  entry->SetRouter (false);
454  entry->MarkStale (lla.GetAddress ());
455  }
456  else if (entry->GetMacAddress () != lla.GetAddress ())
457  {
458  entry->MarkStale (lla.GetAddress ());
459  }
460  }
461 }
462 
463 void Icmpv6L4Protocol::HandleNS (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
464 {
465  NS_LOG_FUNCTION (this << packet << src << dst << interface);
466  Icmpv6NS nsHeader ("::");
467  Ipv6InterfaceAddress ifaddr;
468  uint32_t nb = interface->GetNAddresses ();
469  uint32_t i = 0;
470  bool found = false;
471 
472  packet->RemoveHeader (nsHeader);
473 
474  Ipv6Address target = nsHeader.GetIpv6Target ();
475 
476  for (i = 0; i < nb; i++)
477  {
478  ifaddr = interface->GetAddress (i);
479 
480  if (ifaddr.GetAddress () == target)
481  {
482  found = true;
483  break;
484  }
485  }
486 
487  if (!found)
488  {
489  NS_LOG_LOGIC ("Not a NS for us");
490  return;
491  }
492 
493  if (packet->GetUid () == ifaddr.GetNsDadUid ())
494  {
495  /* don't process our own DAD probe */
496  NS_LOG_LOGIC ("Hey we receive our DAD probe!");
497  return;
498  }
499 
501  Address hardwareAddress;
502  NdiscCache::Entry* entry = 0;
503  Ptr<NdiscCache> cache = FindCache (interface->GetDevice ());
504  uint8_t flags = 0;
505 
506  /* XXX search all options following the NS header */
507 
508  if (src != Ipv6Address::GetAny ())
509  {
510  uint8_t type;
511  packet->CopyData (&type, sizeof(type));
512 
514  {
515  return;
516  }
517 
518  /* Get LLA */
519  packet->RemoveHeader (lla);
520 
521  entry = cache->Lookup (src);
522  if (!entry)
523  {
524  entry = cache->Add (src);
525  entry->SetRouter (false);
526  entry->MarkStale (lla.GetAddress ());
527  }
528  else if (entry->GetMacAddress () != lla.GetAddress ())
529  {
530  entry->MarkStale (lla.GetAddress ());
531  }
532 
533  flags = 3; /* S + O flags */
534  }
535  else
536  {
537  /* it means someone do a DAD */
538  flags = 1; /* O flag */
539  }
540 
541  /* send a NA to src */
543 
544  if (ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())))
545  {
546  flags += 4; /* R flag */
547  }
548 
549  hardwareAddress = interface->GetDevice ()->GetAddress ();
550  Ptr<Packet> p = ForgeNA (target.IsLinkLocal () ? interface->GetLinkLocalAddress ().GetAddress () : ifaddr.GetAddress (), src.IsAny () ? Ipv6Address::GetAllNodesMulticast () : src, &hardwareAddress, flags );
551  interface->Send (p, src.IsAny () ? Ipv6Address::GetAllNodesMulticast () : src);
552 
553  /* not a NS for us discard it */
554 }
555 
557 {
558  NS_LOG_FUNCTION (this << src << dst << hardwareAddress);
559  Ptr<Packet> p = Create<Packet> ();
560  Ipv6Header ipHeader;
561  Icmpv6RS rs;
562  Icmpv6OptionLinkLayerAddress llOption (1, hardwareAddress); /* we give our mac address in response */
563 
564  NS_LOG_LOGIC ("Send RS ( from " << src << " to " << dst << ")");
565  p->AddHeader (llOption);
566 
568  p->AddHeader (rs);
569 
570  ipHeader.SetSourceAddress (src);
571  ipHeader.SetDestinationAddress (dst);
572  ipHeader.SetNextHeader (PROT_NUMBER);
573  ipHeader.SetPayloadLength (p->GetSize ());
574  ipHeader.SetHopLimit (255);
575 
576  p->AddHeader (ipHeader);
577 
578  return p;
579 }
580 
582 {
583  NS_LOG_FUNCTION (this << src << dst << id << seq << data);
584  Ptr<Packet> p = data->Copy ();
585  Ipv6Header ipHeader;
586  Icmpv6Echo req (1);
587 
588  req.SetId (id);
589  req.SetSeq (seq);
590 
591  req.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + req.GetSerializedSize (), PROT_NUMBER);
592  p->AddHeader (req);
593 
594  ipHeader.SetSourceAddress (src);
595  ipHeader.SetDestinationAddress (dst);
596  ipHeader.SetNextHeader (PROT_NUMBER);
597  ipHeader.SetPayloadLength (p->GetSize ());
598  ipHeader.SetHopLimit (255);
599 
600  p->AddHeader (ipHeader);
601 
602  return p;
603 }
604 
605 void Icmpv6L4Protocol::HandleNA (Ptr<Packet> packet, Ipv6Address const &src, Ipv6Address const &dst, Ptr<Ipv6Interface> interface)
606 {
607  NS_LOG_FUNCTION (this << packet << src << dst << interface);
608  Icmpv6NA naHeader;
610 
611  packet->RemoveHeader (naHeader);
612  Ipv6Address target = naHeader.GetIpv6Target ();
613 
614  Address hardwareAddress;
615  NdiscCache::Entry* entry = 0;
616  Ptr<NdiscCache> cache = FindCache (interface->GetDevice ());
617  std::list<Ptr<Packet> > waiting;
618 
619  /* check if we have something in our cache */
620  entry = cache->Lookup (target);
621 
622  if (!entry)
623  {
624  /* ouch!! we might be victim of a DAD */
625 
626  Ipv6InterfaceAddress ifaddr;
627  bool found = false;
628  uint32_t i = 0;
629  uint32_t nb = interface->GetNAddresses ();
630 
631  for (i = 0; i < nb; i++)
632  {
633  ifaddr = interface->GetAddress (i);
634  if (ifaddr.GetAddress () == target)
635  {
636  found = true;
637  break;
638  }
639  }
640 
641  if (found)
642  {
644  {
645  interface->SetState (ifaddr.GetAddress (), Ipv6InterfaceAddress::INVALID);
646  }
647  }
648 
649  /* we have not initiated any communication with the target so... discard the NA */
650  return;
651  }
652 
653  /* XXX search all options following the NA header */
654  /* Get LLA */
655  uint8_t type;
656  packet->CopyData (&type, sizeof(type));
657 
659  {
660  return;
661  }
662  packet->RemoveHeader (lla);
663 
664  if (entry->IsIncomplete ())
665  {
666  /* we receive a NA so stop the retransmission timer */
667  entry->StopRetransmitTimer ();
668 
669  if (naHeader.GetFlagS ())
670  {
671  /* mark it to reachable */
672  waiting = entry->MarkReachable (lla.GetAddress ());
673  entry->StopReachableTimer ();
674  entry->StartReachableTimer ();
675  /* send out waiting packet */
676  for (std::list<Ptr<Packet> >::const_iterator it = waiting.begin (); it != waiting.end (); it++)
677  {
678  cache->GetInterface ()->Send (*it, src);
679  }
680  entry->ClearWaitingPacket ();
681  }
682  else
683  {
684  entry->MarkStale (lla.GetAddress ());
685  }
686 
687  if (naHeader.GetFlagR ())
688  {
689  entry->SetRouter (true);
690  }
691  }
692  else
693  {
694  /* we receive a NA so stop the probe timer or delay timer if any */
695  entry->StopProbeTimer ();
696  entry->StopDelayTimer ();
697 
698  /* if the Flag O is clear and mac address differs from the cache */
699  if (!naHeader.GetFlagO () && lla.GetAddress () != entry->GetMacAddress ())
700  {
701  if (entry->IsReachable ())
702  {
703  entry->MarkStale ();
704  }
705  return;
706  }
707  else
708  {
709  if ((!naHeader.GetFlagO () && lla.GetAddress () == entry->GetMacAddress ()) || naHeader.GetFlagO ()) /* XXX lake "no target link-layer address option supplied" */
710  {
711  entry->SetMacAddress (lla.GetAddress ());
712 
713  if (naHeader.GetFlagS ())
714  {
715  if (!entry->IsReachable ())
716  {
717  if (entry->IsProbe ())
718  {
719  waiting = entry->MarkReachable (lla.GetAddress ());
720  for (std::list<Ptr<Packet> >::const_iterator it = waiting.begin (); it != waiting.end (); it++)
721  {
722  cache->GetInterface ()->Send (*it, src);
723  }
724  entry->ClearWaitingPacket ();
725  }
726  else
727  {
728  entry->MarkReachable (lla.GetAddress ());
729  }
730  }
731  entry->StopReachableTimer ();
732  entry->StartReachableTimer ();
733  }
734  else if (lla.GetAddress () != entry->GetMacAddress ())
735  {
736  entry->MarkStale ();
737  }
738  entry->SetRouter (naHeader.GetFlagR ());
739  }
740  }
741  }
742 }
743 
745 {
746  NS_LOG_FUNCTION (this << packet << src << dst << interface);
747  bool hasLla = false;
748  Ptr<Packet> p = packet->Copy ();
749  Icmpv6OptionLinkLayerAddress llOptionHeader (0);
750 
751  Icmpv6Redirection redirectionHeader;
752  p->RemoveHeader (redirectionHeader);
753 
754  /* little ugly try to find a better way */
755  uint8_t type;
756  p->CopyData (&type, sizeof(type));
758  {
759  hasLla = true;
760  p->RemoveHeader (llOptionHeader);
761  }
762 
763  Icmpv6OptionRedirected redirectedOptionHeader;
764  p->RemoveHeader (redirectedOptionHeader);
765 
766  Ipv6Address redirTarget = redirectionHeader.GetTarget ();
767  Ipv6Address redirDestination = redirectionHeader.GetDestination ();
768 
769  if (hasLla)
770  {
771  /* update the cache if needed */
772  NdiscCache::Entry* entry = 0;
773  Ptr<NdiscCache> cache = FindCache (interface->GetDevice ());
774 
775  entry = cache->Lookup (redirTarget);
776  if (!entry)
777  {
778  entry = cache->Add (redirTarget);
779  /* destination and target different => necessarily a router */
780  entry->SetRouter (!redirTarget.IsEqual (redirDestination) ? true : false);
781  entry->SetMacAddress (llOptionHeader.GetAddress ());
782  entry->MarkStale ();
783  }
784  else
785  {
786  if (entry->IsIncomplete () || entry->GetMacAddress () != llOptionHeader.GetAddress ())
787  {
788  /* update entry to STALE */
789  if (entry->GetMacAddress () != llOptionHeader.GetAddress ())
790  {
791  entry->SetMacAddress (llOptionHeader.GetAddress ());
792  entry->MarkStale ();
793  }
794  }
795  else
796  {
797  /* stay unchanged */
798  }
799  }
800  }
801 
802  /* add redirection in routing table */
803  Ptr<Ipv6> ipv6 = m_node->GetObject<Ipv6> ();
804 
805  if (redirTarget.IsEqual (redirDestination))
806  {
807  ipv6->GetRoutingProtocol ()->NotifyAddRoute (redirDestination, Ipv6Prefix (128), Ipv6Address ("::"), ipv6->GetInterfaceForAddress (dst));
808  }
809  else
810  {
811  uint32_t ifIndex = ipv6->GetInterfaceForAddress (dst);
812  ipv6->GetRoutingProtocol ()->NotifyAddRoute (redirDestination, Ipv6Prefix (128), redirTarget, ifIndex);
813  }
814 }
815 
817 {
818  NS_LOG_FUNCTION (this << *p << src << dst << interface);
819  Ptr<Packet> pkt = p->Copy ();
820 
822  pkt->RemoveHeader (unreach);
823  Ptr<Packet> origPkt = unreach.GetPacket ();
824 
825  Ipv6Header ipHeader;
826  if ( origPkt->GetSerializedSize () > ipHeader.GetSerializedSize () )
827  {
828  origPkt->RemoveHeader (ipHeader);
829  uint8_t payload[8];
830  origPkt->CopyData (payload, 8);
831  Forward (src, unreach, unreach.GetCode (), ipHeader, payload);
832  }
833 }
834 
836 {
837  NS_LOG_FUNCTION (this << *p << src << dst << interface);
838  Ptr<Packet> pkt = p->Copy ();
839 
840  Icmpv6TimeExceeded timeexceeded;
841  pkt->RemoveHeader (timeexceeded);
842  Ptr<Packet> origPkt = timeexceeded.GetPacket ();
843  Ipv6Header ipHeader;
844  uint8_t payload[8];
845  origPkt->RemoveHeader (ipHeader);
846  origPkt->CopyData (payload, 8);
847 
848  Forward (src, timeexceeded, timeexceeded.GetCode (), ipHeader, payload);
849 }
850 
852 {
853  NS_LOG_FUNCTION (this << *p << src << dst << interface);
854  Ptr<Packet> pkt = p->Copy ();
855 
856  Icmpv6TooBig tooBig;
857  pkt->RemoveHeader (tooBig);
858  Ptr<Packet> origPkt = tooBig.GetPacket ();
859 
860  Ipv6Header ipHeader;
861  origPkt->RemoveHeader (ipHeader);
862  uint8_t payload[8];
863  origPkt->CopyData (payload, 8);
864 
866  ipv6->SetPmtu(ipHeader.GetDestinationAddress(), tooBig.GetMtu ());
867 
868  Forward (src, tooBig, tooBig.GetMtu (), ipHeader, payload);
869 }
870 
872 {
873  NS_LOG_FUNCTION (this << *p << src << dst << interface);
874  Ptr<Packet> pkt = p->Copy ();
875 
876  Icmpv6ParameterError paramErr;
877  pkt->RemoveHeader (paramErr);
878  Ptr<Packet> origPkt = paramErr.GetPacket ();
879 
880  Ipv6Header ipHeader;
881  origPkt->RemoveHeader (ipHeader);
882  uint8_t payload[8];
883  origPkt->CopyData (payload, 8);
884  Forward (src, paramErr, paramErr.GetCode (), ipHeader, payload);
885 }
886 
888 {
889  NS_LOG_FUNCTION (this << packet << src << dst << (uint32_t)ttl);
891  SocketIpTtlTag tag;
892  NS_ASSERT (ipv6 != 0);
893 
894  tag.SetTtl (ttl);
895  packet->AddPacketTag (tag);
896  m_downTarget (packet, src, dst, PROT_NUMBER, 0);
897 }
898 
900 {
901  NS_LOG_FUNCTION (this << packet << src << dst << (uint32_t)ttl);
902  SendMessage (packet, src, dst, ttl);
903 }
904 
905 void Icmpv6L4Protocol::SendMessage (Ptr<Packet> packet, Ipv6Address dst, Icmpv6Header& icmpv6Hdr, uint8_t ttl)
906 {
907  NS_LOG_FUNCTION (this << packet << dst << icmpv6Hdr << (uint32_t)ttl);
909  NS_ASSERT (ipv6 != 0 && ipv6->GetRoutingProtocol () != 0);
910  Ipv6Header header;
911  SocketIpTtlTag tag;
913  Ptr<Ipv6Route> route;
914  Ptr<NetDevice> oif (0); //specify non-zero if bound to a source address
915 
916  header.SetDestinationAddress (dst);
917  route = ipv6->GetRoutingProtocol ()->RouteOutput (packet, header, oif, err);
918 
919  if (route != 0)
920  {
921  NS_LOG_LOGIC ("Route exists");
922  tag.SetTtl (ttl);
923  packet->AddPacketTag (tag);
924  Ipv6Address src = route->GetSource ();
925 
926  icmpv6Hdr.CalculatePseudoHeaderChecksum (src, dst, packet->GetSize () + icmpv6Hdr.GetSerializedSize (), PROT_NUMBER);
927  packet->AddHeader (icmpv6Hdr);
928  m_downTarget (packet, src, dst, PROT_NUMBER, route);
929  }
930  else
931  {
932  NS_LOG_WARN ("drop icmp message");
933  }
934 }
935 
936 void Icmpv6L4Protocol::SendNA (Ipv6Address src, Ipv6Address dst, Address* hardwareAddress, uint8_t flags)
937 {
938  NS_LOG_FUNCTION (this << src << dst << hardwareAddress << static_cast<uint32_t> (flags));
939  Ptr<Packet> p = Create<Packet> ();
940  Icmpv6NA na;
941  Icmpv6OptionLinkLayerAddress llOption (0, *hardwareAddress); /* not a source link layer */
942 
943  NS_LOG_LOGIC ("Send NA ( from " << src << " to " << dst << " target " << src << ")");
944  na.SetIpv6Target (src);
945 
946  if ((flags & 1))
947  {
948  na.SetFlagO (true);
949  }
950  if ((flags & 2) && src != Ipv6Address::GetAny ())
951  {
952  na.SetFlagS (true);
953  }
954  if ((flags & 4))
955  {
956  na.SetFlagR (true);
957  }
958 
959  p->AddHeader (llOption);
960  na.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + na.GetSerializedSize (), PROT_NUMBER);
961  p->AddHeader (na);
962 
963  SendMessage (p, src, dst, 255);
964 }
965 
966 void Icmpv6L4Protocol::SendEchoReply (Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr<Packet> data)
967 {
968  NS_LOG_FUNCTION (this << src << dst << id << seq << data);
969  Ptr<Packet> p = data->Copy ();
970  Icmpv6Echo reply (0); /* echo reply */
971 
972  reply.SetId (id);
973  reply.SetSeq (seq);
974 
975  reply.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + reply.GetSerializedSize (), PROT_NUMBER);
976  p->AddHeader (reply);
977  SendMessage (p, src, dst, 64);
978 }
979 
980 void Icmpv6L4Protocol::SendNS (Ipv6Address src, Ipv6Address dst, Ipv6Address target, Address hardwareAddress)
981 {
982  NS_LOG_FUNCTION (this << src << dst << target << hardwareAddress);
983  Ptr<Packet> p = Create<Packet> ();
984  /* Ipv6Header ipHeader; */
985  Icmpv6NS ns (target);
986  Icmpv6OptionLinkLayerAddress llOption (1, hardwareAddress); /* we give our mac address in response */
987 
988  /* if the source is unspec, multicast the NA to all-nodes multicast */
989  if (src == Ipv6Address::GetAny ())
990  {
992  }
993 
994  NS_LOG_LOGIC ("Send NS ( from " << src << " to " << dst << " target " << target << ")");
995 
996  p->AddHeader (llOption);
997  ns.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + ns.GetSerializedSize (), PROT_NUMBER);
998  p->AddHeader (ns);
999  if (!dst.IsMulticast ())
1000  {
1001  SendMessage (p, src, dst, 255);
1002  }
1003  else
1004  {
1005  NS_LOG_LOGIC ("Destination is Multicast, using DelayedSendMessage");
1007  }
1008 }
1009 
1011 {
1012  NS_LOG_FUNCTION (this << src << dst << hardwareAddress);
1013  Ptr<Packet> p = Create<Packet> ();
1014  Icmpv6RS rs;
1015  Icmpv6OptionLinkLayerAddress llOption (1, hardwareAddress); /* we give our mac address in response */
1016 
1017  /* if the source is unspec, multicast the NA to all-nodes multicast */
1018  if (src != Ipv6Address::GetAny ())
1019  {
1020  p->AddHeader (llOption);
1021  }
1022 
1023  NS_LOG_LOGIC ("Send RS ( from " << src << " to " << dst << ")");
1024 
1025  rs.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + rs.GetSerializedSize (), PROT_NUMBER);
1026  p->AddHeader (rs);
1027  if (!dst.IsMulticast ())
1028  {
1029  SendMessage (p, src, dst, 255);
1030  }
1031  else
1032  {
1033  NS_LOG_LOGIC ("Destination is Multicast, using DelayedSendMessage");
1035  }
1036 }
1037 
1039 {
1040  NS_LOG_FUNCTION (this << malformedPacket << dst << (uint32_t)code);
1041  Ptr<Packet> p = Create<Packet> ();
1042  uint32_t malformedPacketSize = malformedPacket->GetSize ();
1044 
1045  NS_LOG_LOGIC ("Send Destination Unreachable ( to " << dst << " code " << (uint32_t)code << " )");
1046 
1047  /* 48 = sizeof IPv6 header + sizeof ICMPv6 error header */
1048  if (malformedPacketSize <= 1280 - 48)
1049  {
1050  header.SetPacket (malformedPacket);
1051  }
1052  else
1053  {
1054  Ptr<Packet> fragment = malformedPacket->CreateFragment (0, 1280 - 48);
1055  header.SetPacket (fragment);
1056  }
1057 
1058  header.SetCode (code);
1059  SendMessage (p, dst, header, 255);
1060 }
1061 
1062 void Icmpv6L4Protocol::SendErrorTooBig (Ptr<Packet> malformedPacket, Ipv6Address dst, uint32_t mtu)
1063 {
1064  NS_LOG_FUNCTION (this << malformedPacket << dst << mtu);
1065  Ptr<Packet> p = Create<Packet> ();
1066  uint32_t malformedPacketSize = malformedPacket->GetSize ();
1067  Icmpv6TooBig header;
1068 
1069  NS_LOG_LOGIC ("Send Too Big ( to " << dst << " )");
1070 
1071  /* 48 = sizeof IPv6 header + sizeof ICMPv6 error header */
1072  if (malformedPacketSize <= 1280 - 48)
1073  {
1074  header.SetPacket (malformedPacket);
1075  }
1076  else
1077  {
1078  Ptr<Packet> fragment = malformedPacket->CreateFragment (0, 1280 - 48);
1079  header.SetPacket (fragment);
1080  }
1081 
1082  header.SetCode (0);
1083  header.SetMtu (mtu);
1084  SendMessage (p, dst, header, 255);
1085 }
1086 
1087 void Icmpv6L4Protocol::SendErrorTimeExceeded (Ptr<Packet> malformedPacket, Ipv6Address dst, uint8_t code)
1088 {
1089  NS_LOG_FUNCTION (this << malformedPacket << dst << static_cast<uint32_t> (code));
1090  Ptr<Packet> p = Create<Packet> ();
1091  uint32_t malformedPacketSize = malformedPacket->GetSize ();
1092  Icmpv6TimeExceeded header;
1093 
1094  NS_LOG_LOGIC ("Send Time Exceeded ( to " << dst << " code " << (uint32_t)code << " )");
1095 
1096  /* 48 = sizeof IPv6 header + sizeof ICMPv6 error header */
1097  if (malformedPacketSize <= 1280 - 48)
1098  {
1099  header.SetPacket (malformedPacket);
1100  }
1101  else
1102  {
1103  Ptr<Packet> fragment = malformedPacket->CreateFragment (0, 1280 - 48);
1104  header.SetPacket (fragment);
1105  }
1106 
1107  header.SetCode (code);
1108  SendMessage (p, dst, header, 255);
1109 }
1110 
1111 void Icmpv6L4Protocol::SendErrorParameterError (Ptr<Packet> malformedPacket, Ipv6Address dst, uint8_t code, uint32_t ptr)
1112 {
1113  NS_LOG_FUNCTION (this << malformedPacket << dst << static_cast<uint32_t> (code) << ptr);
1114  Ptr<Packet> p = Create<Packet> ();
1115  uint32_t malformedPacketSize = malformedPacket->GetSize ();
1116  Icmpv6ParameterError header;
1117 
1118  NS_LOG_LOGIC ("Send Parameter Error ( to " << dst << " code " << (uint32_t)code << " )");
1119 
1120  /* 48 = sizeof IPv6 header + sizeof ICMPv6 error header */
1121  if (malformedPacketSize <= 1280 - 48 )
1122  {
1123  header.SetPacket (malformedPacket);
1124  }
1125  else
1126  {
1127  Ptr<Packet> fragment = malformedPacket->CreateFragment (0, 1280 - 48);
1128  header.SetPacket (fragment);
1129  }
1130 
1131  header.SetCode (code);
1132  header.SetPtr (ptr);
1133  SendMessage (p, dst, header, 255);
1134 }
1135 
1136 void Icmpv6L4Protocol::SendRedirection (Ptr<Packet> redirectedPacket, Ipv6Address src, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget)
1137 {
1138  NS_LOG_FUNCTION (this << redirectedPacket << dst << redirTarget << redirDestination << redirHardwareTarget);
1139  uint32_t llaSize = 0;
1140  Ptr<Packet> p = Create<Packet> ();
1141  uint32_t redirectedPacketSize = redirectedPacket->GetSize ();
1142  Icmpv6OptionLinkLayerAddress llOption (0);
1143 
1144  NS_LOG_LOGIC ("Send Redirection ( to " << dst << " target " << redirTarget << " destination " << redirDestination << " )");
1145 
1146  Icmpv6OptionRedirected redirectedOptionHeader;
1147 
1148  if ((redirectedPacketSize % 8) != 0)
1149  {
1150  Ptr<Packet> pad = Create<Packet> (8 - (redirectedPacketSize % 8));
1151  redirectedPacket->AddAtEnd (pad);
1152  }
1153 
1154  if (redirHardwareTarget.GetLength ())
1155  {
1156  llOption.SetAddress (redirHardwareTarget);
1157  llaSize = llOption.GetSerializedSize ();
1158  }
1159 
1160  /* 56 = sizeof IPv6 header + sizeof ICMPv6 error header + sizeof redirected option */
1161  if (redirectedPacketSize <= (1280 - 56 - llaSize))
1162  {
1163  redirectedOptionHeader.SetPacket (redirectedPacket);
1164  }
1165  else
1166  {
1167  Ptr<Packet> fragment = redirectedPacket->CreateFragment (0, 1280 - 56 - llaSize);
1168  redirectedOptionHeader.SetPacket (fragment);
1169  }
1170 
1171  p->AddHeader (redirectedOptionHeader);
1172 
1173  if (llaSize)
1174  {
1175  p->AddHeader (llOption);
1176  }
1177 
1178  Icmpv6Redirection redirectionHeader;
1179  redirectionHeader.SetTarget (redirTarget);
1180  redirectionHeader.SetDestination (redirDestination);
1181  redirectionHeader.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + redirectionHeader.GetSerializedSize (), PROT_NUMBER);
1182  p->AddHeader (redirectionHeader);
1183 
1184  SendMessage (p, src, dst, 64);
1185 }
1186 
1187 Ptr<Packet> Icmpv6L4Protocol::ForgeNA (Ipv6Address src, Ipv6Address dst, Address* hardwareAddress, uint8_t flags)
1188 {
1189  NS_LOG_FUNCTION (this << src << dst << hardwareAddress << (uint32_t)flags);
1190  Ptr<Packet> p = Create<Packet> ();
1191  Ipv6Header ipHeader;
1192  Icmpv6NA na;
1193  Icmpv6OptionLinkLayerAddress llOption (0, *hardwareAddress); /* we give our mac address in response */
1194 
1195  NS_LOG_LOGIC ("Send NA ( from " << src << " to " << dst << ")");
1196 
1197  /* forge the entire NA packet from IPv6 header to ICMPv6 link-layer option, so that the packet does not pass by Icmpv6L4Protocol::Lookup again */
1198 
1199  p->AddHeader (llOption);
1200  na.SetIpv6Target (src);
1201 
1202  if ((flags & 1))
1203  {
1204  na.SetFlagO (true);
1205  }
1206  if ((flags & 2) && src != Ipv6Address::GetAny ())
1207  {
1208  na.SetFlagS (true);
1209  }
1210  if ((flags & 4))
1211  {
1212  na.SetFlagR (true);
1213  }
1214 
1216  p->AddHeader (na);
1217 
1218  ipHeader.SetSourceAddress (src);
1219  ipHeader.SetDestinationAddress (dst);
1220  ipHeader.SetNextHeader (PROT_NUMBER);
1221  ipHeader.SetPayloadLength (p->GetSize ());
1222  ipHeader.SetHopLimit (255);
1223 
1224  p->AddHeader (ipHeader);
1225 
1226  return p;
1227 }
1228 
1230 {
1231  NS_LOG_FUNCTION (this << src << dst << target << hardwareAddress);
1232  Ptr<Packet> p = Create<Packet> ();
1233  Ipv6Header ipHeader;
1234  Icmpv6NS ns (target);
1235  Icmpv6OptionLinkLayerAddress llOption (1, hardwareAddress); /* we give our mac address in response */
1236 
1237  /* if the source is unspec, multicast the NA to all-nodes multicast */
1238  if (src == Ipv6Address::GetAny ())
1239  {
1241  }
1242 
1243  NS_LOG_LOGIC ("Send NS ( from " << src << " to " << dst << " target " << target << ")");
1244 
1245  p->AddHeader (llOption);
1247  p->AddHeader (ns);
1248 
1249  ipHeader.SetSourceAddress (src);
1250  ipHeader.SetDestinationAddress (dst);
1251  ipHeader.SetNextHeader (PROT_NUMBER);
1252  ipHeader.SetPayloadLength (p->GetSize ());
1253  ipHeader.SetHopLimit (255);
1254 
1255  p->AddHeader (ipHeader);
1256 
1257  return p;
1258 }
1259 
1261 {
1262  NS_LOG_FUNCTION (this << device);
1263 
1264  for (CacheList::const_iterator i = m_cacheList.begin (); i != m_cacheList.end (); i++)
1265  {
1266  if ((*i)->GetDevice () == device)
1267  {
1268  return *i;
1269  }
1270  }
1271 
1272  NS_ASSERT (false);
1273  /* quiet compiler */
1274  return 0;
1275 }
1276 
1278 {
1279  NS_LOG_FUNCTION (this << device << interface);
1280 
1281  Ptr<NdiscCache> cache = CreateObject<NdiscCache> ();
1282 
1283  cache->SetDevice (device, interface);
1284  device->AddLinkChangeCallback (MakeCallback (&NdiscCache::Flush, cache));
1285  m_cacheList.push_back (cache);
1286  return cache;
1287 }
1288 
1289 bool Icmpv6L4Protocol::Lookup (Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination)
1290 {
1291  NS_LOG_FUNCTION (this << dst << device << cache << hardwareDestination);
1292 
1293  if (!cache)
1294  {
1295  /* try to find the cache */
1296  cache = FindCache (device);
1297  }
1298  if (cache)
1299  {
1300  NdiscCache::Entry* entry = cache->Lookup (dst);
1301  if (entry)
1302  {
1303  if (entry->IsReachable () || entry->IsDelay ())
1304  {
1305  *hardwareDestination = entry->GetMacAddress ();
1306  return true;
1307  }
1308  else if (entry->IsStale ())
1309  {
1310  entry->StartDelayTimer ();
1311  entry->MarkDelay ();
1312  *hardwareDestination = entry->GetMacAddress ();
1313  return true;
1314  }
1315  }
1316  }
1317  return false;
1318 }
1319 
1320 bool Icmpv6L4Protocol::Lookup (Ptr<Packet> p, Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination)
1321 {
1322  NS_LOG_FUNCTION (this << p << dst << device << cache << hardwareDestination);
1323 
1324  if (!cache)
1325  {
1326  /* try to find the cache */
1327  cache = FindCache (device);
1328  }
1329  if (!cache)
1330  {
1331  return false;
1332  }
1333 
1334  NdiscCache::Entry* entry = cache->Lookup (dst);
1335  if (entry)
1336  {
1337  if (entry->IsReachable () || entry->IsDelay ())
1338  {
1339  /* XXX check reachability time */
1340  /* send packet */
1341  *hardwareDestination = entry->GetMacAddress ();
1342  return true;
1343  }
1344  else if (entry->IsStale ())
1345  {
1346  /* start delay timer */
1347  entry->StartDelayTimer ();
1348  entry->MarkDelay ();
1349  *hardwareDestination = entry->GetMacAddress ();
1350  return true;
1351  }
1352  else /* INCOMPLETE or PROBE */
1353  {
1354  /* queue packet */
1355  entry->AddWaitingPacket (p);
1356  return false;
1357  }
1358  }
1359  else
1360  {
1361  /* we contact this node for the first time
1362  * add it to the cache and send an NS
1363  */
1364  Ipv6Address addr;
1365  NdiscCache::Entry* entry = cache->Add (dst);
1366  entry->MarkIncomplete (p);
1367  entry->SetRouter (false);
1368 
1369  if (dst.IsLinkLocal ())
1370  {
1371  addr = cache->GetInterface ()->GetLinkLocalAddress ().GetAddress ();
1372  }
1373  else if (cache->GetInterface ()->GetNAddresses () == 1) /* an interface have at least one address (link-local) */
1374  {
1375  /* try to resolve global address without having global address so return! */
1376  cache->Remove (entry);
1377  return false;
1378  }
1379  else
1380  {
1381  /* find source address that match destination */
1382  addr = cache->GetInterface ()->GetAddressMatchingDestination (dst).GetAddress ();
1383  }
1384 
1385  SendNS (addr, Ipv6Address::MakeSolicitedAddress (dst), dst, cache->GetDevice ()->GetAddress ());
1386 
1387  /* start retransmit timer */
1388  entry->StartRetransmitTimer ();
1389  return false;
1390  }
1391 
1392  return false;
1393 }
1394 
1396 {
1398  NS_LOG_LOGIC (interface << " " << addr);
1399  Ipv6InterfaceAddress ifaddr;
1400  bool found = false;
1401  uint32_t i = 0;
1402  uint32_t nb = interface->GetNAddresses ();
1403 
1404  for (i = 0; i < nb; i++)
1405  {
1406  ifaddr = interface->GetAddress (i);
1407 
1408  if (ifaddr.GetAddress () == addr)
1409  {
1410  found = true;
1411  break;
1412  }
1413  }
1414 
1415  /* for the moment, this function is always called, if we was victim of a DAD the address is INVALID
1416  * and we do not set it to PREFERRED
1417  */
1418  if (found && ifaddr.GetState () != Ipv6InterfaceAddress::INVALID)
1419  {
1420  interface->SetState (ifaddr.GetAddress (), Ipv6InterfaceAddress::PREFERRED);
1421  NS_LOG_LOGIC ("DAD OK, interface in state PREFERRED");
1422 
1423  /* send an RS if our interface is not forwarding (router) and if address is a link-local ones
1424  * (because we will send RS with it)
1425  */
1426  Ptr<Ipv6> ipv6 = icmpv6->m_node->GetObject<Ipv6> ();
1427 
1428  if (!ipv6->IsForwarding (ipv6->GetInterfaceForDevice (interface->GetDevice ())) && addr.IsLinkLocal ())
1429  {
1430  /* \todo Add random delays before sending RS
1431  * because all nodes start at the same time, there will be many of RS arround 1 second of simulation time
1432  */
1433  Simulator::Schedule (Seconds (0.0), &Icmpv6L4Protocol::SendRS, PeekPointer (icmpv6), ifaddr.GetAddress (), Ipv6Address::GetAllRoutersMulticast (), interface->GetDevice ()->GetAddress ());
1434  }
1435  }
1436 }
1437 
1438 void
1440 {
1441  NS_LOG_FUNCTION (this << &callback);
1442 }
1443 
1444 void
1446 {
1447  NS_LOG_FUNCTION (this << &callback);
1448  m_downTarget = callback;
1449 }
1450 
1453 {
1454  NS_LOG_FUNCTION (this);
1455  return (IpL4Protocol::DownTargetCallback)NULL;
1456 }
1457 
1460 {
1461  NS_LOG_FUNCTION (this);
1462  return m_downTarget;
1463 }
1464 
1465 } /* namespace ns3 */
1466 
void DelayedSendMessage(Ptr< Packet > packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl)
Helper function used during delayed solicitation.
bool IsAny() const
If the IPv6 address is the "Any" address.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:268
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
Definition: ipv6-header.cc:143
uint8_t GetNextHeader(void) const
Get the next header.
Definition: ipv6-header.cc:81
void SetPayloadLength(uint16_t len)
Set the "Payload length" field.
Definition: ipv6-header.cc:66
void SetPacket(Ptr< Packet > packet)
Set the redirected packet.
void CalculatePseudoHeaderChecksum(Ipv6Address src, Ipv6Address dst, uint16_t length, uint8_t protocol)
Calculate pseudo header checksum for IPv6.
Introspection did not find any typical Config paths.
uint16_t GetId() const
Get the ID of the packet.
static const uint8_t MAX_ANYCAST_DELAY_TIME
Neighbor Discovery node constants : max anycast delay.
uint32_t GetNsDadUid() const
Get the latest DAD probe packet UID.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:95
Introspection did not find any typical Config paths.
Definition: ipv6-header.h:33
bool Lookup(Ipv6Address dst, Ptr< NetDevice > device, Ptr< NdiscCache > cache, Address *hardwareDestination)
Lookup in the ND cache for the IPv6 address.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void MarkIncomplete(Ptr< Packet > p)
Changes the state to this entry to INCOMPLETE.
Definition: ndisc-cache.cc:487
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
Introspection did not find any typical Config paths.
void SetState(Ipv6Address address, Ipv6InterfaceAddress::State_e state)
Update state of an interface address.
SocketErrno
Enumeration of the possible errors returned by a socket.
Definition: socket.h:82
AttributeValue implementation for Boolean.
Definition: boolean.h:34
Introspection did not find any typical Config paths.
Introspection did not find any typical Config paths.
void SendNA(Ipv6Address src, Ipv6Address dst, Address *hardwareAddress, uint8_t flags)
Send a Neighbor Adverstisement.
void HandleNS(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Neighbor Solicitation method.
virtual uint32_t GetSerializedSize() const
Get the serialized size.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
Address GetMacAddress() const
Get the MAC address of this entry.
Definition: ndisc-cache.cc:568
NdiscCache::Entry * Add(Ipv6Address to)
Add an entry.
Definition: ndisc-cache.cc:102
static const uint8_t MAX_INITIAL_RTR_ADVERTISEMENTS
Neighbor Discovery router constants : max initial RA transmission.
Ptr< Packet > GetPacket() const
Get the incorrect packet.
Ipv6Address GetTarget() const
Get the IPv6 target address.
Access to the IPv6 forwarding table, interfaces, and configuration.
Definition: ipv6.h:80
Hold variables of type string.
Definition: string.h:41
virtual uint32_t GetSerializedSize() const
Get the serialized size.
static const uint8_t MAX_FINAL_RTR_ADVERTISEMENTS
Neighbor Discovery router constants : max final RA transmission.
void Send(Ptr< Packet > packet, Ipv6Address source, Ipv6Address destination, uint8_t protocol, Ptr< Ipv6Route > route)
Higher-level layers call this method to send a packet down the stack to the MAC and PHY layers...
Introspection did not find any typical Config paths.
IPv6 layer implementation.
Ptr< Node > m_node
The node.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: boolean.h:81
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:836
Introspection did not find any typical Config paths.
void SendRS(Ipv6Address src, Ipv6Address dst, Address hardwareAddress)
Send a Router Solicitation.
Introspection did not find any typical Config paths.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
uint64_t GetUid(void) const
Returns the packet's Uid.
Definition: packet.cc:380
uint8_t GetType() const
Get the type field.
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1072
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:61
virtual void ReceiveIcmp(Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo, Ipv4Address payloadSource, Ipv4Address payloadDestination, const uint8_t payload[8])
Called from lower-level layers to send the ICMP packet up in the stack.
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:562
static Ipv6Address GetAny()
Get the "any" (::) Ipv6Address.
Ipv6InterfaceAddress GetAddress(uint32_t index) const
Get an address from IPv6 interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
IPv6 address associated with an interface.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:867
void SetPtr(uint32_t ptr)
Set the pointer field.
static const uint8_t PROT_NUMBER
ICMPv6 protocol number (58).
virtual IpL4Protocol::DownTargetCallback6 GetDownTarget6(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv6 ca...
bool GetFlagS() const
Get the S flag.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:766
void SetNextHeader(uint8_t next)
Set the "Next header" field.
Definition: ipv6-header.cc:76
Invalid state (after a DAD failed)
bool IsEqual(const Ipv6Address &other) const
Comparison operation between two Ipv6Addresses.
virtual ~Icmpv6L4Protocol()
Destructor.
static const uint8_t RTR_SOLICITATION_INTERVAL
Neighbor Discovery host constants : RS interval.
void StopReachableTimer()
Stop the reachable timer.
Definition: ndisc-cache.cc:423
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:338
static const uint8_t MAX_RTR_SOLICITATIONS
Neighbor Discovery host constants : max RS transmission.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:819
void SetMtu(uint32_t mtu)
Set the MTU.
void SetNode(Ptr< Node > node)
Set the node.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
This class implements a tag that carries the socket-specific TTL of a packet to the IP layer...
Definition: socket.h:999
void SetTarget(Ipv6Address target)
Set the IPv6 target address.
virtual int GetProtocolNumber() const
Get the protocol number.
std::list< Ptr< Packet > > MarkReachable(Address mac)
Changes the state to this entry to REACHABLE.
Definition: ndisc-cache.cc:498
Icmpv6L4Protocol()
Constructor.
uint16_t GetLifeTime() const
Get the node Life time (Neighbor Discovery).
virtual double GetValue(void)=0
Returns a random double from the underlying distribution.
a polymophic address class
Definition: address.h:90
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
static void FunctionDadTimeout(Ptr< Icmpv6L4Protocol > icmpv6, Ipv6Interface *interface, Ipv6Address addr)
Function called when DAD timeout.
virtual enum IpL4Protocol::RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > interface)
Receive method.
void SendErrorTooBig(Ptr< Packet > malformedPacket, Ipv6Address dst, uint32_t mtu)
Send an error Too Big.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Ptr< Ipv6Interface > GetInterface() const
Get the Ipv6Interface associated with this cache.
Definition: ndisc-cache.cc:78
void NotifyNewAggregate()
This method is called by AddAgregate and completes the aggregation by setting the node in the ICMPv6 ...
bool IsDelay() const
Is the entry DELAY.
Definition: ndisc-cache.cc:550
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
Definition: packet.cc:228
Packet header for IPv4.
Definition: ipv4-header.h:31
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
Definition: packet.cc:317
bool GetFlagR() const
Get the R flag.
The IPv6 representation of a network interface.
Introspection did not find any typical Config paths.
void HandleRedirection(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Redirection method.
Ipv6Address GetAddress() const
Get the IPv6 address.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
Introspection did not find any typical Config paths.
Definition: icmpv6-header.h:37
uint32_t GetNAddresses(void) const
Get number of addresses on this IPv6 interface.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: pointer.h:210
static const uint32_t MAX_RA_DELAY_TIME
Neighbor Discovery router constants : max delay between RA.
void Forward(Ipv6Address source, Icmpv6Header icmp, uint32_t info, Ipv6Header ipHeader, const uint8_t payload[8])
Notify an ICMPv6 reception to upper layers (if requested).
void SendErrorParameterError(Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code, uint32_t ptr)
Send an error Parameter Error.
Ptr< Packet > GetPacket() const
Get the incorrect packet.
void SetTtl(uint8_t ttl)
Set the tag's TTL.
Definition: socket.cc:582
void SetIpv6Target(Ipv6Address target)
Set the IPv6 target field.
void HandleTimeExceeded(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Time Exceeded method.
void Flush()
Flush the cache.
Definition: ndisc-cache.cc:129
void SendErrorTimeExceeded(Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code)
Send an error Time Exceeded.
Introspection did not find any typical Config paths.
static Ipv6Address GetZero()
Get the 0 (::) Ipv6Address.
uint8_t data[writeSize]
bool IsAlwaysDad() const
Is the node must do DAD.
uint8_t GetLength(void) const
Get the length of the underlying address.
Definition: address.cc:75
static const uint32_t REACHABLE_TIME
Neighbor Discovery node constants : reachable time.
Introspection did not find any typical Config paths.
Ptr< Packet > GetPacket() const
Get the incorrect packet.
static const double MIN_RANDOM_FACTOR
Neighbor Discovery node constants : min random factor.
Ptr< NdiscCache > FindCache(Ptr< NetDevice > device)
Get the cache corresponding to the device.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1290
virtual Ptr< NetDevice > GetDevice() const
Get the NetDevice.
Ptr< Packet > ForgeNA(Ipv6Address src, Ipv6Address dst, Address *hardwareAddress, uint8_t flags)
Forge a Neighbor Advertisement.
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
Ptr< RandomVariableStream > m_solicitationJitter
Random jitter before sending solicitations.
bool GetFlagO() const
Get the O flag.
void HandleRS(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Router Solicitation method.
void Send(Ptr< Packet > p, Ipv6Address dest)
Send a packet through this interface.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:252
void StopProbeTimer()
Stop probe timer.
Definition: ndisc-cache.cc:441
Ptr< Packet > ForgeNS(Ipv6Address src, Ipv6Address dst, Ipv6Address target, Address hardwareAddress)
Forge a Neighbor Solicitation.
void StartRetransmitTimer()
Start retransmit timer.
Definition: ndisc-cache.cc:468
#define list
uint16_t GetSeq() const
Get the sequence number.
void SetNsDadUid(Ipv6Address address, uint32_t uid)
Update NS DAD packet UID of an interface address.
void ClearWaitingPacket()
Clear the waiting packet list.
Definition: ndisc-cache.cc:235
virtual uint32_t GetSerializedSize() const
Get the serialized size.
void HandleEchoRequest(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Echo Request method.
void HandleParameterError(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Parameter Error method.
virtual void NotifyNewAggregate(void)
Notify all Objects aggregated to this one of a new Object being aggregated.
Definition: object.cc:317
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
static const uint8_t MAX_MULTICAST_SOLICIT
Neighbor Discovery node constants : max multicast solicitations.
bool IsProbe() const
Is the entry PROBE.
Definition: ndisc-cache.cc:562
uint8_t GetHopLimit(void) const
Get the "Hop limit" field (TTL).
Definition: ipv6-header.cc:91
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SendErrorDestinationUnreachable(Ptr< Packet > malformedPacket, Ipv6Address dst, uint8_t code)
Send an error Destination Unreachable.
void SendEchoReply(Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr< Packet > data)
Send a Echo Reply.
static TypeId GetTypeId()
Interface ID.
static const uint8_t MAX_NEIGHBOR_ADVERTISEMENT
Neighbor Discovery node constants : max NA transmission.
virtual IpL4Protocol::DownTargetCallback GetDownTarget(void) const
This method allows a caller to get the current down target callback set for this L4 protocol (IPv4 ca...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
static uint16_t GetStaticProtocolNumber()
Get ICMPv6 protocol number.
void SetCode(uint8_t code)
Set the code field.
Ipv6InterfaceAddress::State_e GetState() const
Get the address state.
Introspection did not find any typical Config paths.
uint8_t GetCode() const
Get the code field.
void AddWaitingPacket(Ptr< Packet > p)
Add a packet (or replace old value) in the queue.
Definition: ndisc-cache.cc:222
void StartDelayTimer()
Start delay timer.
Definition: ndisc-cache.cc:449
IpL4Protocol::DownTargetCallback6 m_downTarget
callback to Ipv6::Send
static const uint8_t MAX_INITIAL_RTR_ADVERT_INTERVAL
Neighbor Discovery router constants : max initial RA initial interval.
bool IsMulticast() const
If the IPv6 address is multicast (ff00::/8).
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
void StartReachableTimer()
Start the reachable timer.
Definition: ndisc-cache.cc:411
bool m_alwaysDad
Always do DAD ?
bool IsIncomplete() const
Is the entry INCOMPLETE.
Definition: ndisc-cache.cc:556
L4 Protocol abstract base class.
void SendMessage(Ptr< Packet > packet, Ipv6Address src, Ipv6Address dst, uint8_t ttl)
Send a packet via ICMPv6, note that packet already contains ICMPv6 header.
virtual void SetDownTarget(IpL4Protocol::DownTargetCallback cb)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv4 ca...
Ptr< Packet > ForgeRS(Ipv6Address src, Ipv6Address dst, Address hardwareAddress)
Forge a Router Solicitation.
void Remove(NdiscCache::Entry *entry)
Delete an entry.
Definition: ndisc-cache.cc:113
static const uint8_t MIN_DELAY_BETWEEN_RAS
Neighbor Discovery router constants : min delay between RA.
void SetFlagR(bool r)
Set the R flag.
virtual uint32_t GetSerializedSize() const
Get the serialized size.
void SendRedirection(Ptr< Packet > redirectedPacket, Ipv6Address src, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget)
Send an ICMPv6 Redirection.
std::list< Ptr< Packet > > MarkStale(Address mac)
Changes the state to this entry to STALE.
Definition: ndisc-cache.cc:524
void SetMacAddress(Address mac)
Set the MAC address of this entry.
Definition: ndisc-cache.cc:574
static const double MAX_RANDOM_FACTOR
Neighbor Discovery node constants : max random factor.
Introspection did not find any typical Config paths.
void SetFlagS(bool s)
Set the S flag.
void SetSourceAddress(Ipv6Address src)
Set the "Source address" field.
Definition: ipv6-header.cc:96
CacheList m_cacheList
A list of cache by device.
void DoDAD(Ipv6Address target, Ptr< Ipv6Interface > interface)
Do the Duplication Address Detection (DAD).
virtual void SetDownTarget6(IpL4Protocol::DownTargetCallback6 cb)
This method allows a caller to set the current down target callback set for this L4 protocol (IPv6 ca...
Ipv6InterfaceAddress GetLinkLocalAddress() const
Get link-local address from IPv6 interface.
Describes an IPv6 address.
Definition: ipv6-address.h:47
NdiscCache::Entry * Lookup(Ipv6Address dst)
Lookup in the cache.
Definition: ndisc-cache.cc:90
void SetHopLimit(uint8_t limit)
Set the "Hop limit" field (TTL).
Definition: ipv6-header.cc:86
void HandleRA(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Router Advertisement method.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:228
void ReceiveLLA(Icmpv6OptionLinkLayerAddress lla, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Link layer address option processing.
void MarkDelay()
Change the state to this entry to DELAY.
Definition: ndisc-cache.cc:532
virtual int GetVersion() const
Get the version of the protocol.
uint32_t GetSerializedSize(void) const
Returns number of bytes required for packet serialization.
Definition: packet.cc:560
static const uint32_t RETRANS_TIMER
Neighbor Discovery node constants : retransmission timer.
void SetDestination(Ipv6Address destination)
Set the IPv6 destination address.
void StopRetransmitTimer()
Stop retransmit timer.
Definition: ndisc-cache.cc:480
Ptr< Packet > ForgeEchoRequest(Ipv6Address src, Ipv6Address dst, uint16_t id, uint16_t seq, Ptr< Packet > data)
Forge an Echo Request.
Ipv6Address GetSourceAddress(void) const
Get the "Source address" field.
Definition: ipv6-header.cc:101
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:859
void StopDelayTimer()
Stop delay timer.
Definition: ndisc-cache.cc:461
void SetDevice(Ptr< NetDevice > device, Ptr< Ipv6Interface > interface)
Set the device and interface.
Definition: ndisc-cache.cc:71
Describes an IPv6 prefix.
Definition: ipv6-address.h:389
virtual void DoDispose()
Dispose this object.
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1076
Ipv6Address GetDestination() const
Get the IPv6 destination address.
Ipv6Address GetIpv6Target() const
Get the IPv6 target field.
uint32_t CopyData(uint8_t *buffer, uint32_t size) const
Copy the packet contents to a byte buffer.
Definition: packet.cc:368
static const uint8_t MAX_RTR_SOLICITATION_DELAY
Neighbor Discovery host constants : max RS delay.
A record that holds information about an NdiscCache entry.
Definition: ndisc-cache.h:138
RxStatus
Rx status codes.
Address is tentative but we are optimistic so we can send packet even if DAD is not yet finished...
void HandleNA(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Neighbor Advertisement method.
void SetRouter(bool router)
Set the node type.
Definition: ndisc-cache.cc:210
static const uint8_t DELAY_FIRST_PROBE_TIME
Neighbor Discovery node constants : delay for the first probe.
virtual uint32_t GetSerializedSize() const
Get the serialized size.
void SetSeq(uint16_t seq)
Set the sequence number.
void HandlePacketTooBig(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Packet Too Big method.
bool IsReachable() const
Is the entry REACHABLE.
Definition: ndisc-cache.cc:544
void SetPacket(Ptr< Packet > p)
Set the incorrect packet.
uint32_t GetMtu() const
Get the MTU field.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:455
Introspection did not find any typical Config paths.
a unique identifier for an interface.
Definition: type-id.h:51
Ptr< Packet > GetPacket() const
Get the incorrect packet.
Ipv6InterfaceAddress GetAddressMatchingDestination(Ipv6Address dst)
Get an address which is in the same network prefix as destination.
virtual uint32_t GetSerializedSize() const
Get the serialized size.
void SetDestinationAddress(Ipv6Address dst)
Set the "Destination address" field.
Definition: ipv6-header.cc:106
void SetFlagO(bool o)
Set the O flag.
Ptr< NetDevice > GetDevice() const
Get the NetDevice associated with this cache.
Definition: ndisc-cache.cc:84
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
void Dispose(void)
Dispose of this Object.
Definition: object.cc:207
void SendNS(Ipv6Address src, Ipv6Address dst, Ipv6Address target, Address hardwareAddress)
Send a Neighbor Solicitation.
Address is tentative, no packet can be sent unless DAD finished.
bool IsStale() const
Is the entry STALE.
Definition: ndisc-cache.cc:538
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:253
Ipv6Address GetDestinationAddress(void) const
Get the "Destination address" field.
Definition: ipv6-header.cc:111
Ptr< NdiscCache > CreateCache(Ptr< NetDevice > device, Ptr< Ipv6Interface > interface)
Create a neighbor cache.
void SetId(uint16_t id)
Set the ID of the packet.
void HandleDestinationUnreachable(Ptr< Packet > p, Ipv6Address const &src, Ipv6Address const &dst, Ptr< Ipv6Interface > interface)
Receive Destination Unreachable method.
static Ipv6Address MakeSolicitedAddress(Ipv6Address addr)
Make the solicited IPv6 address.
static Ipv6Address GetAllRoutersMulticast()
Get the "all routers multicast" address.
static const uint8_t MAX_UNICAST_SOLICIT
Neighbor Discovery node constants : max unicast solicitations.