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

(-)a/src/helper/ipv4-address-helper.cc (-9 / +9 lines)
 Lines 134-152   Ipv4AddressHelper::Assign (const NetDevi Link Here 
134
    Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
134
    Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
135
    NS_ASSERT_MSG (ipv4, "Ipv4AddressHelper::Allocate(): Bad ipv4");
135
    NS_ASSERT_MSG (ipv4, "Ipv4AddressHelper::Allocate(): Bad ipv4");
136
136
137
    int32_t ifIndex = ipv4->FindInterfaceForDevice (device);
137
    int32_t interfaceIndex = ipv4->FindInterfaceForDevice (device);
138
    if (ifIndex == -1)
138
    if (interfaceIndex == -1)
139
      {
139
      {
140
        ifIndex = ipv4->AddInterface (device);
140
        interfaceIndex = ipv4->AddInterface (device);
141
      }
141
      }
142
    NS_ASSERT_MSG (ifIndex >= 0, "Ipv4AddressHelper::Allocate(): "
142
    NS_ASSERT_MSG (interfaceIndex >= 0, "Ipv4AddressHelper::Allocate(): "
143
      "Interface index not found");
143
      "Interface index not found");
144
144
145
    ipv4->SetAddress (ifIndex, NewAddress ());
145
    ipv4->SetAddress (interfaceIndex, NewAddress ());
146
    ipv4->SetNetworkMask (ifIndex, m_mask);
146
    ipv4->SetNetworkMask (interfaceIndex, m_mask);
147
    ipv4->SetMetric (ifIndex, 1);
147
    ipv4->SetMetric (interfaceIndex, 1);
148
    ipv4->SetUp (ifIndex);
148
    ipv4->SetUp (interfaceIndex);
149
    retval.Add (ipv4, ifIndex);
149
    retval.Add (ipv4, interfaceIndex);
150
  }
150
  }
151
  return retval;
151
  return retval;
152
}
152
}
(-)a/src/helper/static-multicast-route-helper.cc (-8 / +9 lines)
 Lines 41-56   StaticMulticastRouteHelper::AddMulticast Link Here 
41
{
41
{
42
  Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
42
  Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
43
43
44
  // We need to convert the NetDeviceContainer to an array of ifIndex
44
  // We need to convert the NetDeviceContainer to an array of interfaceIndex
45
  std::vector<uint32_t> outputInterfaces;
45
  std::vector<uint32_t> outputInterfaces;
46
  for (NetDeviceContainer::Iterator i = output.Begin (); i != output.End (); ++i)
46
  for (NetDeviceContainer::Iterator i = output.Begin (); 
47
       i != output.End (); ++i)
47
    {
48
    {
48
      Ptr<NetDevice> nd = *i;
49
      Ptr<NetDevice> nd = *i;
49
      uint32_t oifIndex = ipv4->FindInterfaceForDevice (nd);
50
      uint32_t ointerfaceIndex = ipv4->FindInterfaceForDevice (nd);
50
      outputInterfaces.push_back(oifIndex);
51
      outputInterfaces.push_back(ointerfaceIndex);
51
    }
52
    }
52
  uint32_t iifIndex = ipv4->FindInterfaceForDevice (input);
53
  uint32_t iinterfaceIndex = ipv4->FindInterfaceForDevice (input);
53
  ipv4->AddMulticastRoute (source, group, iifIndex, outputInterfaces);
54
  ipv4->AddMulticastRoute (source, group, iinterfaceIndex, outputInterfaces);
54
}
55
}
55
56
56
void
57
void
 Lines 59-66   StaticMulticastRouteHelper::SetDefaultMu Link Here 
59
  Ptr<NetDevice> nd)
60
  Ptr<NetDevice> nd)
60
{
61
{
61
  Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
62
  Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
62
  uint32_t ifIndexSrc = ipv4->FindInterfaceForDevice (nd);
63
  uint32_t interfaceIndexSrc = ipv4->FindInterfaceForDevice (nd);
63
  ipv4->SetDefaultMulticastRoute (ifIndexSrc);
64
  ipv4->SetDefaultMulticastRoute (interfaceIndexSrc);
64
}
65
}
65
66
66
void
67
void
(-)a/src/internet-stack/ipv4-impl.cc (-7 / +8 lines)
 Lines 224-244   Ipv4Impl::GetMetric (uint32_t i) const Link Here 
