View | Details | Raw Unified | Return to bug 2252
Collapse All | Expand All

(-)a/src/nix-vector-routing/doc/nix-vector-routing.h (-22 lines)
 Lines 34-61    Link Here 
34
 * efficient adaptation to link failures.  It simply flushes all nix-vector 
34
 * efficient adaptation to link failures.  It simply flushes all nix-vector 
35
 * routing caches. Finally, IPv6 is not supported.
35
 * routing caches. Finally, IPv6 is not supported.
36
 *
36
 *
37
 * \section api API and Usage
38
 *
39
 * The Nix-vector routing protocol at the moment does not handle local
40
 * delivery. As a consequence, it must be used along with another routing
41
 * protocol, with the obvious candidate being Ipv4StaticRouting.
42
 * Moreover, Ipv4StaticRouting must have a higher precedence than
43
 * Nix-vector routing.
44
 *
45
 * Example:
46
 * \code
47
   Ipv4NixVectorHelper nixRouting;
48
   Ipv4StaticRoutingHelper staticRouting;
49
50
   Ipv4ListRoutingHelper list;
51
   list.Add (staticRouting, 0);
52
   list.Add (nixRouting, 10);
53
54
   InternetStackHelper stack;
55
   stack.SetRoutingHelper (list);
56
   stack.Install (allNodes);
57
 * \endcode
58
 *
59
 * \section impl Implementation
37
 * \section impl Implementation
60
 *
38
 *
61
 * ns-3 nix-vector-routing performs on-demand route computation using 
39
 * ns-3 nix-vector-routing performs on-demand route computation using 
(-)a/src/nix-vector-routing/examples/nix-simple.cc (-7 / +1 lines)
 Lines 68-81    Link Here 
68
  // NixHelper to install nix-vector routing
68
  // NixHelper to install nix-vector routing
69
  // on all nodes
69
  // on all nodes
70
  Ipv4NixVectorHelper nixRouting;
70
  Ipv4NixVectorHelper nixRouting;
71
  Ipv4StaticRoutingHelper staticRouting;
72
73
  Ipv4ListRoutingHelper list;
74
  list.Add (staticRouting, 0);
75
  list.Add (nixRouting, 10);
76
77
  InternetStackHelper stack;
71
  InternetStackHelper stack;
78
  stack.SetRoutingHelper (list); // has effect on the next Install ()
72
  stack.SetRoutingHelper (nixRouting); // has effect on the next Install ()
79
  stack.Install (allNodes);
73
  stack.Install (allNodes);
80
74
81
  NetDeviceContainer devices12;
75
  NetDeviceContainer devices12;
(-)a/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc (+41 lines)
 Lines 619-624    Link Here 
619
619
620
  CheckCacheStateAndFlush ();
620
  CheckCacheStateAndFlush ();
621
621
622
  NS_ASSERT (m_ipv4 != 0);
623
  // Check if input device supports IP
624
  NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0);
625
  uint32_t iif = m_ipv4->GetInterfaceForDevice (idev);
626
627
  NS_LOG_LOGIC ("Unicast destination");
628
  /// \todo Configurable option to enable \RFC{1222} Strong End System Model
629
  // Right now, we will be permissive and allow a source to send us
630
  // a packet to one of our other interface addresses; that is, the
631
  // destination unicast address does not match one of the iif addresses,
632
  // but we check our other interfaces.  This could be an option
633
  // (to remove the outer loop immediately below and just check iif).
634
  for (uint32_t j = 0; j < m_ipv4->GetNInterfaces (); j++)
635
    {
636
      for (uint32_t i = 0; i < m_ipv4->GetNAddresses (j); i++)
637
        {
638
          Ipv4InterfaceAddress iaddr = m_ipv4->GetAddress (j, i);
639
          Ipv4Address addr = iaddr.GetLocal ();
640
          if (addr.IsEqual (header.GetDestination ()))
641
            {
642
              if (j == iif)
643
                {
644
                  NS_LOG_LOGIC ("For me (destination " << addr << " match)");
645
                }
646
              else
647
                {
648
                  NS_LOG_LOGIC ("For me (destination " << addr << " match) on another interface " << header.GetDestination ());
649
                }
650
              lcb (p, header, iif);
651
              return true;
652
            }
653
          if (header.GetDestination ().IsEqual (iaddr.GetBroadcast ()))
654
            {
655
              NS_LOG_LOGIC ("For me (interface broadcast address)");
656
              lcb (p, header, iif);
657
              return true;
658
            }
659
          NS_LOG_LOGIC ("Address "<< addr << " not a match");
660
        }
661
    }
662
622
  Ptr<Ipv4Route> rtentry;
663
  Ptr<Ipv4Route> rtentry;
623
664
624
  // Get the nix-vector from the packet
665
  // Get the nix-vector from the packet

Return to bug 2252