Ipv4::ifIndex -> Ipv4::interface
This commit is contained in:
@@ -76,7 +76,7 @@ The main function that must be supported by these protocols is called
|
||||
* immediately after the IP header, although most routing do not
|
||||
* insert any extra header.
|
||||
*/
|
||||
virtual bool RequestRoute (uint32_t ifIndex,
|
||||
virtual bool RequestRoute (uint32_t interface,
|
||||
const Ipv4Header &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply) = 0;
|
||||
@@ -118,7 +118,7 @@ routing, insert it with priority less than 0; e.g.:
|
||||
The main function for obtaining a route is shown below:
|
||||
@verbatim
|
||||
Ipv4L3Protocol::Lookup (
|
||||
uint32_t ifIndex,
|
||||
uint32_t interface,
|
||||
Ipv4Header const &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4RoutingProtocol::RouteReplyCallback routeReply)
|
||||
|
||||
@@ -131,19 +131,19 @@ Ipv4AddressHelper::Assign (const NetDeviceContainer &c)
|
||||
Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> ();
|
||||
NS_ASSERT_MSG (ipv4, "Ipv4AddressHelper::Allocate(): Bad ipv4");
|
||||
|
||||
int32_t ifIndex = ipv4->FindInterfaceForDevice (device);
|
||||
if (ifIndex == -1)
|
||||
int32_t interface = ipv4->FindInterfaceForDevice (device);
|
||||
if (interface == -1)
|
||||
{
|
||||
ifIndex = ipv4->AddInterface (device);
|
||||
interface = ipv4->AddInterface (device);
|
||||
}
|
||||
NS_ASSERT_MSG (ifIndex >= 0, "Ipv4AddressHelper::Allocate(): "
|
||||
NS_ASSERT_MSG (interface >= 0, "Ipv4AddressHelper::Allocate(): "
|
||||
"Interface index not found");
|
||||
|
||||
ipv4->SetAddress (ifIndex, NewAddress ());
|
||||
ipv4->SetNetworkMask (ifIndex, m_mask);
|
||||
ipv4->SetMetric (ifIndex, 1);
|
||||
ipv4->SetUp (ifIndex);
|
||||
retval.Add (ipv4, ifIndex);
|
||||
ipv4->SetAddress (interface, NewAddress ());
|
||||
ipv4->SetNetworkMask (interface, m_mask);
|
||||
ipv4->SetMetric (interface, 1);
|
||||
ipv4->SetUp (interface);
|
||||
retval.Add (ipv4, interface);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -42,16 +42,16 @@ StaticMulticastRouteHelper::AddMulticastRoute (
|
||||
{
|
||||
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
|
||||
|
||||
// We need to convert the NetDeviceContainer to an array of ifIndex
|
||||
// We need to convert the NetDeviceContainer to an array of interface
|
||||
std::vector<uint32_t> outputInterfaces;
|
||||
for (NetDeviceContainer::Iterator i = output.Begin (); i != output.End (); ++i)
|
||||
{
|
||||
Ptr<NetDevice> nd = *i;
|
||||
uint32_t oifIndex = ipv4->FindInterfaceForDevice (nd);
|
||||
outputInterfaces.push_back(oifIndex);
|
||||
uint32_t ointerface = ipv4->FindInterfaceForDevice (nd);
|
||||
outputInterfaces.push_back(ointerface);
|
||||
}
|
||||
uint32_t iifIndex = ipv4->FindInterfaceForDevice (input);
|
||||
ipv4->AddMulticastRoute (source, group, iifIndex, outputInterfaces);
|
||||
uint32_t iinterface = ipv4->FindInterfaceForDevice (input);
|
||||
ipv4->AddMulticastRoute (source, group, iinterface, outputInterfaces);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -97,8 +97,8 @@ StaticMulticastRouteHelper::SetDefaultMulticastRoute (
|
||||
Ptr<NetDevice> nd)
|
||||
{
|
||||
Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
|
||||
uint32_t ifIndexSrc = ipv4->FindInterfaceForDevice (nd);
|
||||
ipv4->SetDefaultMulticastRoute (ifIndexSrc);
|
||||
uint32_t interfaceSrc = ipv4->FindInterfaceForDevice (nd);
|
||||
ipv4->SetDefaultMulticastRoute (interfaceSrc);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -63,7 +63,7 @@ Icmpv4L4Protocol::SendMessage (Ptr<Packet> packet, Ipv4Address dest, uint8_t typ
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
|
||||
uint32_t i;
|
||||
if (!ipv4->GetIfIndexForDestination (dest, i))
|
||||
if (!ipv4->GetInterfaceForDestination (dest, i))
|
||||
{
|
||||
NS_LOG_WARN ("drop icmp message");
|
||||
return;
|
||||
|
||||
@@ -209,12 +209,12 @@ Ipv4GlobalRouting::RemoveRoute (uint32_t index)
|
||||
|
||||
bool
|
||||
Ipv4GlobalRouting::RequestRoute (
|
||||
uint32_t ifIndex,
|
||||
uint32_t interface,
|
||||
Ipv4Header const &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ifIndex << &ipHeader << packet << &routeReply);
|
||||
NS_LOG_FUNCTION (this << interface << &ipHeader << packet << &routeReply);
|
||||
|
||||
NS_LOG_LOGIC ("source = " << ipHeader.GetSource ());
|
||||
|
||||
@@ -243,9 +243,9 @@ Ipv4GlobalRouting::RequestRoute (
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4GlobalRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
|
||||
Ipv4GlobalRouting::RequestInterface (Ipv4Address destination, uint32_t& interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << destination << &ifIndex);
|
||||
NS_LOG_FUNCTION (this << destination << &interface);
|
||||
//
|
||||
// First, see if this is a multicast packet we have a route for. If we
|
||||
// have a route, then send the packet down each of the specified interfaces.
|
||||
@@ -262,7 +262,7 @@ Ipv4GlobalRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
|
||||
Ipv4Route *route = LookupGlobal (destination);
|
||||
if (route)
|
||||
{
|
||||
ifIndex = route->GetInterface ();
|
||||
interface = route->GetInterface ();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -92,9 +92,9 @@ public:
|
||||
* If the destination address is a multicast, then the method will return
|
||||
* false.
|
||||
*
|
||||
* @param ifIndex The network interface index over which the packed was
|
||||
* received. If the packet is from a local source, ifIndex will be set to
|
||||
* Ipv4RoutingProtocol::IF_INDEX_ANY.
|
||||
* @param interface The network interface index over which the packed was
|
||||
* received. If the packet is from a local source, interface will be set to
|
||||
* Ipv4RoutingProtocol::INTERFACE_INDEX_ANY.
|
||||
* @param ipHeader the Ipv4Header containing the source and destination IP
|
||||
* addresses for the packet.
|
||||
* @param packet The packet to be sent if a route is found.
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
* @see Ipv4GlobalRouting
|
||||
* @see Ipv4RoutingProtocol
|
||||
*/
|
||||
virtual bool RequestRoute (uint32_t ifIndex,
|
||||
virtual bool RequestRoute (uint32_t interface,
|
||||
Ipv4Header const &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply);
|
||||
@@ -126,14 +126,14 @@ public:
|
||||
* given destination.
|
||||
*
|
||||
* If there are multiple paths out of the node, the resolution is performed
|
||||
* by Ipv4L3Protocol::GetIfIndexforDestination which has access to more
|
||||
* by Ipv4L3Protocol::GetInterfaceforDestination which has access to more
|
||||
* contextual information that is useful for making a determination.
|
||||
*
|
||||
* This method will return false on a multicast address.
|
||||
*
|
||||
* @param destination The Ipv4Address if the destination of a hypothetical
|
||||
* packet. This may be a multicast group address.
|
||||
* @param ifIndex A reference to the interface index over which a packet
|
||||
* @param interface A reference to the interface index over which a packet
|
||||
* sent to this destination would be sent.
|
||||
* @return Returns true if a route is found to the destination that involves
|
||||
* a single output interface index, otherwise returns false indicating that
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
* @see Ipv4RoutingProtocol
|
||||
* @see Ipv4L3Protocol
|
||||
*/
|
||||
virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex);
|
||||
virtual bool RequestInterface (Ipv4Address destination, uint32_t& interface);
|
||||
|
||||
/**
|
||||
* @brief Add a host route to the global routing table.
|
||||
|
||||
@@ -224,21 +224,21 @@ Ipv4Impl::GetMetric (uint32_t i) const
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4Impl::GetIfIndexForDestination (Ipv4Address dest, uint32_t &ifIndex) const
|
||||
Ipv4Impl::GetInterfaceForDestination (Ipv4Address dest, uint32_t &interface) const
|
||||
{
|
||||
return m_ipv4->GetIfIndexForDestination (dest, ifIndex);
|
||||
return m_ipv4->GetInterfaceForDestination (dest, interface);
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
Ipv4Impl::GetSourceAddress (Ipv4Address destination) const
|
||||
{
|
||||
uint32_t ifIndex = 0xffffffff;
|
||||
uint32_t interface = 0xffffffff;
|
||||
|
||||
bool result = m_ipv4->GetIfIndexForDestination (destination, ifIndex);
|
||||
bool result = m_ipv4->GetInterfaceForDestination (destination, interface);
|
||||
|
||||
if (result)
|
||||
{
|
||||
return m_ipv4->GetAddress (ifIndex);
|
||||
return m_ipv4->GetAddress (interface);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -94,8 +94,8 @@ public:
|
||||
virtual void SetMetric (uint32_t i, uint16_t metric);
|
||||
virtual uint16_t GetMetric (uint32_t i) const;
|
||||
virtual Ipv4Address GetSourceAddress (Ipv4Address destination) const;
|
||||
virtual bool GetIfIndexForDestination (Ipv4Address dest,
|
||||
uint32_t &ifIndex) const;
|
||||
virtual bool GetInterfaceForDestination (Ipv4Address dest,
|
||||
uint32_t &interface) const;
|
||||
|
||||
virtual uint16_t GetMtu (uint32_t i) const;
|
||||
virtual bool IsUp (uint32_t i) const;
|
||||
|
||||
@@ -242,17 +242,17 @@ Ipv4L3Protocol::Lookup (
|
||||
{
|
||||
NS_LOG_FUNCTION (this << &ipHeader << packet << &routeReply);
|
||||
|
||||
Lookup (Ipv4RoutingProtocol::IF_INDEX_ANY, ipHeader, packet, routeReply);
|
||||
Lookup (Ipv4RoutingProtocol::INTERFACE_ANY, ipHeader, packet, routeReply);
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4L3Protocol::Lookup (
|
||||
uint32_t ifIndex,
|
||||
uint32_t interface,
|
||||
Ipv4Header const &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4RoutingProtocol::RouteReplyCallback routeReply)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ifIndex << &ipHeader << packet << &routeReply);
|
||||
NS_LOG_FUNCTION (this << interface << &ipHeader << packet << &routeReply);
|
||||
|
||||
for (Ipv4RoutingProtocolList::const_iterator rprotoIter =
|
||||
m_routingProtocols.begin ();
|
||||
@@ -260,13 +260,13 @@ Ipv4L3Protocol::Lookup (
|
||||
rprotoIter++)
|
||||
{
|
||||
NS_LOG_LOGIC ("Requesting route");
|
||||
if ((*rprotoIter).second->RequestRoute (ifIndex, ipHeader, packet,
|
||||
if ((*rprotoIter).second->RequestRoute (interface, ipHeader, packet,
|
||||
routeReply))
|
||||
return;
|
||||
}
|
||||
|
||||
if (ipHeader.GetDestination ().IsMulticast () &&
|
||||
ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY)
|
||||
interface == Ipv4RoutingProtocol::INTERFACE_ANY)
|
||||
{
|
||||
NS_LOG_LOGIC ("Multicast destination with local source");
|
||||
//
|
||||
@@ -432,14 +432,14 @@ Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << addr);
|
||||
|
||||
uint32_t ifIndex = 0;
|
||||
uint32_t interface = 0;
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
|
||||
i != m_interfaces.end ();
|
||||
i++, ifIndex++)
|
||||
i++, interface++)
|
||||
{
|
||||
if ((*i)->GetAddress () == addr)
|
||||
{
|
||||
return ifIndex;
|
||||
return interface;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,14 +453,14 @@ Ipv4L3Protocol::FindInterfaceForAddr (Ipv4Address addr, Ipv4Mask mask) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << addr << mask);
|
||||
|
||||
uint32_t ifIndex = 0;
|
||||
uint32_t interface = 0;
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
|
||||
i != m_interfaces.end ();
|
||||
i++, ifIndex++)
|
||||
i++, interface++)
|
||||
{
|
||||
if ((*i)->GetAddress ().CombineMask (mask) == addr.CombineMask (mask))
|
||||
{
|
||||
return ifIndex;
|
||||
return interface;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,14 +474,14 @@ Ipv4L3Protocol::FindInterfaceIndexForDevice (Ptr<NetDevice> device) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << device);
|
||||
|
||||
uint32_t ifIndex = 0;
|
||||
uint32_t interface = 0;
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
|
||||
i != m_interfaces.end ();
|
||||
i++, ifIndex++)
|
||||
i++, interface++)
|
||||
{
|
||||
if ((*i)->GetDevice () == device)
|
||||
{
|
||||
return ifIndex;
|
||||
return interface;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,12 +777,12 @@ Ipv4L3Protocol::SendRealOut (bool found,
|
||||
|
||||
bool
|
||||
Ipv4L3Protocol::Forwarding (
|
||||
uint32_t ifIndex,
|
||||
uint32_t interface,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4Header &ipHeader,
|
||||
Ptr<NetDevice> device)
|
||||
{
|
||||
NS_LOG_FUNCTION (ifIndex << packet << &ipHeader<< device);
|
||||
NS_LOG_FUNCTION (interface << packet << &ipHeader<< device);
|
||||
NS_LOG_LOGIC ("Forwarding logic for node: " << m_node->GetId ());
|
||||
|
||||
for (Ipv4InterfaceList::const_iterator i = m_interfaces.begin ();
|
||||
@@ -835,26 +835,26 @@ Ipv4L3Protocol::Forwarding (
|
||||
// We forward with a packet copy, since forwarding may change
|
||||
// the packet, affecting our local delivery
|
||||
NS_LOG_LOGIC ("Forwarding (multicast).");
|
||||
DoForward (ifIndex, packet->Copy (), ipHeader);
|
||||
DoForward (interface, packet->Copy (), ipHeader);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DoForward (ifIndex, packet, ipHeader);
|
||||
DoForward (interface, packet, ipHeader);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4L3Protocol::DoForward (uint32_t ifIndex,
|
||||
Ipv4L3Protocol::DoForward (uint32_t interface,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4Header ipHeader)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ifIndex << packet << ipHeader);
|
||||
NS_LOG_FUNCTION (this << interface << packet << ipHeader);
|
||||
|
||||
ipHeader.SetTtl (ipHeader.GetTtl () - 1);
|
||||
if (ipHeader.GetTtl () == 0)
|
||||
{
|
||||
if (IsUnicast (ipHeader.GetDestination (), GetInterface (ifIndex)->GetNetworkMask ()))
|
||||
if (IsUnicast (ipHeader.GetDestination (), GetInterface (interface)->GetNetworkMask ()))
|
||||
{
|
||||
Ptr<Icmpv4L4Protocol> icmp = GetIcmp ();
|
||||
icmp->SendTimeExceededTtl (ipHeader, packet);
|
||||
@@ -864,7 +864,7 @@ Ipv4L3Protocol::DoForward (uint32_t ifIndex,
|
||||
return;
|
||||
}
|
||||
NS_LOG_LOGIC ("Not for me, forwarding.");
|
||||
Lookup (ifIndex, ipHeader, packet,
|
||||
Lookup (interface, ipHeader, packet,
|
||||
MakeCallback (&Ipv4L3Protocol::SendRealOut, this));
|
||||
}
|
||||
|
||||
@@ -972,10 +972,10 @@ Ipv4L3Protocol::GetMetric (uint32_t i) const
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4L3Protocol::GetIfIndexForDestination (
|
||||
Ipv4Address destination, uint32_t& ifIndex) const
|
||||
Ipv4L3Protocol::GetInterfaceForDestination (
|
||||
Ipv4Address destination, uint32_t& interface) const
|
||||
{
|
||||
NS_LOG_FUNCTION (this << destination << &ifIndex);
|
||||
NS_LOG_FUNCTION (this << destination << &interface);
|
||||
//
|
||||
// The first thing we do in trying to determine a source address is to
|
||||
// consult the routing protocols. These will also check for a default route
|
||||
@@ -986,12 +986,12 @@ Ipv4L3Protocol::GetIfIndexForDestination (
|
||||
i++)
|
||||
{
|
||||
NS_LOG_LOGIC ("Requesting Source Address");
|
||||
uint32_t ifIndexTmp;
|
||||
uint32_t interfaceTmp;
|
||||
|
||||
if ((*i).second->RequestIfIndex (destination, ifIndexTmp))
|
||||
if ((*i).second->RequestInterface (destination, interfaceTmp))
|
||||
{
|
||||
NS_LOG_LOGIC ("Found ifIndex " << ifIndexTmp);
|
||||
ifIndex = ifIndexTmp;
|
||||
NS_LOG_LOGIC ("Found interface " << interfaceTmp);
|
||||
interface = interfaceTmp;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1007,7 +1007,7 @@ Ipv4L3Protocol::GetIfIndexForDestination (
|
||||
if (GetNInterfaces () == 2)
|
||||
{
|
||||
NS_LOG_LOGIC ("One Interface. Using interface 1.");
|
||||
ifIndex = 1;
|
||||
interface = 1;
|
||||
return true;
|
||||
}
|
||||
//
|
||||
@@ -1030,14 +1030,14 @@ Ipv4L3Protocol::GetIfIndexForDestination (
|
||||
|
||||
if (route == NULL)
|
||||
{
|
||||
NS_LOG_LOGIC ("Ipv4L3Protocol::GetIfIndexForDestination (): "
|
||||
NS_LOG_LOGIC ("Ipv4L3Protocol::GetInterfaceForDestination (): "
|
||||
"Unable to determine outbound interface. No default route set");
|
||||
return false;
|
||||
}
|
||||
|
||||
ifIndex = route->GetInterface ();
|
||||
interface = route->GetInterface ();
|
||||
|
||||
NS_LOG_LOGIC ("Default route specifies interface " << ifIndex);
|
||||
NS_LOG_LOGIC ("Default route specifies interface " << interface);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +193,8 @@ public:
|
||||
Ipv4Address GetAddress (uint32_t i) const;
|
||||
void SetMetric (uint32_t i, uint16_t metric);
|
||||
uint16_t GetMetric (uint32_t i) const;
|
||||
bool GetIfIndexForDestination (Ipv4Address destination,
|
||||
uint32_t& ifIndex) const;
|
||||
bool GetInterfaceForDestination (Ipv4Address destination,
|
||||
uint32_t& interface) const;
|
||||
uint16_t GetMtu (uint32_t i) const;
|
||||
bool IsUp (uint32_t i) const;
|
||||
void SetUp (uint32_t i);
|
||||
@@ -210,7 +210,7 @@ protected:
|
||||
private:
|
||||
Ipv4L3Protocol(const Ipv4L3Protocol &);
|
||||
Ipv4L3Protocol &operator = (const Ipv4L3Protocol &);
|
||||
void Lookup (uint32_t ifIndex,
|
||||
void Lookup (uint32_t interface,
|
||||
Ipv4Header const &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4RoutingProtocol::RouteReplyCallback routeReply);
|
||||
@@ -219,7 +219,7 @@ private:
|
||||
Ipv4Route const &route,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4Header const &ipHeader);
|
||||
bool Forwarding (uint32_t ifIndex,
|
||||
bool Forwarding (uint32_t interface,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4Header &ipHeader,
|
||||
Ptr<NetDevice> device);
|
||||
@@ -228,7 +228,7 @@ private:
|
||||
void SetupLoopback (void);
|
||||
Ptr<Icmpv4L4Protocol> GetIcmp (void) const;
|
||||
bool IsUnicast (Ipv4Address ad, Ipv4Mask interfaceMask) const;
|
||||
void DoForward (uint32_t ifIndex,
|
||||
void DoForward (uint32_t interface,
|
||||
Ptr<Packet> packet,
|
||||
Ipv4Header ipHeader);
|
||||
|
||||
|
||||
@@ -170,10 +170,10 @@ Ipv4RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags,
|
||||
InetSocketAddress ad = InetSocketAddress::ConvertFrom (toAddress);
|
||||
Ptr<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
|
||||
Ipv4Address dst = ad.GetIpv4 ();
|
||||
uint32_t localIfIndex;
|
||||
if (ipv4->GetIfIndexForDestination(dst, localIfIndex))
|
||||
uint32_t localInterface;
|
||||
if (ipv4->GetInterfaceForDestination(dst, localInterface))
|
||||
{
|
||||
ipv4->Send (p, ipv4->GetAddress (localIfIndex), dst, m_protocol);
|
||||
ipv4->Send (p, ipv4->GetAddress (localInterface), dst, m_protocol);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ Ipv4StaticRouting::SetDefaultMulticastRoute(uint32_t outputInterface)
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
Ipv4Address origin = Ipv4Address::GetAny ();
|
||||
Ipv4Address group = Ipv4Address::GetAny ();
|
||||
uint32_t inputInterface = Ipv4RoutingProtocol::IF_INDEX_ANY;
|
||||
uint32_t inputInterface = Ipv4RoutingProtocol::INTERFACE_ANY;
|
||||
|
||||
std::vector<uint32_t> outputInterfaces (1);
|
||||
outputInterfaces[0] = outputInterface;
|
||||
@@ -296,7 +296,7 @@ Ipv4MulticastRoute *
|
||||
Ipv4StaticRouting::LookupStatic (
|
||||
Ipv4Address origin,
|
||||
Ipv4Address group,
|
||||
uint32_t ifIndex)
|
||||
uint32_t interface)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
//
|
||||
@@ -317,12 +317,12 @@ Ipv4StaticRouting::LookupStatic (
|
||||
//
|
||||
// The first case is the restrictive case where the origin, group and index
|
||||
// matches. This picks up exact routes during forwarded and exact routes from
|
||||
// the local node (in which case the ifIndex is a wildcard).
|
||||
// the local node (in which case the interface is a wildcard).
|
||||
//
|
||||
if (origin == route->GetOrigin () && group == route->GetGroup ())
|
||||
{
|
||||
if (ifIndex == Ipv4RoutingProtocol::IF_INDEX_ANY ||
|
||||
ifIndex == route->GetInputInterface ())
|
||||
if (interface == Ipv4RoutingProtocol::INTERFACE_ANY ||
|
||||
interface == route->GetInputInterface ())
|
||||
{
|
||||
return *i;
|
||||
}
|
||||
@@ -334,7 +334,7 @@ Ipv4StaticRouting::LookupStatic (
|
||||
// just happily forward packets we don't really know what to do with.
|
||||
// Multicast storms are not generally considered a good thing.
|
||||
//
|
||||
if (ifIndex != Ipv4RoutingProtocol::IF_INDEX_ANY)
|
||||
if (interface != Ipv4RoutingProtocol::INTERFACE_ANY)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -515,12 +515,12 @@ Ipv4StaticRouting::RemoveRoute (uint32_t index)
|
||||
|
||||
bool
|
||||
Ipv4StaticRouting::RequestRoute (
|
||||
uint32_t ifIndex,
|
||||
uint32_t interface,
|
||||
Ipv4Header const &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << ifIndex << &ipHeader << packet << &routeReply);
|
||||
NS_LOG_FUNCTION (this << interface << &ipHeader << packet << &routeReply);
|
||||
|
||||
NS_LOG_LOGIC ("source = " << ipHeader.GetSource ());
|
||||
|
||||
@@ -531,7 +531,7 @@ Ipv4StaticRouting::RequestRoute (
|
||||
NS_LOG_LOGIC ("Multicast destination");
|
||||
|
||||
Ipv4MulticastRoute *mRoute = LookupStatic(ipHeader.GetSource (),
|
||||
ipHeader.GetDestination (), ifIndex);
|
||||
ipHeader.GetDestination (), interface);
|
||||
|
||||
if (mRoute)
|
||||
{
|
||||
@@ -570,9 +570,9 @@ Ipv4StaticRouting::RequestRoute (
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
|
||||
Ipv4StaticRouting::RequestInterface (Ipv4Address destination, uint32_t& interface)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << destination << &ifIndex);
|
||||
NS_LOG_FUNCTION (this << destination << &interface);
|
||||
//
|
||||
// First, see if this is a multicast packet we have a route for. If we
|
||||
// have a route, then send the packet down each of the specified interfaces.
|
||||
@@ -582,7 +582,7 @@ Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
|
||||
NS_LOG_LOGIC ("Multicast destination");
|
||||
|
||||
Ipv4MulticastRoute *mRoute = LookupStatic(Ipv4Address::GetAny (),
|
||||
destination, Ipv4RoutingProtocol::IF_INDEX_ANY);
|
||||
destination, Ipv4RoutingProtocol::INTERFACE_ANY);
|
||||
|
||||
if (mRoute)
|
||||
{
|
||||
@@ -594,8 +594,8 @@ Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
|
||||
return false;
|
||||
}
|
||||
|
||||
ifIndex = mRoute->GetOutputInterface(0);
|
||||
NS_LOG_LOGIC ("Found ifIndex " << ifIndex);
|
||||
interface = mRoute->GetOutputInterface(0);
|
||||
NS_LOG_LOGIC ("Found interface " << interface);
|
||||
return true;
|
||||
}
|
||||
return false; // Let other routing protocols try to handle this
|
||||
@@ -607,7 +607,7 @@ Ipv4StaticRouting::RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex)
|
||||
Ipv4Route *route = LookupStatic (destination);
|
||||
if (route)
|
||||
{
|
||||
ifIndex = route->GetInterface ();
|
||||
interface = route->GetInterface ();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -102,10 +102,10 @@ public:
|
||||
*
|
||||
* If the destination address is a multicast, then the exact processing steps
|
||||
* depend on whether or not the packet has been sourced locally. This is
|
||||
* determined by the parameter ifIndex. This is the interface index over which
|
||||
* determined by the parameter interface. This is the interface index over which
|
||||
* this packet was received. If the packet has not been received over a
|
||||
* network interface, this index will be set to
|
||||
* Ipv4RoutingProtocol::IF_INDEX_ANY (a very large number). In that case,
|
||||
* Ipv4RoutingProtocol::INTERFACE_INDEX_ANY (a very large number). In that case,
|
||||
* we want to avoid the requirement that an explicit route out of each node
|
||||
* must be set, so we don't do anything here.
|
||||
*
|
||||
@@ -118,9 +118,9 @@ public:
|
||||
* packet out of as many interfaces as required using the provided callback
|
||||
* (think of it as a pre-packaged send call).
|
||||
*
|
||||
* @param ifIndex The network interface index over which the packed was
|
||||
* received. If the packet is from a local source, ifIndex will be set to
|
||||
* Ipv4RoutingProtocol::IF_INDEX_ANY.
|
||||
* @param interface The network interface index over which the packed was
|
||||
* received. If the packet is from a local source, interface will be set to
|
||||
* Ipv4RoutingProtocol::INTERFACE_ANY.
|
||||
* @param ipHeader the Ipv4Header containing the source and destination IP
|
||||
* addresses for the packet.
|
||||
* @param packet The packet to be sent if a route is found.
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
* @see Ipv4StaticRouting
|
||||
* @see Ipv4RoutingProtocol
|
||||
*/
|
||||
virtual bool RequestRoute (uint32_t ifIndex,
|
||||
virtual bool RequestRoute (uint32_t interface,
|
||||
Ipv4Header const &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply);
|
||||
@@ -157,12 +157,12 @@ public:
|
||||
* that includeds multiple output interfaces, that route cannot be used.
|
||||
*
|
||||
* If there are multiple paths out of the node, the resolution is performed
|
||||
* by Ipv4L3Protocol::GetIfIndexforDestination which has access to more
|
||||
* by Ipv4L3Protocol::GetInterfaceforDestination which has access to more
|
||||
* contextual information that is useful for making a determination.
|
||||
*
|
||||
* @param destination The Ipv4Address if the destination of a hypothetical
|
||||
* packet. This may be a multicast group address.
|
||||
* @param ifIndex A reference to the interface index over which a packet
|
||||
* @param interface A reference to the interface index over which a packet
|
||||
* sent to this destination would be sent.
|
||||
* @return Returns true if a route is found to the destination that involves
|
||||
* a single output interface index, otherwise returns false indicating that
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
* @see Ipv4RoutingProtocol
|
||||
* @see Ipv4L3Protocol
|
||||
*/
|
||||
virtual bool RequestIfIndex (Ipv4Address destination, uint32_t& ifIndex);
|
||||
virtual bool RequestInterface (Ipv4Address destination, uint32_t& interface);
|
||||
|
||||
/**
|
||||
* @brief Add a host route to the static routing table.
|
||||
@@ -323,7 +323,7 @@ public:
|
||||
* of a local node. The difference is in the input interface. Routes for
|
||||
* forwarding will always have an explicit input interface specified. Routes
|
||||
* off of a node will always set the input interface to a wildcard specified
|
||||
* by the index Ipv4RoutingProtocol::IF_INDEX_ANY.
|
||||
* by the index Ipv4RoutingProtocol::INTERFACE_ANY.
|
||||
*
|
||||
* For routes off of a local node wildcards may be used in the origin and
|
||||
* multicast group addresses. The wildcard used for Ipv4Adresses is that
|
||||
@@ -346,7 +346,7 @@ public:
|
||||
* @param group The Ipv4Address of the multicast group or this route.
|
||||
* @param inputInterface The input network interface index over which to
|
||||
* expect packets destined for this route. May be
|
||||
* Ipv4RoutingProtocol::IF_INDEX_ANY for packets of local origin.
|
||||
* Ipv4RoutingProtocol::INTERFACE_ANY for packets of local origin.
|
||||
* @param outputInterfaces A vector of network interface indices used to specify
|
||||
* how to send packets to the destination(s).
|
||||
*
|
||||
@@ -492,7 +492,7 @@ private:
|
||||
|
||||
Ipv4Route *LookupStatic (Ipv4Address dest);
|
||||
Ipv4MulticastRoute *LookupStatic (Ipv4Address origin, Ipv4Address group,
|
||||
uint32_t ifIndex);
|
||||
uint32_t interface);
|
||||
|
||||
HostRoutes m_hostRoutes;
|
||||
NetworkRoutes m_networkRoutes;
|
||||
|
||||
@@ -340,12 +340,12 @@ TcpSocketImpl::Connect (const Address & address)
|
||||
m_remoteAddress = transport.GetIpv4 ();
|
||||
m_remotePort = transport.GetPort ();
|
||||
|
||||
uint32_t localIfIndex;
|
||||
uint32_t localInterface;
|
||||
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
|
||||
|
||||
if (ipv4->GetIfIndexForDestination (m_remoteAddress, localIfIndex))
|
||||
if (ipv4->GetInterfaceForDestination (m_remoteAddress, localInterface))
|
||||
{
|
||||
m_endPoint->SetLocalAddress (ipv4->GetAddress (localIfIndex));
|
||||
m_endPoint->SetLocalAddress (ipv4->GetAddress (localInterface));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -794,7 +794,7 @@ bool TcpSocketImpl::ProcessPacketAction (Actions_t a, Ptr<Packet> p,
|
||||
const Address& fromAddress)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << a << p << fromAddress);
|
||||
uint32_t localIfIndex;
|
||||
uint32_t localInterface;
|
||||
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
|
||||
switch (a)
|
||||
{
|
||||
@@ -809,9 +809,9 @@ bool TcpSocketImpl::ProcessPacketAction (Actions_t a, Ptr<Packet> p,
|
||||
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action SYN_ACK_TX");
|
||||
// m_remotePort = InetSocketAddress::ConvertFrom (fromAddress).GetPort ();
|
||||
// m_remoteAddress = InetSocketAddress::ConvertFrom (fromAddress).GetIpv4 ();
|
||||
// if (ipv4->GetIfIndexForDestination (m_remoteAddress, localIfIndex))
|
||||
// if (ipv4->GetInterfaceForDestination (m_remoteAddress, localInterface))
|
||||
// {
|
||||
// m_localAddress = ipv4->GetAddress (localIfIndex);
|
||||
// m_localAddress = ipv4->GetAddress (localInterface);
|
||||
// }
|
||||
if (m_state == LISTEN) //this means we should fork a new TcpSocketImpl
|
||||
{
|
||||
@@ -830,9 +830,9 @@ bool TcpSocketImpl::ProcessPacketAction (Actions_t a, Ptr<Packet> p,
|
||||
// This is the cloned endpoint
|
||||
NS_ASSERT (m_state == SYN_RCVD);
|
||||
m_endPoint->SetPeer (m_remoteAddress, m_remotePort);
|
||||
if (ipv4->GetIfIndexForDestination (m_remoteAddress, localIfIndex))
|
||||
if (ipv4->GetInterfaceForDestination (m_remoteAddress, localInterface))
|
||||
{
|
||||
m_localAddress = ipv4->GetAddress (localIfIndex);
|
||||
m_localAddress = ipv4->GetAddress (localInterface);
|
||||
m_endPoint->SetLocalAddress (m_localAddress);
|
||||
// Leave local addr in the portmap to any, as the path from
|
||||
// remote can change and packets can arrive on different interfaces
|
||||
|
||||
@@ -308,7 +308,7 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t localIfIndex;
|
||||
uint32_t localInterface;
|
||||
Ptr<Ipv4> ipv4 = m_node->GetObject<Ipv4> ();
|
||||
|
||||
// Locally override the IP TTL for this socket
|
||||
@@ -389,10 +389,10 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
|
||||
NS_LOG_LOGIC ("Limited broadcast end.");
|
||||
return p->GetSize();
|
||||
}
|
||||
else if (ipv4->GetIfIndexForDestination(dest, localIfIndex))
|
||||
else if (ipv4->GetInterfaceForDestination(dest, localInterface))
|
||||
{
|
||||
NS_LOG_LOGIC ("Route exists");
|
||||
m_udp->Send (p->Copy (), ipv4->GetAddress (localIfIndex), dest,
|
||||
m_udp->Send (p->Copy (), ipv4->GetAddress (localInterface), dest,
|
||||
m_endPoint->GetLocalPort (), port);
|
||||
NotifyDataSent (p->GetSize ());
|
||||
NotifySend (GetTxAvailable ());
|
||||
|
||||
@@ -41,7 +41,7 @@ Ipv4::~Ipv4 ()
|
||||
{}
|
||||
|
||||
uint32_t
|
||||
Ipv4::GetIfIndexByAddress (Ipv4Address addr, Ipv4Mask mask)
|
||||
Ipv4::GetInterfaceByAddress (Ipv4Address addr, Ipv4Mask mask)
|
||||
{
|
||||
for (uint32_t i = 0; i < GetNInterfaces (); i++)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ Ipv4::GetIfIndexByAddress (Ipv4Address addr, Ipv4Mask mask)
|
||||
}
|
||||
}
|
||||
// Mapping not found
|
||||
NS_ASSERT_MSG (false, "Ipv4::GetIfIndexByAddress failed");
|
||||
NS_ASSERT_MSG (false, "Ipv4::GetInterfaceByAddress failed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
/**
|
||||
* \brief Request that a packet be routed.
|
||||
*
|
||||
* \param ifIndex The interface index on which the packet was received.
|
||||
* \param interface The interface index on which the packet was received.
|
||||
* \param ipHeader IP header of the packet
|
||||
* \param packet packet that is being sent or forwarded
|
||||
* \param routeReply callback that will receive the route reply
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
* destination will be serviced by cloning the packet and calling the
|
||||
* route reply callback once for each outgoing interface in the route.
|
||||
*/
|
||||
virtual bool RequestRoute (uint32_t ifIndex,
|
||||
virtual bool RequestRoute (uint32_t interface,
|
||||
const Ipv4Header &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply) = 0;
|
||||
@@ -134,12 +134,12 @@ public:
|
||||
* that includeds multiple output interfaces, that route cannot be used.
|
||||
*
|
||||
* If there are multiple paths out of the node, the resolution is performed
|
||||
* by Ipv4L3Protocol::GetIfIndexforDestination which has access to more
|
||||
* by Ipv4L3Protocol::GetInterfaceforDestination which has access to more
|
||||
* contextual information that is useful for making a determination.
|
||||
*
|
||||
* \param destination The Ipv4Address if the destination of a hypothetical
|
||||
* packet. This may be a multicast group address.
|
||||
* \param ifIndex A reference to the interface index over which a packet
|
||||
* \param interface A reference to the interface index over which a packet
|
||||
* sent to this destination would be sent.
|
||||
* \return Returns true if a route is found to the destination that involves
|
||||
* a single output interface index, otherwise false.
|
||||
@@ -148,10 +148,10 @@ public:
|
||||
* \see Ipv4RoutingProtocol
|
||||
* \see Ipv4L3Protocol
|
||||
*/
|
||||
virtual bool RequestIfIndex (Ipv4Address destination,
|
||||
uint32_t& ifIndex) = 0;
|
||||
virtual bool RequestInterface (Ipv4Address destination,
|
||||
uint32_t& interface) = 0;
|
||||
|
||||
static const uint32_t IF_INDEX_ANY = 0xffffffff;
|
||||
static const uint32_t INTERFACE_ANY = 0xffffffff;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -447,12 +447,12 @@ public:
|
||||
|
||||
/**
|
||||
* \param dest The IP address of a hypothetical destination.
|
||||
* \param ifIndex filled in with the interface index that will be used to
|
||||
* \param interface filled in with the interface index that will be used to
|
||||
* send a packet to the hypothetical destination.
|
||||
* \returns true if a single interface can be identified, false otherwise.
|
||||
*/
|
||||
virtual bool GetIfIndexForDestination (Ipv4Address dest,
|
||||
uint32_t &ifIndex) const = 0;
|
||||
virtual bool GetInterfaceForDestination (Ipv4Address dest,
|
||||
uint32_t &interface) const = 0;
|
||||
|
||||
/**
|
||||
* \param i index of ipv4 interface
|
||||
@@ -485,14 +485,14 @@ public:
|
||||
virtual void SetDown (uint32_t i) = 0;
|
||||
|
||||
/**
|
||||
* \brief Convenience function to return the ifIndex corresponding
|
||||
* \brief Convenience function to return the interface corresponding
|
||||
* to the Ipv4Address provided
|
||||
*
|
||||
* \param addr Ipv4Address
|
||||
* \param mask corresponding Ipv4Mask
|
||||
* \returns ifIndex corresponding to a/amask
|
||||
* \returns interface corresponding to a/amask
|
||||
*/
|
||||
virtual uint32_t GetIfIndexByAddress (Ipv4Address addr,
|
||||
virtual uint32_t GetInterfaceByAddress (Ipv4Address addr,
|
||||
Ipv4Mask mask = Ipv4Mask("255.255.255.255"));
|
||||
};
|
||||
|
||||
|
||||
@@ -1352,7 +1352,7 @@ GlobalRouteManagerImpl::SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex*
|
||||
|
||||
//
|
||||
// Return the interface index corresponding to a given IP address
|
||||
// This is a wrapper around GetIfIndexByIpv4Address(), but we first
|
||||
// This is a wrapper around GetInterfaceByIpv4Address(), but we first
|
||||
// have to find the right node pointer to pass to that function.
|
||||
//
|
||||
uint32_t
|
||||
@@ -1406,7 +1406,7 @@ GlobalRouteManagerImpl::FindOutgoingInterfaceId (Ipv4Address a, Ipv4Mask amask)
|
||||
// we're looking for. If we find one, return the corresponding interface
|
||||
// index.
|
||||
//
|
||||
return (ipv4->GetIfIndexByAddress (a, amask) );
|
||||
return (ipv4->GetInterfaceByAddress (a, amask) );
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
@@ -594,8 +594,8 @@ GlobalRouter::DiscoverLSAs (void)
|
||||
//
|
||||
if (NetDeviceIsBridged (ndLocal))
|
||||
{
|
||||
uint32_t ifIndexBridge;
|
||||
bool rc = FindIfIndexForDevice(node, ndLocal, ifIndexBridge);
|
||||
uint32_t interfaceBridge;
|
||||
bool rc = FindInterfaceForDevice(node, ndLocal, interfaceBridge);
|
||||
NS_ABORT_MSG_IF (rc, "GlobalRouter::DiscoverLSAs(): Bridge ports must not have an IPv4 interface index");
|
||||
}
|
||||
|
||||
@@ -697,17 +697,17 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *p
|
||||
//
|
||||
Ptr<Node> node = nd->GetNode ();
|
||||
|
||||
uint32_t ifIndexLocal;
|
||||
bool rc = FindIfIndexForDevice(node, nd, ifIndexLocal);
|
||||
uint32_t interfaceLocal;
|
||||
bool rc = FindInterfaceForDevice(node, nd, interfaceLocal);
|
||||
NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessSingleBroadcastLink(): No interface index associated with device");
|
||||
|
||||
Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> ();
|
||||
NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessSingleBroadcastLink (): GetObject for <Ipv4> interface failed");
|
||||
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(interfaceLocal);
|
||||
NS_LOG_LOGIC ("Working with local address " << addrLocal);
|
||||
uint16_t metricLocal = ipv4Local->GetMetric (ifIndexLocal);
|
||||
uint16_t metricLocal = ipv4Local->GetMetric (interfaceLocal);
|
||||
|
||||
//
|
||||
// Check to see if the net device is connected to a channel/network that has
|
||||
@@ -813,17 +813,17 @@ GlobalRouter::ProcessBridgedBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *
|
||||
//
|
||||
Ptr<Node> node = nd->GetNode ();
|
||||
|
||||
uint32_t ifIndexLocal;
|
||||
bool rc = FindIfIndexForDevice(node, nd, ifIndexLocal);
|
||||
uint32_t interfaceLocal;
|
||||
bool rc = FindInterfaceForDevice(node, nd, interfaceLocal);
|
||||
NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessBridgedBroadcastLink(): No interface index associated with device");
|
||||
|
||||
Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> ();
|
||||
NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessBridgedBroadcastLink (): GetObject for <Ipv4> interface failed");
|
||||
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(interfaceLocal);
|
||||
NS_LOG_LOGIC ("Working with local address " << addrLocal);
|
||||
uint16_t metricLocal = ipv4Local->GetMetric (ifIndexLocal);
|
||||
uint16_t metricLocal = ipv4Local->GetMetric (interfaceLocal);
|
||||
|
||||
//
|
||||
// We need to handle a bridge on the router. This means that we have been
|
||||
@@ -955,17 +955,17 @@ GlobalRouter::ProcessPointToPointLink (Ptr<NetDevice> ndLocal, GlobalRoutingLSA
|
||||
//
|
||||
Ptr<Node> nodeLocal = ndLocal->GetNode ();
|
||||
|
||||
uint32_t ifIndexLocal;
|
||||
bool rc = FindIfIndexForDevice(nodeLocal, ndLocal, ifIndexLocal);
|
||||
uint32_t interfaceLocal;
|
||||
bool rc = FindInterfaceForDevice(nodeLocal, ndLocal, interfaceLocal);
|
||||
NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessPointToPointLink (): No interface index associated with device");
|
||||
|
||||
Ptr<Ipv4> ipv4Local = nodeLocal->GetObject<Ipv4> ();
|
||||
NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessPointToPointLink (): GetObject for <Ipv4> interface failed");
|
||||
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(interfaceLocal);
|
||||
NS_LOG_LOGIC ("Working with local address " << addrLocal);
|
||||
uint16_t metricLocal = ipv4Local->GetMetric (ifIndexLocal);
|
||||
uint16_t metricLocal = ipv4Local->GetMetric (interfaceLocal);
|
||||
|
||||
//
|
||||
// Now, we're going to walk over to the remote net device on the other end of
|
||||
@@ -1010,16 +1010,16 @@ GlobalRouter::ProcessPointToPointLink (Ptr<NetDevice> ndLocal, GlobalRoutingLSA
|
||||
// Now, just like we did above, we need to get the IP interface index for the
|
||||
// net device on the other end of the point-to-point channel.
|
||||
//
|
||||
uint32_t ifIndexRemote;
|
||||
rc = FindIfIndexForDevice(nodeRemote, ndRemote, ifIndexRemote);
|
||||
uint32_t interfaceRemote;
|
||||
rc = FindInterfaceForDevice(nodeRemote, ndRemote, interfaceRemote);
|
||||
NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessPointToPointLinks(): No interface index associated with remote device");
|
||||
|
||||
//
|
||||
// Now that we have the Ipv4 interface, we can get the (remote) address and
|
||||
// mask we need.
|
||||
//
|
||||
Ipv4Address addrRemote = ipv4Remote->GetAddress(ifIndexRemote);
|
||||
Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(ifIndexRemote);
|
||||
Ipv4Address addrRemote = ipv4Remote->GetAddress(interfaceRemote);
|
||||
Ipv4Mask maskRemote = ipv4Remote->GetNetworkMask(interfaceRemote);
|
||||
NS_LOG_LOGIC ("Working with remote address " << addrRemote);
|
||||
|
||||
//
|
||||
@@ -1028,9 +1028,9 @@ GlobalRouter::ProcessPointToPointLink (Ptr<NetDevice> ndLocal, GlobalRoutingLSA
|
||||
// the second is a stub network record with the network number.
|
||||
//
|
||||
GlobalRoutingLinkRecord *plr;
|
||||
if (ipv4Remote->IsUp (ifIndexRemote))
|
||||
if (ipv4Remote->IsUp (interfaceRemote))
|
||||
{
|
||||
NS_LOG_LOGIC ("Remote side interface " << ifIndexRemote << " is up-- add a type 1 link");
|
||||
NS_LOG_LOGIC ("Remote side interface " << interfaceRemote << " is up-- add a type 1 link");
|
||||
|
||||
plr = new GlobalRoutingLinkRecord;
|
||||
NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record");
|
||||
@@ -1069,15 +1069,15 @@ GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c)
|
||||
Ptr<NetDevice> ndLocal = c.Get (i);
|
||||
Ptr<Node> node = ndLocal->GetNode ();
|
||||
|
||||
uint32_t ifIndexLocal;
|
||||
bool rc = FindIfIndexForDevice(node, ndLocal, ifIndexLocal);
|
||||
uint32_t interfaceLocal;
|
||||
bool rc = FindInterfaceForDevice(node, ndLocal, interfaceLocal);
|
||||
NS_ABORT_MSG_IF (rc == false, "GlobalRouter::BuildNetworkLSAs (): No interface index associated with device");
|
||||
|
||||
Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> ();
|
||||
NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessPointToPointLink (): GetObject for <Ipv4> interface failed");
|
||||
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(ifIndexLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(ifIndexLocal);
|
||||
Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceLocal);
|
||||
Ipv4Mask maskLocal = ipv4Local->GetNetworkMask(interfaceLocal);
|
||||
|
||||
GlobalRoutingLSA *pLSA = new GlobalRoutingLSA;
|
||||
NS_ABORT_MSG_IF (pLSA == 0, "GlobalRouter::BuildNetworkLSAs(): Can't alloc link record");
|
||||
@@ -1117,18 +1117,18 @@ GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c)
|
||||
// Does the attached node have an ipv4 interface for the device we're probing?
|
||||
// If not, it can't play router.
|
||||
//
|
||||
uint32_t tempIfIndex;
|
||||
if (FindIfIndexForDevice (tempNode, tempNd, tempIfIndex))
|
||||
uint32_t tempInterface;
|
||||
if (FindInterfaceForDevice (tempNode, tempNd, tempInterface))
|
||||
{
|
||||
Ptr<Ipv4> tempIpv4 = tempNode->GetObject<Ipv4> ();
|
||||
NS_ASSERT (tempIpv4);
|
||||
if (!tempIpv4->IsUp (tempIfIndex))
|
||||
if (!tempIpv4->IsUp (tempInterface))
|
||||
{
|
||||
NS_LOG_LOGIC ("Remote side interface " << tempIfIndex << " not up");
|
||||
NS_LOG_LOGIC ("Remote side interface " << tempInterface << " not up");
|
||||
}
|
||||
else
|
||||
{
|
||||
Ipv4Address tempAddr = tempIpv4->GetAddress(tempIfIndex);
|
||||
Ipv4Address tempAddr = tempIpv4->GetAddress(tempInterface);
|
||||
pLSA->AddAttachedRouter (tempAddr);
|
||||
}
|
||||
}
|
||||
@@ -1197,16 +1197,16 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr<NetDevice> ndLocal, bool allowRec
|
||||
Ptr<Ipv4> ipv4 = nodeOther->GetObject<Ipv4> ();
|
||||
if (rtr && ipv4)
|
||||
{
|
||||
uint32_t ifIndexOther;
|
||||
if (FindIfIndexForDevice(nodeOther, bnd, ifIndexOther))
|
||||
uint32_t interfaceOther;
|
||||
if (FindInterfaceForDevice(nodeOther, bnd, interfaceOther))
|
||||
{
|
||||
NS_LOG_LOGIC ("Found router on bridge net device " << bnd);
|
||||
if (!ipv4->IsUp (ifIndexOther))
|
||||
if (!ipv4->IsUp (interfaceOther))
|
||||
{
|
||||
NS_LOG_LOGIC ("Remote side interface " << ifIndexOther << " not up");
|
||||
NS_LOG_LOGIC ("Remote side interface " << interfaceOther << " not up");
|
||||
continue;
|
||||
}
|
||||
Ipv4Address addrOther = ipv4->GetAddress (ifIndexOther);
|
||||
Ipv4Address addrOther = ipv4->GetAddress (interfaceOther);
|
||||
desigRtr = addrOther < desigRtr ? addrOther : desigRtr;
|
||||
NS_LOG_LOGIC ("designated router now " << desigRtr);
|
||||
}
|
||||
@@ -1246,16 +1246,16 @@ GlobalRouter::FindDesignatedRouterForLink (Ptr<NetDevice> ndLocal, bool allowRec
|
||||
Ptr<Ipv4> ipv4 = nodeOther->GetObject<Ipv4> ();
|
||||
if (rtr && ipv4)
|
||||
{
|
||||
uint32_t ifIndexOther;
|
||||
if (FindIfIndexForDevice(nodeOther, ndOther, ifIndexOther))
|
||||
uint32_t interfaceOther;
|
||||
if (FindInterfaceForDevice(nodeOther, ndOther, interfaceOther))
|
||||
{
|
||||
if (!ipv4->IsUp (ifIndexOther))
|
||||
if (!ipv4->IsUp (interfaceOther))
|
||||
{
|
||||
NS_LOG_LOGIC ("Remote side interface " << ifIndexOther << " not up");
|
||||
NS_LOG_LOGIC ("Remote side interface " << interfaceOther << " not up");
|
||||
continue;
|
||||
}
|
||||
NS_LOG_LOGIC ("Found router on net device " << ndOther);
|
||||
Ipv4Address addrOther = ipv4->GetAddress (ifIndexOther);
|
||||
Ipv4Address addrOther = ipv4->GetAddress (interfaceOther);
|
||||
desigRtr = addrOther < desigRtr ? addrOther : desigRtr;
|
||||
NS_LOG_LOGIC ("designated router now " << desigRtr);
|
||||
}
|
||||
@@ -1441,7 +1441,7 @@ GlobalRouter::GetAdjacent (Ptr<NetDevice> nd, Ptr<Channel> ch) const
|
||||
// is bridged, there will not be an interface associated directly with the device.
|
||||
//
|
||||
bool
|
||||
GlobalRouter::FindIfIndexForDevice (Ptr<Node> node, Ptr<NetDevice> nd, uint32_t &index) const
|
||||
GlobalRouter::FindInterfaceForDevice (Ptr<Node> node, Ptr<NetDevice> nd, uint32_t &index) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
NS_LOG_LOGIC("For node " << node->GetId () << " for net device " << nd );
|
||||
|
||||
@@ -644,7 +644,7 @@ private:
|
||||
void ClearLSAs (void);
|
||||
|
||||
Ptr<NetDevice> GetAdjacent(Ptr<NetDevice> nd, Ptr<Channel> ch) const;
|
||||
bool FindIfIndexForDevice(Ptr<Node> node, Ptr<NetDevice> nd, uint32_t &index) const;
|
||||
bool FindInterfaceForDevice(Ptr<Node> node, Ptr<NetDevice> nd, uint32_t &index) const;
|
||||
Ipv4Address FindDesignatedRouterForLink (Ptr<NetDevice> ndLocal, bool allowRecursion) const;
|
||||
bool AnotherRouterOnLink (Ptr<NetDevice> nd, bool allowRecursion) const;
|
||||
void ProcessBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c);
|
||||
|
||||
@@ -105,7 +105,7 @@ RoutingTable::FindSendEntry (RoutingTableEntry const &entry,
|
||||
|
||||
|
||||
bool
|
||||
RoutingTable::RequestRoute (uint32_t ifIndex,
|
||||
RoutingTable::RequestRoute (uint32_t interface,
|
||||
const Ipv4Header &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply)
|
||||
@@ -148,8 +148,8 @@ RoutingTable::RequestRoute (uint32_t ifIndex,
|
||||
}
|
||||
|
||||
bool
|
||||
RoutingTable::RequestIfIndex (Ipv4Address destination,
|
||||
uint32_t& ifIndex)
|
||||
RoutingTable::RequestInterface (Ipv4Address destination,
|
||||
uint32_t& interface)
|
||||
{
|
||||
RoutingTableEntry entry1, entry2;
|
||||
if (Lookup (destination, entry1))
|
||||
@@ -157,7 +157,7 @@ RoutingTable::RequestIfIndex (Ipv4Address destination,
|
||||
bool foundSendEntry = FindSendEntry (entry1, entry2);
|
||||
if (!foundSendEntry)
|
||||
NS_FATAL_ERROR ("FindSendEntry failure");
|
||||
ifIndex = entry2.interface;
|
||||
interface = entry2.interface;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -98,12 +98,12 @@ public:
|
||||
RoutingTableEntry &outEntry) const;
|
||||
|
||||
// From Ipv4RoutingProtocol
|
||||
virtual bool RequestRoute (uint32_t ifIndex,
|
||||
virtual bool RequestRoute (uint32_t interface,
|
||||
const Ipv4Header &ipHeader,
|
||||
Ptr<Packet> packet,
|
||||
RouteReplyCallback routeReply);
|
||||
virtual bool RequestIfIndex (Ipv4Address destination,
|
||||
uint32_t& ifIndex);
|
||||
virtual bool RequestInterface (Ipv4Address destination,
|
||||
uint32_t& interface);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user