224
}
224
}
225
225
226
bool
226
bool
227
Ipv4Impl::GetIfIndexForDestination (Ipv4Address dest, uint32_t &ifIndex) const
227
Ipv4Impl::GetIfIndexForDestination (Ipv4Address dest, 
228
{
228
                                    uint32_t &interfaceIndex) const
229
  return m_ipv4->GetIfIndexForDestination (dest, ifIndex);
229
{
230
  return m_ipv4->GetIfIndexForDestination (dest, interfaceIndex);
230
}
231
}
231
232
232
Ipv4Address 
233
Ipv4Address 
233
Ipv4Impl::GetSourceAddress (Ipv4Address destination) const
234
Ipv4Impl::GetSourceAddress (Ipv4Address destination) const
234
{
235
{
235
  uint32_t ifIndex = 0xffffffff;
236
  uint32_t interfaceIndex = 0xffffffff;
236
237
237
  bool result = m_ipv4->GetIfIndexForDestination (destination, ifIndex);
238
  bool result = m_ipv4->GetIfIndexForDestination (destination, interfaceIndex);
238
239
239
  if (result)
240
  if (result)
240
    {
241
    {
241
      return m_ipv4->GetAddress (ifIndex);
242
      return m_ipv4->GetAddress (interfaceIndex);
242
    }
243
    }
243
  else
244
  else
244
    {
245
    {
(-)a/src/internet-stack/ipv4-impl.h (-1 / +1 lines)
 Lines 95-101   public: Link Here 
95
  virtual uint16_t GetMetric (uint32_t i) const;
95
  virtual uint16_t GetMetric (uint32_t i) const;
96
  virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const;
96
  virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const;
97
  virtual bool GetIfIndexForDestination (Ipv4Address dest, 
97
  virtual bool GetIfIndexForDestination (Ipv4Address dest, 
98
    uint32_t &ifIndex) const;
98
    uint32_t &interfaceIndex) const;
99
99
100
  virtual uint16_t GetMtu (uint32_t i) const;
100
  virtual uint16_t GetMtu (uint32_t i) const;
101
  virtual bool IsUp (uint32_t i) const;
101
  virtual bool IsUp (uint32_t i) const;
(-)a/src/internet-stack/ipv4-interface.h (-1 / +13 lines)
 Lines 35-43   class Packet; Link Here 
35
/**
35
/**
36
 * \brief The IPv4 representation of a network interface
36
 * \brief The IPv4 representation of a network interface
37
 *
37
 *
38
 * This class roughly corresponds to the struct in_device
38
 * This class roughly corresponds to the struct if_addr
39
 * of Linux; the main purpose is to provide address-family
39
 * of Linux; the main purpose is to provide address-family
40
 * specific information (addresses) about an interface.
40
 * specific information (addresses) about an interface.
41
 * Additionally, subclass provide an implementation of
42
 * the Send() function, where functions such as ARP
43
 * can be hooked into the outgoing packet processing. 
44
 *
45
 * In Linux, multiple if_addrs may be associated to a single
46
 * underlying net_device, and devices are typically known by string-based
47
 * names such as "eth0" and "eth0:1".  Presently, our Ipv4Interfaces
48
 * are identified by integers, and only one Ipv4Interface can presently
49
 * be associated with an underlying NetDevice.  The ifIndex of
50
 * an underlying NetDevice cannot be assumed to be the same as
51
 * the interface index of this object, as indexed by the container
52
 * of Ipv4Interface objects stored in the class Ipv4L3Protocol.
41
 *
53
 *
42
 * This class defines two APIs:
54
 * This class defines two APIs:
43
 *  - the public API which is expected to be used by both 
55
 *  - the public API which is expected to be used by both 
(-)a/src/internet-stack/ipv4-l3-protocol.cc (-30 / +30 lines)
 Lines 193-204   Ipv4L3Protocol::Lookup ( Link Here 
193
193
194
void
194
void
195
Ipv4L3Protocol::Lookup (
195
Ipv4L3Protocol::Lookup (
196
  uint32_t ifIndex,
196
  uint32_t interfaceIndex,
197
  Ipv4Header const &ipHeader,
197
  Ipv4Header const &ipHeader,
198
  Ptr<Packet> packet,
198
  Ptr<Packet> packet,
199
  Ipv4RoutingProtocol::RouteReplyCallback routeReply)
199
  Ipv4RoutingProtocol::RouteReplyCallback routeReply)
200
{
200
{
201
  NS_LOG_FUNCTION (this << ifIndex << &ipHeader << packet << &routeReply);
201
  NS_LOG_FUNCTION (this << interfaceIndex << &ipHeader << packet << &routeReply);
202
202
203
  for (Ipv4RoutingProtocolList::const_iterator rprotoIter = 
203
  for (Ipv4RoutingProtocolList::const_iterator rprotoIter = 
204
         m_routingProtocols.begin ();
204
         m_routingProtocols.begin ();
 Lines 206-218   Ipv4L3Protocol::Lookup ( Link Here 
206
       rprotoIter++)
206
       rprotoIter++)
207
    {
207
    {
208
      NS_LOG_LOGIC ("Requesting route");
208
      NS_LOG_LOGIC ("Requesting route");
209
      if ((*rprotoIter).second->RequestRoute (ifIndex, ipHeader, packet, 
209
      if ((*rprotoIter).second->RequestRoute (interfaceIndex, ipHeader, packet, 
210
                                              routeReply))
210
                                              routeReply))
211
        return;
211
        return;
212
    }
212
    }
213
213
214
  if (ipHeader.GetDestination ().IsMulticast () && 
214
  if (ipHeader.GetDestination ().IsMulticast () && 
215
      ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY)
215
      interfaceIndex == Ipv4RoutingProtocol::IF_INDEX_ANY)
216
    {
216
    {
217
      NS_LOG_LOGIC ("Multicast destination with local source");
217
      NS_LOG_LOGIC ("Multicast destination with local source");
218
//
218
//
 Lines 378-391   Ipv4L3Protocol::FindInterfaceForAddr (Ip Link Here 
378
{
378
{
379
  NS_LOG_FUNCTION (this << addr);
379
  NS_LOG_FUNCTION (this << addr);
380
380
381
  uint32_t ifIndex = 0;
381
  uint32_t interfaceIndex = 0;
382
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); 
382
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); 
383
       i != m_interfaces.end (); 
383
       i != m_interfaces.end (); 
384
       i++, ifIndex++)
384
       i++, interfaceIndex++)
385
    {
385
    {
386
      if ((*i)->GetAddress () == addr)
386
      if ((*i)->GetAddress () == addr)
387
        {
387
        {
388
          return ifIndex;
388
          return interfaceIndex;
389
        }
389
        }
390
    }
390
    }
391
391
 Lines 399-412   Ipv4L3Protocol::FindInterfaceForAddr (Ip Link Here 
399
{
399
{
400
  NS_LOG_FUNCTION (this << addr << mask);
400
  NS_LOG_FUNCTION (this << addr << mask);
401
401
402
  uint32_t ifIndex = 0;
402
  uint32_t interfaceIndex = 0;
403
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); 
403
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); 
404
       i != m_interfaces.end (); 
404
       i != m_interfaces.end (); 
405
       i++, ifIndex++)
405
       i++, interfaceIndex++)
406
    {
406
    {
407
      if ((*i)->GetAddress ().CombineMask (mask) == addr.CombineMask (mask))
407
      if ((*i)->GetAddress ().CombineMask (mask) == addr.CombineMask (mask))
408
        {
408
        {
409
          return ifIndex;
409
          return interfaceIndex;
410
        }
410
        }
411
    }
411
    }
412
412
 Lines 420-433   Ipv4L3Protocol::FindInterfaceIndexForDev Link Here 
420
{
420
{
421
  NS_LOG_FUNCTION (this << device);
421
  NS_LOG_FUNCTION (this << device);
422
422
423
  uint32_t ifIndex = 0;
423
  uint32_t interfaceIndex = 0;
424
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); 
424
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin (); 
425
       i != m_interfaces.end (); 
425
       i != m_interfaces.end (); 
426
       i++, ifIndex++)
426
       i++, interfaceIndex++)
427
    {
427
    {
428
      if ((*i)->GetDevice () == device)
428
      if ((*i)->GetDevice () == device)
429
        {
429
        {
430
          return ifIndex;
430
          return interfaceIndex;
431
        }
431
        }
432
    }
432
    }
433
433
 Lines 609-620   Ipv4L3Protocol::SendRealOut (bool found, Link Here 
609
609
610
bool
610
bool
611
Ipv4L3Protocol::Forwarding (
611
Ipv4L3Protocol::Forwarding (
612
  uint32_t ifIndex, 
612
  uint32_t interfaceIndex, 
613
  Ptr<Packet> packet, 
613
  Ptr<Packet> packet, 
614
  Ipv4Header &ipHeader, 
614
  Ipv4Header &ipHeader, 
615
  Ptr<NetDevice> device)
615
  Ptr<NetDevice> device)
616
{
616
{
617
  NS_LOG_FUNCTION (ifIndex << packet << &ipHeader<< device);
617
  NS_LOG_FUNCTION (interfaceIndex << packet << &ipHeader<< device);
618
  NS_LOG_LOGIC ("Forwarding logic for node: " << m_node->GetId ());
618
  NS_LOG_LOGIC ("Forwarding logic for node: " << m_node->GetId ());
619
619
620
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
620
  for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
 Lines 678-690   Ipv4L3Protocol::Forwarding ( Link Here 
678
          // We forward with a packet copy, since forwarding may change
678
          // We forward with a packet copy, since forwarding may change
679
          // the packet, affecting our local delivery
679
          // the packet, affecting our local delivery
680
          NS_LOG_LOGIC ("Forwarding (multicast).");
680
          NS_LOG_LOGIC ("Forwarding (multicast).");
681
          Lookup (ifIndex, ipHeader, packet->Copy (),
681
          Lookup (interfaceIndex, ipHeader, packet->Copy (),
682
          MakeCallback (&Ipv4L3Protocol::SendRealOut, this));
682
          MakeCallback (&Ipv4L3Protocol::SendRealOut, this));
683
          return false;
683
          return false;
684
        }   
684
        }   
685
    }     
685
    }     
686
  NS_LOG_LOGIC ("Not for me, forwarding.");
686
  NS_LOG_LOGIC ("Not for me, forwarding.");
687
  Lookup (ifIndex, ipHeader, packet,
687
  Lookup (interfaceIndex, ipHeader, packet,
688
  MakeCallback (&Ipv4L3Protocol::SendRealOut, this));
688
  MakeCallback (&Ipv4L3Protocol::SendRealOut, this));
689
  
689
  
690
  return true;
690
  return true;
 Lines 776-784   Ipv4L3Protocol::GetMetric (uint32_t i) c Link Here 
776
776
777
bool
777
bool
778
Ipv4L3Protocol::GetIfIndexForDestination (
778
Ipv4L3Protocol::GetIfIndexForDestination (
779
  Ipv4Address destination, uint32_t& ifIndex) const
779
  Ipv4Address destination, uint32_t& interfaceIndex) const
780
{
780
{
781
  NS_LOG_FUNCTION (this << destination << &ifIndex);
781
  NS_LOG_FUNCTION (this << destination << &interfaceIndex);
782
//
782
//
783
// The first thing we do in trying to determine a source address is to 
783
// The first thing we do in trying to determine a source address is to 
784
// consult the routing protocols.  These will also check for a default route
784
// consult the routing protocols.  These will also check for a default route
 Lines 789-800   Ipv4L3Protocol::GetIfIndexForDestination Link Here 
789
       i++)
789
       i++)
790
    {
790
    {
791
      NS_LOG_LOGIC ("Requesting Source Address");
791
      NS_LOG_LOGIC ("Requesting Source Address");
792
      uint32_t ifIndexTmp;
792
      uint32_t interfaceIndexTmp;
793
793
794
      if ((*i).second->RequestIfIndex (destination, ifIndexTmp))
794
      if ((*i).second->RequestIfIndex (destination, interfaceIndexTmp))
795
        {
795
        {
796
          NS_LOG_LOGIC ("Found ifIndex " << ifIndexTmp);
796
          NS_LOG_LOGIC ("Found interfaceIndex " << interfaceIndexTmp);
797
          ifIndex = ifIndexTmp;
797
          interfaceIndex = interfaceIndexTmp;
798
          return true;
798
          return true;
799
        }
799
        }
800
    }
800
    }
 Lines 810-816   Ipv4L3Protocol::GetIfIndexForDestination Link Here 
810
  if (GetNInterfaces () == 2)
810
  if (GetNInterfaces () == 2)
811
    {
811
    {
812
      NS_LOG_LOGIC ("One Interface.  Using interface 1.");
812
      NS_LOG_LOGIC ("One Interface.  Using interface 1.");
813
      ifIndex = 1;
813
      interfaceIndex = 1;
814
      return true;
814
      return true;
815
    }
815
    }
816
//
816
//
 Lines 838-846   Ipv4L3Protocol::GetIfIndexForDestination Link Here 
838
      return false;
838
      return false;
839
    }
839
    }
840
840
841
  ifIndex = route->GetInterface ();
841
  interfaceIndex = route->GetInterface ();
842
842
843
  NS_LOG_LOGIC ("Default route specifies interface " << ifIndex);
843
  NS_LOG_LOGIC ("Default route specifies interface " << interfaceIndex);
844
  return true;
844
  return true;
845
}
845
}
846
846
(-)a/src/internet-stack/ipv4-l3-protocol.h (-3 / +3 lines)
 Lines 152-158   public: Link Here 
152
  void SetMetric (uint32_t i, uint16_t metric);
152
  void SetMetric (uint32_t i, uint16_t metric);
153
  uint16_t GetMetric (uint32_t i) const;
153
  uint16_t GetMetric (uint32_t i) const;
154
  bool GetIfIndexForDestination (Ipv4Address destination, 
154
  bool GetIfIndexForDestination (Ipv4Address destination, 
155
                                 uint32_t& ifIndex) const;
155
                                 uint32_t& interfaceIndex) const;
156
  uint16_t GetMtu (uint32_t i) const;
156
  uint16_t GetMtu (uint32_t i) const;
157
  bool IsUp (uint32_t i) const;
157
  bool IsUp (uint32_t i) const;
158
  void SetUp (uint32_t i);
158
  void SetUp (uint32_t i);
 Lines 166-172   protected: Link Here 
166
  virtual void DoDispose (void);
166
  virtual void DoDispose (void);
167
167
168
private:
168
private:
169
  void Lookup (uint32_t ifIndex,
169
  void Lookup (uint32_t interfaceIndex,
170
               Ipv4Header const &ipHeader,
170
               Ipv4Header const &ipHeader,
171
               Ptr<Packet> packet,
171
               Ptr<Packet> packet,
172
               Ipv4RoutingProtocol::RouteReplyCallback routeReply);
172
               Ipv4RoutingProtocol::RouteReplyCallback routeReply);
 Lines 175-181   private: Link Here 
175
                    Ipv4Route const &route,
175
                    Ipv4Route const &route,
176
                    Ptr<Packet> packet,
176
                    Ptr<Packet> packet,
177
                    Ipv4Header const &ipHeader);
177
                    Ipv4Header const &ipHeader);
178
  bool Forwarding (uint32_t ifIndex, 
178
  bool Forwarding (uint32_t interfaceIndex, 
179
                   Ptr<Packet> packet, 
179
                   Ptr<Packet> packet, 
180
                   Ipv4Header &ipHeader, 
180
                   Ipv4Header &ipHeader, 
181
                   Ptr<NetDevice> device);
181
                   Ptr<NetDevice> device);
(-)a/src/internet-stack/ipv4-static-routing.cc (-14 / +16 lines)
 Lines 296-302   Ipv4StaticRouting::LookupStatic ( Link Here 
296
Ipv4StaticRouting::LookupStatic (
296
Ipv4StaticRouting::LookupStatic (
297
  Ipv4Address origin, 
297
  Ipv4Address origin, 
298
  Ipv4Address group,
298
  Ipv4Address group,
299
  uint32_t    ifIndex)
299
  uint32_t    interfaceIndex)
300
{
300
{
301
  NS_LOG_FUNCTION_NOARGS ();
301
  NS_LOG_FUNCTION_NOARGS ();
302
//
302
//
 Lines 317-328   Ipv4StaticRouting::LookupStatic ( Link Here 
317
//
317
//
318
// The first case is the restrictive case where the origin, group and index
318
// The first case is the restrictive case where the origin, group and index
319
// matches.  This picks up exact routes during forwarded and exact routes from
319
// matches.  This picks up exact routes during forwarded and exact routes from
320
// the local node (in which case the ifIndex is a wildcard).
320
// the local node (in which case the interfaceIndex is a wildcard).
321
//
321
//
322
      if (origin == route->GetOrigin () && group == route->GetGroup ())
322
      if (origin == route->GetOrigin () && group == route->GetGroup ())
323
        {
323
        {
324
          if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || 
324
          if (interfaceIndex == Ipv4RoutingProtocol::IF_INDEX_ANY || 
325
              ifIndex == route->GetInputInterface ())
325
              interfaceIndex == route->GetInputInterface ())
326
            {
326
            {
327
              return *i;
327
              return *i;
328
            }
328
            }
 Lines 334-340   Ipv4StaticRouting::LookupStatic ( Link Here 
334
// just happily forward packets we don't really know what to do with.  
334
// just happily forward packets we don't really know what to do with.  
335
// Multicast storms are not generally considered a good thing.
335
// Multicast storms are not generally considered a good thing.
336
//
336
//
337
  if (ifIndex != Ipv4RoutingProtocol::IF_INDEX_ANY)
337
  if (interfaceIndex != Ipv4RoutingProtocol::IF_INDEX_ANY)
338
    {
338
    {
339
      return 0;
339
      return 0;
340
    }
340
    }
 Lines 515-526   Ipv4StaticRouting::RemoveRoute (uint32_t Link Here 
515
515
516
bool
516
bool
517
Ipv4StaticRouting::RequestRoute (
517
Ipv4StaticRouting::RequestRoute (
518
  uint32_t ifIndex,
518
  uint32_t interfaceIndex,
519
  Ipv4Header const &ipHeader,
519
  Ipv4Header const &ipHeader,
520
  Ptr<Packet> packet,
520
  Ptr<Packet> packet,
521
  RouteReplyCallback routeReply)
521
  RouteReplyCallback routeReply)
522
{
522
{
523
  NS_LOG_FUNCTION (this << ifIndex << &ipHeader << packet << &routeReply);
523
  NS_LOG_FUNCTION (this << interfaceIndex << &ipHeader << packet 
524
    << &routeReply);
524
525
525
  NS_LOG_LOGIC ("source = " << ipHeader.GetSource ());
526
  NS_LOG_LOGIC ("source = " << ipHeader.GetSource ());
526
527
 Lines 531-537   Ipv4StaticRouting::RequestRoute ( Link Here 
531
      NS_LOG_LOGIC ("Multicast destination");
532
      NS_LOG_LOGIC ("Multicast destination");
532
533
533
      Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (),
534
      Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (),
534
        ipHeader.GetDestination (), ifIndex);
535
        ipHeader.GetDestination (), interfaceIndex);
535
536
536
      if (mRoute)
537
      if (mRoute)
537
        {
538
        {
 Lines 570-578   Ipv4StaticRouting::RequestRoute ( Link Here 
570
}
571
}
571
572
572
bool
573
bool
573
Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
574
Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, 
574
{
575
  uint32_t& interfaceIndex)
575
  NS_LOG_FUNCTION (this << destination << &ifIndex);
576
{
577
  NS_LOG_FUNCTION (this << destination << &interfaceIndex);
576
//
578
//
577
// First, see if this is a multicast packet we have a route for.  If we
579
// First, see if this is a multicast packet we have a route for.  If we
578
// have a route, then send the packet down each of the specified interfaces.
580
// have a route, then send the packet down each of the specified interfaces.
 Lines 594-601   Ipv4StaticRouting::RequestIfIndex (Ipv4A Link Here 
594
              return false;
596
              return false;
595
            }
597
            }
596
598
597
          ifIndex = mRoute->GetOutputInterface(0);
599
          interfaceIndex = mRoute->GetOutputInterface(0);
598
          NS_LOG_LOGIC ("Found ifIndex " << ifIndex);
600
          NS_LOG_LOGIC ("Found interfaceIndex " << interfaceIndex);
599
          return true;
601
          return true;
600
        }
602
        }
601
      return false; // Let other routing protocols try to handle this
603
      return false; // Let other routing protocols try to handle this
 Lines 607-613   Ipv4StaticRouting::RequestIfIndex (Ipv4A Link Here 
607
  Ipv4Route *route = LookupStatic (destination);
609
  Ipv4Route *route = LookupStatic (destination);
608
  if (route)
610
  if (route)
609
    {
611
    {
610
      ifIndex = route->GetInterface ();
612
      interfaceIndex = route->GetInterface ();
611
      return true;
613
      return true;
612
    }
614
    }
613
  else
615
  else
(-)a/src/internet-stack/ipv4-static-routing.h (-9 / +9 lines)
 Lines 102-109   public: Link Here 
102
 * 
102
 * 
103
 * If the destination address is a multicast, then the exact processing steps
103
 * If the destination address is a multicast, then the exact processing steps
104
 * depend on whether or not the packet has been sourced locally.  This is 
104
 * depend on whether or not the packet has been sourced locally.  This is 
105
 * determined by the parameter ifIndex.  This is the interface index over which
105
 * determined by the parameter interfaceIndex.  This is the interface over 
106
 * this packet was received.  If the packet has not been received over a
106
 * which this packet was received.  If the packet has not been received over a
107
 * network interface, this index will be set to 
107
 * network interface, this index will be set to 
108
 * Ipv4RoutingProtocol::IF_INDEX_ANY (a very large number).  In that case, 
108
 * Ipv4RoutingProtocol::IF_INDEX_ANY (a very large number).  In that case, 
109
 * we want to avoid the requirement that an explicit route out of each node 
109
 * we want to avoid the requirement that an explicit route out of each node 
 Lines 118-126   public: Link Here 
118
 * packet out of as many interfaces as required using the provided callback
118
 * packet out of as many interfaces as required using the provided callback
119
 * (think of it as a pre-packaged send call).
119
 * (think of it as a pre-packaged send call).
120
 *
120
 *
121
 * @param ifIndex The network interface index over which the packed was 
121
 * @param interfaceIndex The IP interface index over which the packed was 
122
 * received.  If the packet is from a local source, ifIndex will be set to
122
 * received.  If the packet is from a local source, interfaceIndex will be 
123
 * Ipv4RoutingProtocol::IF_INDEX_ANY.
123
 * set to Ipv4RoutingProtocol::IF_INDEX_ANY.
124
 * @param ipHeader the Ipv4Header containing the source and destination IP
124
 * @param ipHeader the Ipv4Header containing the source and destination IP
125
 * addresses for the packet.
125
 * addresses for the packet.
126
 * @param packet The packet to be sent if a route is found.
126
 * @param packet The packet to be sent if a route is found.
 Lines 134-140   public: Link Here 
134
 * @see Ipv4StaticRouting
134
 * @see Ipv4StaticRouting
135
 * @see Ipv4RoutingProtocol
135
 * @see Ipv4RoutingProtocol
136
 */
136
 */
137
  virtual bool RequestRoute (uint32_t ifIndex,
137
  virtual bool RequestRoute (uint32_t interfaceIndex,
138
                             Ipv4Header const &ipHeader,
138
                             Ipv4Header const &ipHeader,
139
                             Ptr<Packet> packet,
139
                             Ptr<Packet> packet,
140
                             RouteReplyCallback routeReply);
140
                             RouteReplyCallback routeReply);
 Lines 162-168   public: Link Here 
162
 *
162
 *
163
 * @param destination The Ipv4Address if the destination of a hypothetical 
163
 * @param destination The Ipv4Address if the destination of a hypothetical 
164
 * packet.  This may be a multicast group address.
164
 * packet.  This may be a multicast group address.
165
 * @param ifIndex A reference to the interface index over which a packet
165
 * @param interfaceIndex A reference to the interface index over which a packet
166
 * sent to this destination would be sent.
166
 * sent to this destination would be sent.
167
 * @return Returns true if a route is found to the destination that involves
167
 * @return Returns true if a route is found to the destination that involves
168
 * a single output interface index, otherwise returns false indicating that
168
 * a single output interface index, otherwise returns false indicating that
 Lines 173-179   public: Link Here 
173
 * @see Ipv4RoutingProtocol
173
 * @see Ipv4RoutingProtocol
174
 * @see Ipv4L3Protocol
174
 * @see Ipv4L3Protocol
175
 */
175
 */
176
  virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex);
176
  virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& interfaceIndex);
177
177
178
/**
178
/**
179
 * @brief Add a host route to the static routing table.
179
 * @brief Add a host route to the static routing table.
 Lines 492-498   private: Link Here 
492
492
493
  Ipv4Route *LookupStatic (Ipv4Address dest);
493
  Ipv4Route *LookupStatic (Ipv4Address dest);
494
  Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group,
494
  Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group,
495
                                    uint32_t ifIndex);
495
                                    uint32_t interfaceIndex);
496
496
497
  HostRoutes m_hostRoutes;
497
  HostRoutes m_hostRoutes;
498
  NetworkRoutes m_networkRoutes;
498
  NetworkRoutes m_networkRoutes;
(-)a/src/node/ipv4.h (-34 / +38 lines)
 Lines 76-82   public: Link Here 
76
  /**
76
  /**
77
   * \brief Request that a packet be routed.
77
   * \brief Request that a packet be routed.
78
   *
78
   *
79
   * \param ifIndex The interface index on which the packet was received.
79
   * \param interfaceIndex The Ipv4 interface on which the packet was received.
80
   * \param ipHeader IP header of the packet
80
   * \param ipHeader IP header of the packet
81
   * \param packet packet that is being sent or forwarded
81
   * \param packet packet that is being sent or forwarded
82
   * \param routeReply callback that will receive the route reply
82
   * \param routeReply callback that will receive the route reply
 Lines 111-117   public: Link Here 
111
   * destination will be serviced by cloning the packet and calling the 
111
   * destination will be serviced by cloning the packet and calling the 
112
   * route reply callback once for each outgoing interface in the route.
112
   * route reply callback once for each outgoing interface in the route.
113
   */
113
   */
114
  virtual bool RequestRoute (uint32_t ifIndex,
114
  virtual bool RequestRoute (uint32_t interfaceIndex,
115
                             const Ipv4Header &ipHeader,
115
                             const Ipv4Header &ipHeader,
116
                             Ptr<Packet> packet,
116
                             Ptr<Packet> packet,
117
                             RouteReplyCallback routeReply) = 0;
117
                             RouteReplyCallback routeReply) = 0;
 Lines 129-135   public: Link Here 
129
 * routing protocols for what they would do if presented with a packet of the
129
 * routing protocols for what they would do if presented with a packet of the
130
 * given destination.
130
 * given destination.
131
 *
131
 *
132
 * Note that the a single interface index is returned.  This means that if
132
 * Note that the a single interface index is returned, corresponding to an
133
 * Ipv4Interface index.  This means that if
133
 * the destination address is a multicast, and an explicit route is present
134
 * the destination address is a multicast, and an explicit route is present
134
 * that includeds multiple output interfaces, that route cannot be used.
135
 * that includeds multiple output interfaces, that route cannot be used.
135
 * 
136
 * 
 Lines 139-145   public: Link Here 
139
 *
140
 *
140
 * \param destination The Ipv4Address if the destination of a hypothetical 
141
 * \param destination The Ipv4Address if the destination of a hypothetical 
141
 * packet.  This may be a multicast group address.
142
 * packet.  This may be a multicast group address.
142
 * \param ifIndex A reference to the interface index over which a packet
143
 * \param interfaceIndex A reference to the interface index over which a packet
143
 * sent to this destination would be sent.
144
 * sent to this destination would be sent.
144
 * \return Returns true if a route is found to the destination that involves
145
 * \return Returns true if a route is found to the destination that involves
145
 * a single output interface index, otherwise false.
146
 * a single output interface index, otherwise false.
 Lines 149-167   public: Link Here 
149
 * \see Ipv4L3Protocol
150
 * \see Ipv4L3Protocol
150
 */
151
 */
151
  virtual bool RequestIfIndex (Ipv4Address destination, 
152
  virtual bool RequestIfIndex (Ipv4Address destination, 
152
                              uint32_t& ifIndex) = 0;
153
                              uint32_t& interfaceIndex) = 0;
153
154
154
  static const uint32_t IF_INDEX_ANY = 0xffffffff;
155
  static const uint32_t IF_INDEX_ANY = 0xffffffff;
155
};
156
};
156
157
157
/**
158
/**
158
 * \brief Access to the Ipv4 forwarding table and to the ipv4 interfaces
159
 * \brief Access to the Ipv4 forwarding table and to the Ipv4 interfaces
159
 *
160
 *
160
 * This class allows you to create ipv4 interfaces based on a NetDevice.
161
 * This class allows you to create Ipv4 interfaces based on a NetDevice.
161
 * Multiple interfaces can be created for a single NetDevice, hence
162
 * An Ipv4Interface holds an Ipv4 address for the NetDevice (which
162
 * achieving multihoming.
163
 * does not know about IP).  The interface indices at this layer 
163
 *
164
 * may be different from the NetDevice ifIndex values, to allow for the
164
 * This class also allows you to control the content of the ipv4 
165
 * possibility of having more than one Ipv4Interface map to a NetDevice,
166
 * although presently only one Ipv4Interface may map to a NetDevice.
167
 *
168
 * This class also allows you to control the content of the Ipv4 
165
 * forwarding table.
169
 * forwarding table.
166
 */
