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

(-)a/src/routing/olsr/olsr-routing-protocol.cc (-3 / +14 lines)
 Lines 2610-2617    Link Here 
2610
RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
2610
RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif, Socket::SocketErrno &sockerr)
2611
{  
2611
{  
2612
  NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject<Node> ()->GetId() << " " << header.GetDestination () << " " << oif);
2612
  NS_LOG_FUNCTION (this << " " << m_ipv4->GetObject<Node> ()->GetId() << " " << header.GetDestination () << " " << oif);
2613
  // TBD:  oif is unused; can be used to restrict the outgoing interface
2614
  // of the found route if application bound to a source interface
2615
  Ptr<Ipv4Route> rtentry;
2613
  Ptr<Ipv4Route> rtentry;
2616
  RoutingTableEntry entry1, entry2;
2614
  RoutingTableEntry entry1, entry2;
2617
  if (Lookup (header.GetDestination (), entry1) != 0)
2615
  if (Lookup (header.GetDestination (), entry1) != 0)
 Lines 2621-2629    Link Here 
2621
        {
2619
        {
2622
          NS_FATAL_ERROR ("FindSendEntry failure");
2620
          NS_FATAL_ERROR ("FindSendEntry failure");
2623
        }
2621
        }
2622
      uint32_t interfaceIdx = entry2.interface;
2623
      if (oif && m_ipv4->GetInterfaceForDevice (oif) != static_cast<int> (interfaceIdx))
2624
        {
2625
          // We do not attempt to perform a constrained routing search
2626
          // if the caller specifies the oif; we just enforce that 
2627
          // that the found route matches the requested outbound interface 
2628
          NS_LOG_DEBUG ("Olsr node " << m_mainAddress 
2629
                        << ": RouteOutput for dest=" << header.GetDestination ()
2630
                        << " Route interface " << interfaceIdx 
2631
                        << " does not match requested output interface "
2632
                        << m_ipv4->GetInterfaceForDevice (oif));
2633
          sockerr = Socket::ERROR_NOROUTETOHOST;
2634
          return rtentry;
2635
        }
2624
      rtentry = Create<Ipv4Route> ();
2636
      rtentry = Create<Ipv4Route> ();
2625
      rtentry->SetDestination (header.GetDestination ());
2637
      rtentry->SetDestination (header.GetDestination ());
2626
      uint32_t interfaceIdx = entry2.interface;
2627
      // the source address is the interface address that matches
2638
      // the source address is the interface address that matches
2628
      // the destination address (when multiple are present on the 
2639
      // the destination address (when multiple are present on the 
2629
      // outgoing interface, one is selected via scoping rules)
2640
      // outgoing interface, one is selected via scoping rules)

Return to bug 778