170
 */
167
class Ipv4 : public Object
171
class Ipv4 : public Object
 Lines 187-214   public: Link Here 
187
  /**
191
  /**
188
   * \param dest destination address
192
   * \param dest destination address
189
   * \param nextHop address of next hop.
193
   * \param nextHop address of next hop.
190
   * \param interface interface of next hop.
194
   * \param interfaceIndex interface of next hop.
191
   *
195
   *
192
   * Add route to host dest through host nextHop 
196
   * Add route to host dest through host nextHop 
193
   * on interface.
197
   * on interface.
194
   */
198
   */
195
  virtual void AddHostRouteTo (Ipv4Address dest, 
199
  virtual void AddHostRouteTo (Ipv4Address dest, 
196
			       Ipv4Address nextHop, 
200
			       Ipv4Address nextHop, 
197
			       uint32_t interface) = 0;
201
			       uint32_t interfaceIndex) = 0;
198
  /**
202
  /**
199
   * \param dest destination address
203
   * \param dest destination address
200
   * \param interface of next hop
204
   * \param interfaceIndex interface of next hop
201
   *
205
   *
202
   * add route to host dest on interface.
206
   * add route to host dest on interface.
203
   */
207
   */
204
  virtual void AddHostRouteTo (Ipv4Address dest, 
208
  virtual void AddHostRouteTo (Ipv4Address dest, 
205
			       uint32_t interface) = 0;
209
			       uint32_t interfaceIndex) = 0;
206
210
207
  /**
211
  /**
208
   * \param network destination network
212
   * \param network destination network
209
   * \param networkMask netmask of destination network
213
   * \param networkMask netmask of destination network
210
   * \param nextHop address of next hop
214
   * \param nextHop address of next hop
211
   * \param interface interface of next hop
215
   * \param interfaceIndex interface of next hop
212
   * 
216
   * 
213
   * add route to network dest with netmask 
217
   * add route to network dest with netmask 
214
   * through host nextHop on interface
218
   * through host nextHop on interface
 Lines 216-243   public: Link Here 
216
  virtual void AddNetworkRouteTo (Ipv4Address network, 
220
  virtual void AddNetworkRouteTo (Ipv4Address network, 
217
				  Ipv4Mask networkMask, 
221
				  Ipv4Mask networkMask, 
218
				  Ipv4Address nextHop, 
222
				  Ipv4Address nextHop, 
219
				  uint32_t interface) = 0;
223
				  uint32_t interfaceIndex) = 0;
220
224
221
  /**
225
  /**
222
   * \param network destination network
226
   * \param network destination network
223
   * \param networkMask netmask of destination network
227
   * \param networkMask netmask of destination network
224
   * \param interface interface of next hop
228
   * \param interfaceIndex interface of next hop
225
   *
229
   *
226
   * add route to network dest with netmask 
230
   * add route to network dest with netmask 
227
   * on interface
231
   * on interface
228
   */
232
   */
229
  virtual void AddNetworkRouteTo (Ipv4Address network, 
233
  virtual void AddNetworkRouteTo (Ipv4Address network, 
230
				  Ipv4Mask networkMask, 
234
				  Ipv4Mask networkMask, 
231
				  uint32_t interface) = 0;
235
				  uint32_t interfaceIndex) = 0;
232
  /**
236
  /**
233
   * \param nextHop address of default next hop
237
   * \param nextHop address of default next hop
234
   * \param interface interface of default next hop.
238
   * \param interfaceIndex interface of default next hop.
235
   * 
239
   * 
236
   * set the default route to host nextHop on
240
   * set the default route to host nextHop on
237
   * interface. 
241
   * interface. 
238
   */
242
   */
239
  virtual void SetDefaultRoute (Ipv4Address nextHop, 
243
  virtual void SetDefaultRoute (Ipv4Address nextHop, 
240
				uint32_t interface) = 0;
244
				uint32_t interfaceIndex) = 0;
241
245
242
  /**
246
  /**
243
   * \returns the number of entries in the routing table.
247
   * \returns the number of entries in the routing table.
 Lines 306-314   public: Link Here 
306
  virtual void RemoveMulticastRoute (uint32_t i) = 0;
310
  virtual void RemoveMulticastRoute (uint32_t i) = 0;
307
311
308
  /**
312
  /**
309
   * \param device device to add to the list of ipv4 interfaces
313
   * \param device device to add to the list of Ipv4 interfaces
310
   *        which can be used as output interfaces during packet forwarding.
314
   *        which can be used as output interfaces during packet forwarding.
311
   * \returns the index of the ipv4 interface added.
315
   * \returns the index of the Ipv4 interface added.
312
   *
316
   *
313
   * Once a device has been added, it can never be removed: if you want
317
   * Once a device has been added, it can never be removed: if you want
314
   * to disable it, you can invoke Ipv4::SetDown which will
318
   * to disable it, you can invoke Ipv4::SetDown which will
 Lines 322-331   public: Link Here 
322
  virtual uint32_t GetNInterfaces (void) = 0;  
326
  virtual uint32_t GetNInterfaces (void) = 0;  
323
327
324
  /**
328
  /**
325
   * \brief Find and return the interface ID of the interface that has been
329
   * \brief Find and return the interface index of the interface that has been
326
   *        assigned the specified IP address.
330
   *        assigned the specified IP address.
327
   * \param addr The IP address assigned to the interface of interest.
331
   * \param addr The IP address assigned to the interface of interest.
328
   * \returns The index of the ipv4 interface with the given address.
332
   * \returns The index of the Ipv4 interface with the given address.
329
   *
333
   *
330
   * Each IP interface has an IP address associated with it.  It is often 
334
   * Each IP interface has an IP address associated with it.  It is often 
331
   * useful to search the list of interfaces for one that corresponds to 
335
   * useful to search the list of interfaces for one that corresponds to 
 Lines 336-342   public: Link Here 
336
  virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0;
340
  virtual uint32_t FindInterfaceForAddr (Ipv4Address addr) const = 0;
337
341
338
  /**
342
  /**
339
   * \brief Find and return the interface ID of the interface that has been
343
   * \brief Find and return the interface index of the interface that has been
340
   *        assigned the specified (masked) IP address.
344
   *        assigned the specified (masked) IP address.
341
   * \param addr The IP address assigned to the interface of interest.
345
   * \param addr The IP address assigned to the interface of interest.
342
   * \param mask The address mask to be used in address matching.
346
   * \param mask The address mask to be used in address matching.
 Lines 352-358   public: Link Here 
352
    Ipv4Mask mask) const = 0;
356
    Ipv4Mask mask) const = 0;
353
357
354
  /**
358
  /**
355
   * \brief Find and return the interface ID of the interface that has been
359
   * \brief Find and return the interface index of the interface that has been
356
   *        associated with the specified (masked) NetDevice
360
   *        associated with the specified (masked) NetDevice
357
   * \param nd The net device of the interface of interest.
361
   * \param nd The net device of the interface of interest.
358
   * \returns The index of the ipv4 interface associated with the given net 
362
   * \returns The index of the ipv4 interface associated with the given net 
 Lines 367-374   public: Link Here 
367
  virtual int32_t FindInterfaceForDevice(Ptr<NetDevice> nd) const = 0;
371
  virtual int32_t FindInterfaceForDevice(Ptr<NetDevice> nd) const = 0;
368
372
369
  /**
373
  /**
370
   * \param i index of ipv4 interface
374
   * \param i index of Ipv4 interface
371
   * \returns the NetDevice associated with the ipv4 interface index
375
   * \returns the NetDevice associated with the Ipv4 interface index
372
   */
376
   */
373
  virtual Ptr<NetDevice> GetNetDevice (uint32_t i) = 0;
377
  virtual Ptr<NetDevice> GetNetDevice (uint32_t i) = 0;
374
378
 Lines 437-448   public: Link Here 
437
441
438
  /**
442
  /**
439
   * \param dest The IP address of a hypothetical destination.
443
   * \param dest The IP address of a hypothetical destination.
440
   * \param ifIndex filled in with the interface index that will be used to
444
   * \param interfaceIndex filled in with the interface index that will be used to
441
   *        send a packet to the hypothetical destination.
445
   *        send a packet to the hypothetical destination.
442
   * \returns true if a single interface can be identified, false otherwise.
446
   * \returns true if a single interface can be identified, false otherwise.
443
   */
447
   */
444
  virtual bool GetIfIndexForDestination (Ipv4Address dest,
448
  virtual bool GetIfIndexForDestination (Ipv4Address dest,
445
                                         uint32_t &ifIndex) const = 0;
449
                                         uint32_t &interfaceIndex) const = 0;
446
450
447
  /**
451
  /**
448
   * \param i index of ipv4 interface
452
   * \param i index of ipv4 interface
 Lines 475-486   public: Link Here 
475
  virtual void SetDown (uint32_t i) = 0;
479
  virtual void SetDown (uint32_t i) = 0;
476
480
477
  /**
481
  /**
478
   * \brief Convenience function to return the ifIndex corresponding
482
   * \brief Convenience function to return the interfaceIndex corresponding
479
   * to the Ipv4Address provided
483
   * to the Ipv4Address provided
480
   *
484
   *
481
   * \param addr Ipv4Address
485
   * \param addr Ipv4Address
482
   * \param mask corresponding Ipv4Mask
486
   * \param mask corresponding Ipv4Mask
483
   * \returns ifIndex corresponding to a/amask
487
   * \returns interfaceIndex corresponding to a/amask
484
   */
488
   */
485
  virtual uint32_t GetIfIndexByAddress (Ipv4Address addr, 
489
  virtual uint32_t GetIfIndexByAddress (Ipv4Address addr, 
486
    Ipv4Mask mask = Ipv4Mask("255.255.255.255"));
490
    Ipv4Mask mask = Ipv4Mask("255.255.255.255"));
(-)a/src/routing/global-routing/global-router-interface.cc (-19 / +27 lines)
 Lines 560-572   GlobalRouter::DiscoverLSAs (void) Link Here 
560
// Now, we have to find the Ipv4 interface whose netdevice is the one we 
560
// Now, we have to find the Ipv4 interface whose netdevice is the one we 
561
// just found.  This is still the IP on the local side of the channel.  There 
561
// just found.  This is still the IP on the local side of the channel.  There 
562
// is a function to do this used down in the guts of the stack, but it's not 
562
// is a function to do this used down in the guts of the stack, but it's not 
563
// exported so we had to whip up an equivalent.
563
// exported so we had to whip up an equivalent.  This code relies on
564
//
564
// a one-to-one mapping between Ipv4Interface and NetDevice, so if that
565
          uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
565
// relationship ever changes, all of the calls to FindIfIndexForDevice 
566
          Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
566
// in this file may need to change.
567
          Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
567
//
568
          uint32_t interfaceIndexLocal = FindIfIndexForDevice(node, ndLocal);
569
          Ipv4Address addrLocal = 
570
            ipv4Local->GetAddress(interfaceIndexLocal);
571
          Ipv4Mask maskLocal = 
572
            ipv4Local->GetNetworkMask(interfaceIndexLocal);
568
          NS_LOG_LOGIC ("Working with local address " << addrLocal);
573
          NS_LOG_LOGIC ("Working with local address " << addrLocal);
569
          uint16_t metricLocal = ipv4Local->GetMetric (ifIndexLocal);
574
          uint16_t metricLocal = ipv4Local->GetMetric (interfaceIndexLocal);
570
//
575
//
571
// Now, we're going to walk over to the remote net device on the other end of 
576
// Now, we're going to walk over to the remote net device on the other end of 
572
// the point-to-point channel we now know we have.  This is where our adjacent 
577
// the point-to-point channel we now know we have.  This is where our adjacent 
 Lines 623-637   GlobalRouter::DiscoverLSAs (void) Link Here 
623
// is a function to do this used down in the guts of the stack, but it's not 
628
// is a function to do this used down in the guts of the stack, but it's not 
624
// exported so we had to whip up an equivalent.
629
// exported so we had to whip up an equivalent.
625
//
630
//
626
          uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
631
          uint32_t interfaceIndexLocal = FindIfIndexForDevice(node, ndLocal);
627
//
632
//
628
// Now that we have the Ipv4 interface index, we can get the address and mask
633
// Now that we have the Ipv4 interface index, we can get the address and mask
629
// we need.
634
// we need.
630
//
635
//
631
          Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
636
          Ipv4Address addrLocal = 
632
          Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
637
            ipv4Local->GetAddress(interfaceIndexLocal);
638
          Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(interfaceIndexLocal);
633
          NS_LOG_LOGIC ("Working with local address " << addrLocal);
639
          NS_LOG_LOGIC ("Working with local address " << addrLocal);
634
          uint16_t metricLocal = ipv4Local->GetMetric (ifIndexLocal);
640
          uint16_t metricLocal = ipv4Local->GetMetric (interfaceIndexLocal);
635
//
641
//
636
// Now, we're going to walk over to the remote net device on the other end of 
642
// Now, we're going to walk over to the remote net device on the other end of 
637
// the point-to-point channel we now know we have.  This is where our adjacent 
643
// the point-to-point channel we now know we have.  This is where our adjacent 
 Lines 665-677   GlobalRouter::DiscoverLSAs (void) Link Here 
665
// Now, just like we did above, we need to get the IP interface index for the 
671
// Now, just like we did above, we need to get the IP interface index for the 
666
// net device on the other end of the point-to-point channel.
672
// net device on the other end of the point-to-point channel.
667
//
673
//
668
          uint32_t ifIndexRemote = FindIfIndexForDevice(nodeRemote, ndRemote);
674
          uint32_t interfaceIndexRemote = FindIfIndexForDevice(nodeRemote, ndRemote);
669
//
675
//
670
// Now that we have the Ipv4 interface, we can get the (remote) address and
676
// Now that we have the Ipv4 interface, we can get the (remote) address and
671
// mask we need.
677
// mask we need.
672
//
678
//
673
          Ipv4Address addrRemote = ipv4Remote->GetAddress(ifIndexRemote);
679
          Ipv4Address addrRemote = 
674
          Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(ifIndexRemote);
680
            ipv4Remote->GetAddress(interfaceIndexRemote);
681
          Ipv4Mask maskRemote = 
682
            ipv4Remote->GetNetworkMask(interfaceIndexRemote);
675
          NS_LOG_LOGIC ("Working with remote address " << addrRemote);
683
          NS_LOG_LOGIC ("Working with remote address " << addrRemote);
676
//
684
//
677
// Now we can fill out the link records for this link.  There are always two
685
// Now we can fill out the link records for this link.  There are always two
 Lines 714-722   GlobalRouter::DiscoverLSAs (void) Link Here 
714
        {
722
        {
715
// Build one NetworkLSA for each interface that is a DR
723
// Build one NetworkLSA for each interface that is a DR
716
          Ptr<NetDevice> ndLocal = *i;
724
          Ptr<NetDevice> ndLocal = *i;
717
          uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
725
          uint32_t interfaceIndexLocal = FindIfIndexForDevice(node, ndLocal);
718
          Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
726
          Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceIndexLocal);
719
          Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
727
          Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(interfaceIndexLocal);
720
728
721
          GlobalRoutingLSA *pLSA = new GlobalRoutingLSA;
729
          GlobalRoutingLSA *pLSA = new GlobalRoutingLSA;
722
          pLSA->SetLSType (GlobalRoutingLSA::NetworkLSA);
730
          pLSA->SetLSType (GlobalRoutingLSA::NetworkLSA);
 Lines 751-761   GlobalRouter::FindDesignatedRouterForLin Link Here 
751
GlobalRouter::FindDesignatedRouterForLink (Ptr<Node> node, 
759
GlobalRouter::FindDesignatedRouterForLink (Ptr<Node> node, 
752
  Ptr<NetDevice> ndLocal) const
760
  Ptr<NetDevice> ndLocal) const
753
{
761
{
754
  uint32_t ifIndexLocal = FindIfIndexForDevice(node, ndLocal);
762
  uint32_t interfaceIndexLocal = FindIfIndexForDevice(node, ndLocal);
755
  Ptr<Ipv4> ipv4Local = GetObject<Ipv4> ();
763
  Ptr<Ipv4> ipv4Local = GetObject<Ipv4> ();
756
  NS_ASSERT (ipv4Local);
764
  NS_ASSERT (ipv4Local);
757
  Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
765
  Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceIndexLocal);
758
  Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
766
  Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(interfaceIndexLocal);
759
767
760
  Ptr<Channel> ch = ndLocal->GetChannel();
768
  Ptr<Channel> ch = ndLocal->GetChannel();
761
  uint32_t nDevices = ch->GetNDevices();
769
  uint32_t nDevices = ch->GetNDevices();
(-)a/src/routing/olsr/routing-table.cc (-3 / +3 lines)
 Lines 105-111   RoutingTable::FindSendEntry (RoutingTabl Link Here 
105
105
106
106
107
bool
107
bool
108
RoutingTable::RequestRoute (uint32_t ifIndex,
108
RoutingTable::RequestRoute (uint32_t interfaceIndex,
109
                            const Ipv4Header &ipHeader,
109
                            const Ipv4Header &ipHeader,
110
                            Ptr<Packet> packet,
110
                            Ptr<Packet> packet,
111
                            RouteReplyCallback routeReply)
111
                            RouteReplyCallback routeReply)
 Lines 149-155   RoutingTable::RequestRoute (uint32_t ifI Link Here 
149
149
150
bool
150
bool
151
RoutingTable::RequestIfIndex (Ipv4Address destination,
151
RoutingTable::RequestIfIndex (Ipv4Address destination,
152
                              uint32_t& ifIndex)
152
                              uint32_t& interfaceIndex)
153
{
153
{
154
  RoutingTableEntry entry1, entry2;
154
  RoutingTableEntry entry1, entry2;
155
  if (Lookup (destination, entry1))
155
  if (Lookup (destination, entry1))
 Lines 157-163   RoutingTable::RequestIfIndex (Ipv4Addres Link Here 
157
      bool foundSendEntry = FindSendEntry (entry1, entry2);
157
      bool foundSendEntry = FindSendEntry (entry1, entry2);
158
      if (!foundSendEntry)
158
      if (!foundSendEntry)
159
        NS_FATAL_ERROR ("FindSendEntry failure");
159
        NS_FATAL_ERROR ("FindSendEntry failure");
160
      ifIndex = entry2.interface;
160
      interfaceIndex = entry2.interface;
161
      return true;
161
      return true;
162
    }
162
    }
163
  else
163
  else
(-)a/src/routing/olsr/routing-table.h (-2 / +2 lines)
 Lines 97-108   public: Link Here 
97
                      RoutingTableEntry &outEntry) const;
97
                      RoutingTableEntry &outEntry) const;
98
98
99
  // From Ipv4RoutingProtocol
99
  // From Ipv4RoutingProtocol
100
  virtual bool RequestRoute (uint32_t ifIndex,
100
  virtual bool RequestRoute (uint32_t interfaceIndex,
101
                             const Ipv4Header &ipHeader,
101
                             const Ipv4Header &ipHeader,
102
                             Ptr<Packet> packet,
102
                             Ptr<Packet> packet,
103
                             RouteReplyCallback routeReply);
103
                             RouteReplyCallback routeReply);
104
  virtual bool RequestIfIndex (Ipv4Address destination, 
104
  virtual bool RequestIfIndex (Ipv4Address destination, 
105
                               uint32_t& ifIndex);
105
                               uint32_t& interfaceIndex);
106
106
107
};
107
};
108
108

Return to bug 85