INET Framework for OMNeT++/OMNEST
inet::IPv4RoutingTable Class Reference

Represents the routing table. More...

#include <IPv4RoutingTable.h>

Inheritance diagram for inet::IPv4RoutingTable:
inet::IIPv4RoutingTable inet::ILifecycle inet::IRoutingTable

Classes

class  RouteLessThan
 

Public Member Functions

 IPv4RoutingTable ()
 
virtual ~IPv4RoutingTable ()
 
virtual void printRoutingTable () const override
 For debugging. More...
 
virtual void printMulticastRoutingTable () const override
 For debugging. More...
 
virtual cModule * getHostModule () override
 Returns the host or router this routing table lives in. More...
 
virtual bool isForwardingEnabled () const override
 IPv4 forwarding on/off. More...
 
virtual bool isMulticastForwardingEnabled () const override
 IPv4 multicast forwarding on/off. More...
 
virtual IPv4Address getRouterId () const override
 Returns routerId. More...
 
virtual void setRouterId (IPv4Address a) override
 Sets routerId. More...
 
virtual bool handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override
 ILifecycle method. More...
 
virtual L3Address getRouterIdAsGeneric () const override
 Returns routerId. More...
 
virtual bool isLocalAddress (const L3Address &dest) const override
 Checks if the address is a local one, i.e. More...
 
virtual InterfaceEntrygetInterfaceByAddress (const L3Address &address) const override
 Returns an interface given by its address. More...
 
virtual IRoutefindBestMatchingRoute (const L3Address &dest) const override
 The routing function. More...
 
virtual InterfaceEntrygetOutputInterfaceForDestination (const L3Address &dest) const override
 Convenience function based on findBestMatchingRoute(). More...
 
virtual L3Address getNextHopForDestination (const L3Address &dest) const override
 Convenience function based on findBestMatchingRoute(). More...
 
virtual bool isLocalMulticastAddress (const L3Address &dest) const override
 Checks if the address is in one of the local multicast group address list. More...
 
virtual IMulticastRoutefindBestMatchingMulticastRoute (const L3Address &origin, const L3Address &group) const override
 Returns route for a multicast origin and group. More...
 
virtual IRoutecreateRoute () override
 
Interfaces
virtual void configureInterfaceForIPv4 (InterfaceEntry *ie) override
 
virtual InterfaceEntrygetInterfaceByAddress (const IPv4Address &address) const override
 Returns an interface given by its address. More...
 
Routing functions (query the route table)
virtual bool isLocalAddress (const IPv4Address &dest) const override
 Checks if the address is a local one, i.e. More...
 
virtual bool isLocalBroadcastAddress (const IPv4Address &dest) const override
 Checks if the address is a local network broadcast address, i.e. More...
 
virtual InterfaceEntryfindInterfaceByLocalBroadcastAddress (const IPv4Address &dest) const override
 Returns the interface entry having the specified address as its local broadcast address. More...
 
virtual IPv4RoutefindBestMatchingRoute (const IPv4Address &dest) const override
 The routing function. More...
 
virtual InterfaceEntrygetInterfaceForDestAddr (const IPv4Address &dest) const override
 Convenience function based on findBestMatchingRoute(). More...
 
virtual IPv4Address getGatewayForDestAddr (const IPv4Address &dest) const override
 Convenience function based on findBestMatchingRoute(). More...
 
Multicast routing functions
virtual bool isLocalMulticastAddress (const IPv4Address &dest) const override
 Checks if the address is in one of the local multicast group address list. More...
 
virtual const IPv4MulticastRoutefindBestMatchingMulticastRoute (const IPv4Address &origin, const IPv4Address &group) const override
 Returns route for a multicast source and multicast group. More...
 
Route table manipulation
virtual int getNumRoutes () const override
 Returns the total number of routes (unicast, multicast, plus the default route). More...
 
virtual IPv4RoutegetRoute (int k) const override
 Returns the kth route. More...
 
virtual IPv4RoutegetDefaultRoute () const override
 Finds and returns the default route, or nullptr if it doesn't exist. More...
 
virtual void addRoute (IPv4Route *entry) override
 Adds a route to the routing table. More...
 
virtual IPv4RouteremoveRoute (IPv4Route *entry) override
 Removes the given route from the routing table, and returns it. More...
 
virtual bool deleteRoute (IPv4Route *entry) override
 Removes the given route from the routing table, and delete it. More...
 
virtual int getNumMulticastRoutes () const override
 Returns the total number of multicast routes. More...
 
virtual IPv4MulticastRoutegetMulticastRoute (int k) const override
 Returns the kth multicast route. More...
 
virtual void addMulticastRoute (IPv4MulticastRoute *entry) override
 Adds a multicast route to the routing table. More...
 
virtual IPv4MulticastRouteremoveMulticastRoute (IPv4MulticastRoute *entry) override
 Removes the given route from the routing table, and returns it. More...
 
virtual bool deleteMulticastRoute (IPv4MulticastRoute *entry) override
 Deletes the given multicast route from the routing table. More...
 
virtual void purge () override
 Deletes invalid routes from the routing table. More...
 
virtual std::vector< IPv4AddressgatherAddresses () const override
 Utility function: Returns a vector of all addresses of the node. More...
 
virtual void routeChanged (IPv4Route *entry, int fieldCode) override
 To be called from route objects whenever a field changes. More...
 
virtual void multicastRouteChanged (IPv4MulticastRoute *entry, int fieldCode) override
 To be called from multicast route objects whenever a field changes. More...
 
- Public Member Functions inherited from inet::IIPv4RoutingTable
virtual ~IIPv4RoutingTable ()
 
- Public Member Functions inherited from inet::IRoutingTable
virtual ~IRoutingTable ()
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 

Protected Types

typedef IPv4MulticastRoute::OutInterface OutInterface
 
typedef IPv4MulticastRoute::OutInterfaceVector OutInterfaceVector
 
typedef std::map< IPv4Address, IPv4Route * > RoutingCache
 
typedef std::set< IPv4AddressAddressSet
 

Protected Member Functions

virtual void configureLoopbackForIPv4 ()
 
virtual void configureRouterId ()
 
virtual void updateNetmaskRoutes ()
 
virtual IPv4RoutecreateNewRoute ()
 
virtual void refreshDisplay () const override
 
virtual void deleteInterfaceRoutes (const InterfaceEntry *entry)
 
virtual void invalidateCache ()
 
bool routeLessThan (const IPv4Route *a, const IPv4Route *b) const
 
void internalAddRoute (IPv4Route *entry)
 
IPv4RouteinternalRemoveRoute (IPv4Route *entry)
 
void internalAddMulticastRoute (IPv4MulticastRoute *entry)
 
IPv4MulticastRouteinternalRemoveMulticastRoute (IPv4MulticastRoute *entry)
 
virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *) override
 Raises an error. More...
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 Called by the signal handler whenever a change of a category occurs to which this client has subscribed. More...
 

Static Protected Member Functions

static bool multicastRouteLessThan (const IPv4MulticastRoute *a, const IPv4MulticastRoute *b)
 

Protected Attributes

IInterfaceTableift = nullptr
 
IPv4Address routerId
 
const char * netmaskRoutes = nullptr
 
bool forwarding = false
 
bool multicastForward = false
 
bool isNodeUp = false
 
bool useAdminDist = false
 
RoutingCache routingCache
 
AddressSet localAddresses
 
AddressSet localBroadcastAddresses
 

Private Types

typedef std::vector< IPv4Route * > RouteVector
 
typedef std::vector< IPv4MulticastRoute * > MulticastRouteVector
 

Private Member Functions

virtual void addRoute (IRoute *entry) override
 Adds a route to the routing table. More...
 
virtual IRouteremoveRoute (IRoute *entry) override
 Removes the given route from the routing table, and returns it. More...
 
virtual bool deleteRoute (IRoute *entry) override
 Deletes the given route from the routing table. More...
 
virtual void addMulticastRoute (IMulticastRoute *entry) override
 Adds a multicast route to the routing table. More...
 
virtual IMulticastRouteremoveMulticastRoute (IMulticastRoute *entry) override
 Removes the given route from the routing table, and returns it. More...
 
virtual bool deleteMulticastRoute (IMulticastRoute *entry) override
 Deletes the given multicast route from the routing table. More...
 

Private Attributes

RouteVector routes
 
MulticastRouteVector multicastRoutes
 

Detailed Description

Represents the routing table.

This object has one instance per host or router. It has methods to manage the route table and the interface table, so one can achieve functionality similar to the "route" and "ifconfig" commands.

See the NED documentation for general overview.

This is a simple module without gates, it requires function calls to it (message handling does nothing). Methods are provided for reading and updating the interface table and the route table, as well as for unicast and multicast routing.

Interfaces are dynamically registered: at the start of the simulation, every L2 module adds its own interface entry to the table.

The route table is read from a file (RoutingTableParser); the file can also fill in or overwrite interface settings. The route table can also be read and modified during simulation, typically by routing protocol implementations (e.g. OSPF).

Entries in the route table are represented by IPv4Route objects. IPv4Route objects can be polymorphic: if a routing protocol needs to store additional data, it can simply subclass from IPv4Route, and add the derived object to the table.

Uses RoutingTableParser to read routing files (.irt, .mrt).

See also
InterfaceEntry, IPv4InterfaceData, IPv4Route

Member Typedef Documentation

typedef std::set<IPv4Address> inet::IPv4RoutingTable::AddressSet
protected
typedef std::vector<IPv4Route *> inet::IPv4RoutingTable::RouteVector
private

Constructor & Destructor Documentation

inet::IPv4RoutingTable::IPv4RoutingTable ( )
inline
154 {}
inet::IPv4RoutingTable::~IPv4RoutingTable ( )
virtual
55 {
56  for (auto & elem : routes)
57  delete elem;
58  for (auto & elem : multicastRoutes)
59  delete elem;
60 }
RouteVector routes
Definition: IPv4RoutingTable.h:107
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110

Member Function Documentation

void inet::IPv4RoutingTable::addMulticastRoute ( IPv4MulticastRoute entry)
overridevirtual

Adds a multicast route to the routing table.

Routes are allowed to be modified while in the routing table. (There is a notification mechanism that allows routing table internals to be updated on a routing entry change.)

Implements inet::IIPv4RoutingTable.

700 {
701  Enter_Method("addMulticastRoute(...)");
702 
704 
705  invalidateCache();
706 
707  emit(NF_MROUTE_ADDED, entry);
708 }
void internalAddMulticastRoute(IPv4MulticastRoute *entry)
Definition: IPv4RoutingTable.cc:662
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
simsignal_t NF_MROUTE_ADDED
Definition: NotifierConsts.cc:60
virtual void inet::IPv4RoutingTable::addMulticastRoute ( IMulticastRoute entry)
inlineoverrideprivatevirtual

Adds a multicast route to the routing table.

Routes are allowed to be modified while in the routing table. (There is a notification mechanism that allows routing table internals to be updated on a routing entry change.)

Implements inet::IRoutingTable.

Referenced by addMulticastRoute().

394 { addMulticastRoute(check_and_cast<IPv4MulticastRoute *>(entry)); }
virtual void addMulticastRoute(IPv4MulticastRoute *entry) override
Adds a multicast route to the routing table.
Definition: IPv4RoutingTable.cc:699
void inet::IPv4RoutingTable::addRoute ( IPv4Route entry)
overridevirtual

Adds a route to the routing table.

Routes are allowed to be modified while in the routing table. (There is a notification mechanism that allows routing table internals to be updated on a routing entry change.)

Implements inet::IIPv4RoutingTable.

591 {
592  Enter_Method("addRoute(...)");
593  EV_INFO << "add route " << entry->info() << "\n";
594 
595  internalAddRoute(entry);
596 
597  invalidateCache();
598 
599  emit(NF_ROUTE_ADDED, entry);
600 }
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
void internalAddRoute(IPv4Route *entry)
Definition: IPv4RoutingTable.cc:551
simsignal_t NF_ROUTE_ADDED
Definition: NotifierConsts.cc:57
virtual void inet::IPv4RoutingTable::addRoute ( IRoute entry)
inlineoverrideprivatevirtual

Adds a route to the routing table.

Routes are allowed to be modified while in the routing table. (There is a notification mechanism that allows routing table internals to be updated on a routing entry change.)

Implements inet::IRoutingTable.

Referenced by addRoute().

390 { addRoute(check_and_cast<IPv4Route *>(entry)); }
virtual void addRoute(IPv4Route *entry) override
Adds a route to the routing table.
Definition: IPv4RoutingTable.cc:590
void inet::IPv4RoutingTable::configureInterfaceForIPv4 ( InterfaceEntry ie)
overridevirtual

Implements inet::IIPv4RoutingTable.

301 {
302  IPv4InterfaceData *d = new IPv4InterfaceData();
303  ie->setIPv4Data(d);
304 
305  // metric: some hints: OSPF cost (2e9/bps value), MS KB article Q299540, ...
306  d->setMetric((int)ceil(2e9 / ie->getDatarate())); // use OSPF cost as default
307 
308  // join "224.0.0.1" and "224.0.0.2" (if router) multicast groups automatically
309  if (ie->isMulticast()) {
310  d->joinMulticastGroup(IPv4Address::ALL_HOSTS_MCAST);
311  if (forwarding)
312  d->joinMulticastGroup(IPv4Address::ALL_ROUTERS_MCAST);
313  }
314 }
static const IPv4Address ALL_HOSTS_MCAST
224.0.0.1 All hosts on a subnet
Definition: IPv4Address.h:107
bool forwarding
Definition: IPv4RoutingTable.h:82
static const IPv4Address ALL_ROUTERS_MCAST
224.0.0.2 All routers on a subnet
Definition: IPv4Address.h:108
void inet::IPv4RoutingTable::configureLoopbackForIPv4 ( )
protectedvirtual
331 {
332  InterfaceEntry *ie = ift->getFirstLoopbackInterface();
333  if (ie) {
334  // add IPv4 info. Set 127.0.0.1/8 as address by default --
335  // we may reconfigure later it to be the routerId
336  IPv4InterfaceData *d = new IPv4InterfaceData();
337  d->setIPAddress(IPv4Address::LOOPBACK_ADDRESS);
338  d->setNetmask(IPv4Address::LOOPBACK_NETMASK);
339  d->setMetric(1);
340  ie->setIPv4Data(d);
341  }
342 }
virtual InterfaceEntry * getFirstLoopbackInterface() const =0
Returns the first interface with the isLoopback flag set.
static const IPv4Address LOOPBACK_NETMASK
255.0.0.0
Definition: IPv4Address.h:104
static const IPv4Address LOOPBACK_ADDRESS
127.0.0.1
Definition: IPv4Address.h:103
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
void inet::IPv4RoutingTable::configureRouterId ( )
protectedvirtual
119 {
120  if (routerId.isUnspecified()) { // not yet configured
121  const char *routerIdStr = par("routerId").stringValue();
122  if (!strcmp(routerIdStr, "auto")) { // non-"auto" cases already handled earlier
123  // choose highest interface address as routerId
124  for (int i = 0; i < ift->getNumInterfaces(); ++i) {
125  InterfaceEntry *ie = ift->getInterface(i);
126  if (!ie->isLoopback() && ie->ipv4Data() && ie->ipv4Data()->getIPAddress().getInt() > routerId.getInt())
127  routerId = ie->ipv4Data()->getIPAddress();
128  }
129  }
130  }
131  else { // already configured
132  // if there is no interface with routerId yet, assign it to the loopback address;
133  // TODO find out if this is a good practice, in which situations it is useful etc.
134  if (getInterfaceByAddress(routerId) == nullptr) {
135  InterfaceEntry *lo0 = ift->getFirstLoopbackInterface();
136  ASSERT(lo0);
137  lo0->ipv4Data()->setIPAddress(routerId);
138  lo0->ipv4Data()->setNetmask(IPv4Address::ALLONES_ADDRESS);
139  }
140  }
141 }
bool isUnspecified() const
True if all four address bytes are zero.
Definition: IPv4Address.h:176
virtual InterfaceEntry * getFirstLoopbackInterface() const =0
Returns the first interface with the isLoopback flag set.
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IPv4Address routerId
Definition: IPv4RoutingTable.h:80
uint32 getInt() const
Returns the address as an int.
Definition: IPv4Address.h:197
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
static const IPv4Address ALLONES_ADDRESS
255.255.255.255
Definition: IPv4Address.h:105
virtual InterfaceEntry * getInterfaceByAddress(const IPv4Address &address) const override
Returns an interface given by its address.
Definition: IPv4RoutingTable.cc:316
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
IPv4Route * inet::IPv4RoutingTable::createNewRoute ( )
protectedvirtual
852 {
853  return new IPv4Route();
854 }
virtual IRoute* inet::IPv4RoutingTable::createRoute ( )
inlineoverridevirtual

Implements inet::IRoutingTable.

387 { return new IPv4Route(); }
void inet::IPv4RoutingTable::deleteInterfaceRoutes ( const InterfaceEntry entry)
protectedvirtual
194 {
195  bool changed = false;
196 
197  // delete unicast routes using this interface
198  for (auto it = routes.begin(); it != routes.end(); ) {
199  IPv4Route *route = *it;
200  if (route->getInterface() == entry) {
201  it = routes.erase(it);
202  ASSERT(route->getRoutingTable() == this); // still filled in, for the listeners' benefit
203  emit(NF_ROUTE_DELETED, route);
204  delete route;
205  changed = true;
206  }
207  else
208  ++it;
209  }
210 
211  // delete or update multicast routes:
212  // 1. delete routes has entry as input interface
213  // 2. remove entry from output interface list
214  for (auto it = multicastRoutes.begin(); it != multicastRoutes.end(); ) {
215  IPv4MulticastRoute *route = *it;
216  if (route->getInInterface() && route->getInInterface()->getInterface() == entry) {
217  it = multicastRoutes.erase(it);
218  ASSERT(route->getRoutingTable() == this); // still filled in, for the listeners' benefit
219  emit(NF_MROUTE_DELETED, route);
220  delete route;
221  changed = true;
222  }
223  else {
224  bool removed = route->removeOutInterface(entry);
225  if (removed) {
226  emit(NF_MROUTE_CHANGED, route);
227  changed = true;
228  }
229  ++it;
230  }
231  }
232 
233  if (changed) {
234  invalidateCache();
235  }
236 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
RouteVector routes
Definition: IPv4RoutingTable.h:107
simsignal_t NF_MROUTE_DELETED
Definition: NotifierConsts.cc:61
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
simsignal_t NF_MROUTE_CHANGED
Definition: NotifierConsts.cc:62
bool inet::IPv4RoutingTable::deleteMulticastRoute ( IPv4MulticastRoute entry)
overridevirtual

Deletes the given multicast route from the routing table.

Returns true if the route was deleted, and false if it was not in the routing table.

Implements inet::IIPv4RoutingTable.

736 {
737  Enter_Method("deleteMulticastRoute(...)");
738 
739  entry = internalRemoveMulticastRoute(entry);
740 
741  if (entry != nullptr) {
742  invalidateCache();
743  ASSERT(entry->getRoutingTable() == this); // still filled in, for the listeners' benefit
744  emit(NF_MROUTE_DELETED, entry);
745  delete entry;
746  }
747  return entry != nullptr;
748 }
simsignal_t NF_MROUTE_DELETED
Definition: NotifierConsts.cc:61
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
IPv4MulticastRoute * internalRemoveMulticastRoute(IPv4MulticastRoute *entry)
Definition: IPv4RoutingTable.cc:710
virtual bool inet::IPv4RoutingTable::deleteMulticastRoute ( IMulticastRoute entry)
inlineoverrideprivatevirtual

Deletes the given multicast route from the routing table.

Returns true if the route was deleted, and false if it was not in the routing table.

Implements inet::IRoutingTable.

Referenced by deleteMulticastRoute().

396 { return deleteMulticastRoute(check_and_cast<IPv4MulticastRoute *>(entry)); }
virtual bool deleteMulticastRoute(IPv4MulticastRoute *entry) override
Deletes the given multicast route from the routing table.
Definition: IPv4RoutingTable.cc:735
bool inet::IPv4RoutingTable::deleteRoute ( IPv4Route entry)
overridevirtual

Removes the given route from the routing table, and delete it.

Returns true if the route was deleted, and false if it was not in the routing table.

Implements inet::IIPv4RoutingTable.

629 {
630  Enter_Method("deleteRoute(...)");
631 
632  entry = internalRemoveRoute(entry);
633 
634  if (entry != nullptr) {
635  EV_INFO << "delete route " << entry->info() << "\n";
636  invalidateCache();
637  ASSERT(entry->getRoutingTable() == this); // still filled in, for the listeners' benefit
638  emit(NF_ROUTE_DELETED, entry);
639  delete entry;
640  }
641  return entry != nullptr;
642 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
IPv4Route * internalRemoveRoute(IPv4Route *entry)
Definition: IPv4RoutingTable.cc:602
virtual bool inet::IPv4RoutingTable::deleteRoute ( IRoute entry)
inlineoverrideprivatevirtual

Deletes the given route from the routing table.

Returns true if the route was deleted, and false if it was not in the routing table.

Implements inet::IRoutingTable.

Referenced by deleteRoute().

392 { return deleteRoute(check_and_cast<IPv4Route *>(entry)); }
virtual bool deleteRoute(IPv4Route *entry) override
Removes the given route from the routing table, and delete it.
Definition: IPv4RoutingTable.cc:628
const IPv4MulticastRoute * inet::IPv4RoutingTable::findBestMatchingMulticastRoute ( const IPv4Address origin,
const IPv4Address group 
) const
overridevirtual

Returns route for a multicast source and multicast group.

Implements inet::IIPv4RoutingTable.

492 {
493  Enter_Method("getMulticastRoutesFor(%u.%u.%u.%u, %u.%u.%u.%u)",
494  origin.getDByte(0), origin.getDByte(1), origin.getDByte(2), origin.getDByte(3),
495  group.getDByte(0), group.getDByte(1), group.getDByte(2), group.getDByte(3)); // note: str().c_str() too slow here here
496 
497  // TODO caching?
498 
499  for (auto e : multicastRoutes) {
500  if (e->isValid() && e->matches(origin, group))
501  return e;
502  }
503 
504  return nullptr;
505 }
const value< double, units::C > e(1.602176487e-19)
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
virtual IMulticastRoute* inet::IPv4RoutingTable::findBestMatchingMulticastRoute ( const L3Address origin,
const L3Address group 
) const
inlineoverridevirtual

Returns route for a multicast origin and group.

Implements inet::IRoutingTable.

Referenced by findBestMatchingMulticastRoute().

386 { return const_cast<IPv4MulticastRoute *>(findBestMatchingMulticastRoute(origin.toIPv4(), group.toIPv4())); } //XXX remove 'const' from IPv4 method?
virtual const IPv4MulticastRoute * findBestMatchingMulticastRoute(const IPv4Address &origin, const IPv4Address &group) const override
Returns route for a multicast source and multicast group.
Definition: IPv4RoutingTable.cc:491
IPv4Route * inet::IPv4RoutingTable::findBestMatchingRoute ( const IPv4Address dest) const
overridevirtual

The routing function.

Performs longest prefix match for the given destination address, and returns the resulting route. Returns nullptr if there is no matching route.

Implements inet::IIPv4RoutingTable.

450 {
451  Enter_Method("findBestMatchingRoute(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here
452 
453  auto it = routingCache.find(dest);
454  if (it != routingCache.end()) {
455  if (it->second == nullptr || it->second->isValid())
456  return it->second;
457  }
458 
459  // find best match (one with longest prefix)
460  // default route has zero prefix length, so (if exists) it'll be selected as last resort
461  IPv4Route *bestRoute = nullptr;
462  for (auto e : routes) {
463  if (e->isValid()) {
464  if (IPv4Address::maskedAddrAreEqual(dest, e->getDestination(), e->getNetmask())) { // match
465  bestRoute = const_cast<IPv4Route *>(e);
466  break;
467  }
468  }
469  }
470 
471  routingCache[dest] = bestRoute;
472  return bestRoute;
473 }
static bool maskedAddrAreEqual(const IPv4Address &addr1, const IPv4Address &addr2, const IPv4Address &netmask)
Test if the masked addresses (ie the mask is applied to addr1 and addr2) are equal.
Definition: IPv4Address.cc:260
RouteVector routes
Definition: IPv4RoutingTable.h:107
const value< double, units::C > e(1.602176487e-19)
RoutingCache routingCache
Definition: IPv4RoutingTable.h:93
virtual IRoute* inet::IPv4RoutingTable::findBestMatchingRoute ( const L3Address dest) const
inlineoverridevirtual

The routing function.

Performs longest prefix match for the given destination address, and returns the resulting route. Returns nullptr if there is no matching route.

Implements inet::IRoutingTable.

Referenced by findBestMatchingRoute().

382 { return findBestMatchingRoute(dest.toIPv4()); }
virtual IPv4Route * findBestMatchingRoute(const IPv4Address &dest) const override
The routing function.
Definition: IPv4RoutingTable.cc:449
InterfaceEntry * inet::IPv4RoutingTable::findInterfaceByLocalBroadcastAddress ( const IPv4Address dest) const
overridevirtual

Returns the interface entry having the specified address as its local broadcast address.

Implements inet::IIPv4RoutingTable.

387 {
388  for (int i = 0; i < ift->getNumInterfaces(); i++) {
389  InterfaceEntry *ie = ift->getInterface(i);
390  if (!ie->isBroadcast())
391  continue;
392  IPv4Address interfaceAddr = ie->ipv4Data()->getIPAddress();
393  IPv4Address broadcastAddr = interfaceAddr.makeBroadcastAddress(ie->ipv4Data()->getNetmask());
394  if (broadcastAddr == dest)
395  return ie;
396  }
397  return nullptr;
398 }
IPv4InterfaceData * ipv4Data() const
Definition: InterfaceEntry.h:221
IPv4Address makeBroadcastAddress(IPv4Address netmask) const
Returns the broadcast address for the given netmask.
Definition: IPv4Address.cc:275
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IPv4Address getIPAddress() const
Definition: IPv4InterfaceData.h:177
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
std::vector< IPv4Address > inet::IPv4RoutingTable::gatherAddresses ( ) const
overridevirtual

Utility function: Returns a vector of all addresses of the node.

Implements inet::IIPv4RoutingTable.

290 {
291  std::vector<IPv4Address> addressvector;
292 
293  for (int i = 0; i < ift->getNumInterfaces(); ++i)
294  addressvector.push_back(ift->getInterface(i)->ipv4Data()->getIPAddress());
295  return addressvector;
296 }
IPv4InterfaceData * ipv4Data() const
Definition: InterfaceEntry.h:221
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IPv4Address getIPAddress() const
Definition: IPv4InterfaceData.h:177
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
IPv4Route * inet::IPv4RoutingTable::getDefaultRoute ( ) const
overridevirtual

Finds and returns the default route, or nullptr if it doesn't exist.

Implements inet::IIPv4RoutingTable.

515 {
516  // if exists default route entry, it is the last valid entry
517  for (RouteVector::const_reverse_iterator i = routes.rbegin(); i != routes.rend() && (*i)->getNetmask().isUnspecified(); ++i) {
518  if ((*i)->isValid())
519  return *i;
520  }
521  return nullptr;
522 }
RouteVector routes
Definition: IPv4RoutingTable.h:107
IPv4Address inet::IPv4RoutingTable::getGatewayForDestAddr ( const IPv4Address dest) const
overridevirtual

Convenience function based on findBestMatchingRoute().

Returns the gateway for the destination address. Returns the unspecified address if the destination is not in routing table or the gateway field is not filled in in the route.

Implements inet::IIPv4RoutingTable.

484 {
485  Enter_Method("getGatewayForDestAddr(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here
486 
487  const IPv4Route *e = findBestMatchingRoute(dest);
488  return e ? e->getGateway() : IPv4Address();
489 }
virtual IPv4Route * findBestMatchingRoute(const IPv4Address &dest) const override
The routing function.
Definition: IPv4RoutingTable.cc:449
const value< double, units::C > e(1.602176487e-19)
cModule * inet::IPv4RoutingTable::getHostModule ( )
overridevirtual

Returns the host or router this routing table lives in.

Implements inet::IIPv4RoutingTable.

189 {
190  return findContainingNode(this);
191 }
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:56
InterfaceEntry * inet::IPv4RoutingTable::getInterfaceByAddress ( const IPv4Address address) const
overridevirtual

Returns an interface given by its address.

Returns nullptr if not found.

Implements inet::IIPv4RoutingTable.

317 {
318  Enter_Method("getInterfaceByAddress(%u.%u.%u.%u)", addr.getDByte(0), addr.getDByte(1), addr.getDByte(2), addr.getDByte(3)); // note: str().c_str() too slow here
319 
320  if (addr.isUnspecified())
321  return nullptr;
322  for (int i = 0; i < ift->getNumInterfaces(); ++i) {
323  InterfaceEntry *ie = ift->getInterface(i);
324  if (ie->ipv4Data()->getIPAddress() == addr)
325  return ie;
326  }
327  return nullptr;
328 }
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
virtual InterfaceEntry* inet::IPv4RoutingTable::getInterfaceByAddress ( const L3Address address) const
inlineoverridevirtual

Returns an interface given by its address.

Returns nullptr if not found.

Implements inet::IRoutingTable.

Referenced by getInterfaceByAddress().

381 { return getInterfaceByAddress(address.toIPv4()); }
virtual InterfaceEntry * getInterfaceByAddress(const IPv4Address &address) const override
Returns an interface given by its address.
Definition: IPv4RoutingTable.cc:316
InterfaceEntry * inet::IPv4RoutingTable::getInterfaceForDestAddr ( const IPv4Address dest) const
overridevirtual

Convenience function based on findBestMatchingRoute().

Returns the output interface for the packets with dest as destination address, or nullptr if the destination is not in routing table.

Implements inet::IIPv4RoutingTable.

476 {
477  Enter_Method("getInterfaceForDestAddr(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here
478 
479  const IPv4Route *e = findBestMatchingRoute(dest);
480  return e ? e->getInterface() : nullptr;
481 }
virtual IPv4Route * findBestMatchingRoute(const IPv4Address &dest) const override
The routing function.
Definition: IPv4RoutingTable.cc:449
const value< double, units::C > e(1.602176487e-19)
virtual IPv4MulticastRoute* inet::IPv4RoutingTable::getMulticastRoute ( int  k) const
inlineoverridevirtual

Returns the kth multicast route.

Implements inet::IIPv4RoutingTable.

326 { return k < (int)multicastRoutes.size() ? multicastRoutes[k] : nullptr; }
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
const double k
Definition: QAM16Modulation.cc:24
virtual L3Address inet::IPv4RoutingTable::getNextHopForDestination ( const L3Address dest) const
inlineoverridevirtual

Convenience function based on findBestMatchingRoute().

Returns the gateway for the destination address. Returns the unspecified address if the destination is not in routing table or the gateway field is not filled in in the route.

Implements inet::IRoutingTable.

384 { return getGatewayForDestAddr(dest.toIPv4()); } //XXX inconsistent names
virtual IPv4Address getGatewayForDestAddr(const IPv4Address &dest) const override
Convenience function based on findBestMatchingRoute().
Definition: IPv4RoutingTable.cc:483
virtual int inet::IPv4RoutingTable::getNumMulticastRoutes ( ) const
inlineoverridevirtual

Returns the total number of multicast routes.

Implements inet::IRoutingTable.

321 { return multicastRoutes.size(); }
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
virtual int inet::IPv4RoutingTable::getNumRoutes ( ) const
inlineoverridevirtual

Returns the total number of routes (unicast, multicast, plus the default route).

Implements inet::IRoutingTable.

286 { return routes.size(); }
RouteVector routes
Definition: IPv4RoutingTable.h:107
virtual InterfaceEntry* inet::IPv4RoutingTable::getOutputInterfaceForDestination ( const L3Address dest) const
inlineoverridevirtual

Convenience function based on findBestMatchingRoute().

Returns the output interface for the packets with dest as destination address, or nullptr if the destination is not in routing table.

Implements inet::IRoutingTable.

383 { return getInterfaceForDestAddr(dest.toIPv4()); } //XXX inconsistent names
virtual InterfaceEntry * getInterfaceForDestAddr(const IPv4Address &dest) const override
Convenience function based on findBestMatchingRoute().
Definition: IPv4RoutingTable.cc:475
IPv4Route * inet::IPv4RoutingTable::getRoute ( int  k) const
overridevirtual

Returns the kth route.

Implements inet::IIPv4RoutingTable.

508 {
509  if (k < (int)routes.size())
510  return routes[k];
511  return nullptr;
512 }
RouteVector routes
Definition: IPv4RoutingTable.h:107
const double k
Definition: QAM16Modulation.cc:24
virtual IPv4Address inet::IPv4RoutingTable::getRouterId ( ) const
inlineoverridevirtual

Returns routerId.

Implements inet::IIPv4RoutingTable.

211 { return routerId; }
IPv4Address routerId
Definition: IPv4RoutingTable.h:80
virtual L3Address inet::IPv4RoutingTable::getRouterIdAsGeneric ( ) const
inlineoverridevirtual

Returns routerId.

Implements inet::IRoutingTable.

379 { return getRouterId(); }
virtual IPv4Address getRouterId() const override
Returns routerId.
Definition: IPv4RoutingTable.h:211
void inet::IPv4RoutingTable::handleMessage ( cMessage *  msg)
overrideprotectedvirtual

Raises an error.

154 {
155  throw cRuntimeError("This module doesn't process messages");
156 }
bool inet::IPv4RoutingTable::handleOperationStage ( LifecycleOperation operation,
int  stage,
IDoneCallback doneCallback 
)
overridevirtual

ILifecycle method.

Implements inet::ILifecycle.

818 {
819  Enter_Method_Silent();
820  if (dynamic_cast<NodeStartOperation *>(operation)) {
822  // read routing table file (and interface configuration)
823  const char *filename = par("routingFile");
824  RoutingTableParser parser(ift, this);
825  if (*filename && parser.readRoutingTableFromFile(filename) == -1)
826  throw cRuntimeError("Error reading routing table file %s", filename);
827  }
831  isNodeUp = true;
832  }
833  }
834  else if (dynamic_cast<NodeShutdownOperation *>(operation)) {
836  while (!routes.empty())
837  delete removeRoute(routes[0]);
838  isNodeUp = false;
839  }
840  }
841  else if (dynamic_cast<NodeCrashOperation *>(operation)) {
843  while (!routes.empty())
844  delete removeRoute(routes[0]);
845  isNodeUp = false;
846  }
847  }
848  return true;
849 }
virtual void configureRouterId()
Definition: IPv4RoutingTable.cc:118
Definition: NodeOperations.h:50
RouteVector routes
Definition: IPv4RoutingTable.h:107
virtual void updateNetmaskRoutes()
Definition: IPv4RoutingTable.cc:776
Stage
Definition: NodeOperations.h:71
Stage
Definition: NodeOperations.h:126
virtual IPv4Route * removeRoute(IPv4Route *entry) override
Removes the given route from the routing table, and returns it.
Definition: IPv4RoutingTable.cc:612
bool isNodeUp
Definition: IPv4RoutingTable.h:84
Stage
Definition: NodeOperations.h:46
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
Definition: NodeOperations.h:127
void inet::IPv4RoutingTable::initialize ( int  stage)
overrideprotectedvirtual
63 {
64  cSimpleModule::initialize(stage);
65 
66  if (stage == INITSTAGE_LOCAL) {
67  // get a pointer to the host module and IInterfaceTable
68  cModule *host = getContainingNode(this);
69  host->subscribe(NF_INTERFACE_CREATED, this);
70  host->subscribe(NF_INTERFACE_DELETED, this);
71  host->subscribe(NF_INTERFACE_STATE_CHANGED, this);
72  host->subscribe(NF_INTERFACE_CONFIG_CHANGED, this);
73  host->subscribe(NF_INTERFACE_IPv4CONFIG_CHANGED, this);
74 
75  ift = getModuleFromPar<IInterfaceTable>(par("interfaceTableModule"), this);
76 
77  netmaskRoutes = par("netmaskRoutes");
78  forwarding = par("forwarding").boolValue();
79  multicastForward = par("multicastForwarding");
80  useAdminDist = par("useAdminDist");
81 
82  WATCH_PTRVECTOR(routes);
83  WATCH_PTRVECTOR(multicastRoutes);
84  WATCH(netmaskRoutes);
85  WATCH(forwarding);
86  WATCH(multicastForward);
87  WATCH(routerId);
88  }
89  else if (stage == INITSTAGE_NETWORK_LAYER) {
90  NodeStatus *nodeStatus = dynamic_cast<NodeStatus *>(findContainingNode(this)->getSubmodule("status"));
91  isNodeUp = !nodeStatus || nodeStatus->getState() == NodeStatus::UP;
92  if (isNodeUp) {
93  // set routerId if param is not "" (==no routerId) or "auto" (in which case we'll
94  // do it later in a later stage, after network configurators configured the interfaces)
95  const char *routerIdStr = par("routerId").stringValue();
96  if (strcmp(routerIdStr, "") && strcmp(routerIdStr, "auto"))
97  routerId = IPv4Address(routerIdStr);
98  }
99  }
100  else if (stage == INITSTAGE_NETWORK_LAYER_3) {
101  if (isNodeUp) {
102  // read routing table file (and interface configuration)
103  const char *filename = par("routingFile");
104  RoutingTableParser parser(ift, this);
105  if (*filename && parser.readRoutingTableFromFile(filename) == -1)
106  throw cRuntimeError("Error reading routing table file %s", filename);
107  }
108 
109  // routerID selection must be after network autoconfiguration assigned interface addresses
110  if (isNodeUp)
112 
113  // we don't use notifications during initialize(), so we do it manually.
115  }
116 }
virtual void configureRouterId()
Definition: IPv4RoutingTable.cc:118
Initialization of network-layer protocols, stage 3.
Definition: InitStages.h:84
RouteVector routes
Definition: IPv4RoutingTable.h:107
simsignal_t NF_INTERFACE_CONFIG_CHANGED
Definition: NotifierConsts.cc:51
virtual void updateNetmaskRoutes()
Definition: IPv4RoutingTable.cc:776
const char * netmaskRoutes
Definition: IPv4RoutingTable.h:81
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:56
Initialization of network-layer protocols, stage 1.
Definition: InitStages.h:72
Local initializations.
Definition: InitStages.h:35
simsignal_t NF_INTERFACE_STATE_CHANGED
Definition: NotifierConsts.cc:50
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:65
simsignal_t NF_INTERFACE_CREATED
Definition: NotifierConsts.cc:48
bool multicastForward
Definition: IPv4RoutingTable.h:83
simsignal_t NF_INTERFACE_IPv4CONFIG_CHANGED
Definition: NotifierConsts.cc:53
bool forwarding
Definition: IPv4RoutingTable.h:82
IPv4Address routerId
Definition: IPv4RoutingTable.h:80
bool isNodeUp
Definition: IPv4RoutingTable.h:84
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
simsignal_t NF_INTERFACE_DELETED
Definition: NotifierConsts.cc:49
bool useAdminDist
Definition: IPv4RoutingTable.h:85
Definition: NodeStatus.h:40
void inet::IPv4RoutingTable::internalAddMulticastRoute ( IPv4MulticastRoute entry)
protected
663 {
664  if (!entry->getOriginNetmask().isValidNetmask())
665  throw cRuntimeError("addMulticastRoute(): wrong netmask %s in multicast route", entry->getOriginNetmask().str().c_str());
666 
667  if ((entry->getOrigin().getInt() & ~entry->getOriginNetmask().getInt()) != 0)
668  throw cRuntimeError("addMulticastRoute(): suspicious route: origin IP address %s has bits set outside netmask %s",
669  entry->getOrigin().str().c_str(), entry->getOriginNetmask().str().c_str());
670 
671  if (!entry->getMulticastGroup().isUnspecified() && !entry->getMulticastGroup().isMulticast())
672  throw cRuntimeError("addMulticastRoute(): group address (%s) is not a multicast address",
673  entry->getMulticastGroup().str().c_str());
674 
675  // check that the interface exists
676  if (entry->getInInterface() && !entry->getInInterface()->getInterface()->isMulticast())
677  throw cRuntimeError("addMulticastRoute(): input interface must be multicast capable");
678 
679  for (unsigned int i = 0; i < entry->getNumOutInterfaces(); i++) {
680  IPv4MulticastRoute::OutInterface *outInterface = entry->getOutInterface(i);
681  if (!outInterface)
682  throw cRuntimeError("addMulticastRoute(): output interface cannot be nullptr");
683  else if (!outInterface->getInterface()->isMulticast())
684  throw cRuntimeError("addMulticastRoute(): output interface must be multicast capable");
685  else if (entry->getInInterface() && outInterface->getInterface() == entry->getInInterface()->getInterface())
686  throw cRuntimeError("addMulticastRoute(): output interface cannot be the same as the input interface");
687  }
688 
689  // add to tables
690  // we keep entries sorted by netmask desc, metric asc in routeList, so that we can
691  // stop at the first match when doing the longest netmask matching
692  auto pos =
693  upper_bound(multicastRoutes.begin(), multicastRoutes.end(), entry, multicastRouteLessThan);
694  multicastRoutes.insert(pos, entry);
695 
696  entry->setRoutingTable(this);
697 }
static bool multicastRouteLessThan(const IPv4MulticastRoute *a, const IPv4MulticastRoute *b)
Definition: IPv4RoutingTable.cc:644
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
void inet::IPv4RoutingTable::internalAddRoute ( IPv4Route entry)
protected
552 {
553  if (!entry->getNetmask().isValidNetmask())
554  throw cRuntimeError("addRoute(): wrong netmask %s in route", entry->getNetmask().str().c_str());
555 
556  if (entry->getNetmask().getInt() != 0 && (entry->getDestination().getInt() & entry->getNetmask().getInt()) == 0)
557  throw cRuntimeError("addRoute(): all bits of destination address %s is 0 inside non zero netmask %s",
558  entry->getDestination().str().c_str(), entry->getNetmask().str().c_str());
559 
560  if ((entry->getDestination().getInt() & ~entry->getNetmask().getInt()) != 0)
561  throw cRuntimeError("addRoute(): suspicious route: destination IP address %s has bits set outside netmask %s",
562  entry->getDestination().str().c_str(), entry->getNetmask().str().c_str());
563 
564  // check that the interface exists
565  if (!entry->getInterface())
566  throw cRuntimeError("addRoute(): interface cannot be nullptr");
567 
568  // if this is a default route, remove old default route (we're replacing it)
569  if (entry->getNetmask().isUnspecified()) {
570  IPv4Route *oldDefaultRoute = getDefaultRoute();
571  if (oldDefaultRoute != nullptr)
572  deleteRoute(oldDefaultRoute);
573  }
574 
575  // The 'routes' vector may contain multiple routes with the same destination/netmask.
576  // Routes are stored in descending netmask length and ascending administrative_distance/metric order,
577  // so the first matching is the best one.
578  // XXX Should only the route with the best metic be stored? Then the worse route should be deleted and
579  // internalAddRoute() should return a bool indicating if it was successful.
580 
581  // add to tables
582  // we keep entries sorted by netmask desc, metric asc in routeList, so that we can
583  // stop at the first match when doing the longest netmask matching
584  auto pos = upper_bound(routes.begin(), routes.end(), entry, RouteLessThan(*this));
585  routes.insert(pos, entry);
586 
587  entry->setRoutingTable(this);
588 }
virtual bool deleteRoute(IPv4Route *entry) override
Removes the given route from the routing table, and delete it.
Definition: IPv4RoutingTable.cc:628
RouteVector routes
Definition: IPv4RoutingTable.h:107
virtual IPv4Route * getDefaultRoute() const override
Finds and returns the default route, or nullptr if it doesn&#39;t exist.
Definition: IPv4RoutingTable.cc:514
IPv4MulticastRoute * inet::IPv4RoutingTable::internalRemoveMulticastRoute ( IPv4MulticastRoute entry)
protected
711 {
712  auto i = std::find(multicastRoutes.begin(), multicastRoutes.end(), entry);
713  if (i != multicastRoutes.end()) {
714  multicastRoutes.erase(i);
715  return entry;
716  }
717  return nullptr;
718 }
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
IPv4Route * inet::IPv4RoutingTable::internalRemoveRoute ( IPv4Route entry)
protected
603 {
604  auto i = std::find(routes.begin(), routes.end(), entry);
605  if (i != routes.end()) {
606  routes.erase(i);
607  return entry;
608  }
609  return nullptr;
610 }
RouteVector routes
Definition: IPv4RoutingTable.h:107
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
void inet::IPv4RoutingTable::invalidateCache ( )
protectedvirtual
239 {
240  routingCache.clear();
241  localAddresses.clear();
242  localBroadcastAddresses.clear();
243 }
AddressSet localBroadcastAddresses
Definition: IPv4RoutingTable.h:99
AddressSet localAddresses
Definition: IPv4RoutingTable.h:97
RoutingCache routingCache
Definition: IPv4RoutingTable.h:93
virtual bool inet::IPv4RoutingTable::isForwardingEnabled ( ) const
inlineoverridevirtual

IPv4 forwarding on/off.

Implements inet::IRoutingTable.

201 { return forwarding; }
bool forwarding
Definition: IPv4RoutingTable.h:82
bool inet::IPv4RoutingTable::isLocalAddress ( const IPv4Address dest) const
overridevirtual

Checks if the address is a local one, i.e.

one of the host's.

Implements inet::IIPv4RoutingTable.

347 {
348  Enter_Method("isLocalAddress(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here
349 
350  if (localAddresses.empty()) {
351  // collect interface addresses if not yet done
352  for (int i = 0; i < ift->getNumInterfaces(); i++) {
353  auto ipv4Data = ift->getInterface(i)->ipv4Data();
354  if (ipv4Data != nullptr)
355  localAddresses.insert(ipv4Data->getIPAddress());
356  }
357  }
358 
359  auto it = localAddresses.find(dest);
360  return it != localAddresses.end();
361 }
IPv4InterfaceData * ipv4Data() const
Definition: InterfaceEntry.h:221
AddressSet localAddresses
Definition: IPv4RoutingTable.h:97
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
virtual bool inet::IPv4RoutingTable::isLocalAddress ( const L3Address dest) const
inlineoverridevirtual

Checks if the address is a local one, i.e.

one of the host's.

Implements inet::IRoutingTable.

Referenced by isLocalAddress().

380 { return isLocalAddress(dest.toIPv4()); }
virtual bool isLocalAddress(const IPv4Address &dest) const override
Checks if the address is a local one, i.e.
Definition: IPv4RoutingTable.cc:346
bool inet::IPv4RoutingTable::isLocalBroadcastAddress ( const IPv4Address dest) const
overridevirtual

Checks if the address is a local network broadcast address, i.e.

one of the broadcast addresses derived from the interface addresses and netmasks.

Implements inet::IIPv4RoutingTable.

365 {
366  Enter_Method("isLocalBroadcastAddress(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here
367 
368  if (localBroadcastAddresses.empty()) {
369  // collect interface addresses if not yet done
370  for (int i = 0; i < ift->getNumInterfaces(); i++) {
371  InterfaceEntry *ie = ift->getInterface(i);
372  if (!ie->isBroadcast())
373  continue;
374  IPv4Address interfaceAddr = ie->ipv4Data()->getIPAddress();
375  IPv4Address broadcastAddr = interfaceAddr.makeBroadcastAddress(ie->ipv4Data()->getNetmask());
376  if (!broadcastAddr.isUnspecified()) {
377  localBroadcastAddresses.insert(broadcastAddr);
378  }
379  }
380  }
381 
382  auto it = localBroadcastAddresses.find(dest);
383  return it != localBroadcastAddresses.end();
384 }
IPv4InterfaceData * ipv4Data() const
Definition: InterfaceEntry.h:221
AddressSet localBroadcastAddresses
Definition: IPv4RoutingTable.h:99
IPv4Address makeBroadcastAddress(IPv4Address netmask) const
Returns the broadcast address for the given netmask.
Definition: IPv4Address.cc:275
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IPv4Address getIPAddress() const
Definition: IPv4InterfaceData.h:177
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
bool inet::IPv4RoutingTable::isLocalMulticastAddress ( const IPv4Address dest) const
overridevirtual

Checks if the address is in one of the local multicast group address list.

Implements inet::IIPv4RoutingTable.

401 {
402  Enter_Method("isLocalMulticastAddress(%u.%u.%u.%u)", dest.getDByte(0), dest.getDByte(1), dest.getDByte(2), dest.getDByte(3)); // note: str().c_str() too slow here
403 
404  for (int i = 0; i < ift->getNumInterfaces(); i++) {
405  InterfaceEntry *ie = ift->getInterface(i);
406  if (ie->ipv4Data()->isMemberOfMulticastGroup(dest))
407  return true;
408  }
409  return false;
410 }
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
virtual bool inet::IPv4RoutingTable::isLocalMulticastAddress ( const L3Address dest) const
inlineoverridevirtual

Checks if the address is in one of the local multicast group address list.

Implements inet::IRoutingTable.

Referenced by isLocalMulticastAddress().

385 { return isLocalMulticastAddress(dest.toIPv4()); }
virtual bool isLocalMulticastAddress(const IPv4Address &dest) const override
Checks if the address is in one of the local multicast group address list.
Definition: IPv4RoutingTable.cc:400
virtual bool inet::IPv4RoutingTable::isMulticastForwardingEnabled ( ) const
inlineoverridevirtual

IPv4 multicast forwarding on/off.

Implements inet::IRoutingTable.

206 { return multicastForward; }
bool multicastForward
Definition: IPv4RoutingTable.h:83
void inet::IPv4RoutingTable::multicastRouteChanged ( IPv4MulticastRoute entry,
int  fieldCode 
)
overridevirtual

To be called from multicast route objects whenever a field changes.

Used for maintaining internal data structures and firing "routing table changed" notifications.

Implements inet::IIPv4RoutingTable.

763 {
764  if (fieldCode == IPv4MulticastRoute::F_ORIGIN || fieldCode == IPv4MulticastRoute::F_ORIGINMASK ||
765  fieldCode == IPv4MulticastRoute::F_MULTICASTGROUP || fieldCode == IPv4MulticastRoute::F_METRIC) // our data structures depend on these fields
766  {
767  entry = internalRemoveMulticastRoute(entry);
768  ASSERT(entry != nullptr); // failure means inconsistency: route was not found in this routing table
770 
771  invalidateCache();
772  }
773  emit(NF_MROUTE_CHANGED, entry); // TODO include fieldCode in the notification
774 }
void internalAddMulticastRoute(IPv4MulticastRoute *entry)
Definition: IPv4RoutingTable.cc:662
Definition: IPv4Route.h:181
Definition: IPv4Route.h:181
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
Definition: IPv4Route.h:181
simsignal_t NF_MROUTE_CHANGED
Definition: NotifierConsts.cc:62
IPv4MulticastRoute * internalRemoveMulticastRoute(IPv4MulticastRoute *entry)
Definition: IPv4RoutingTable.cc:710
bool inet::IPv4RoutingTable::multicastRouteLessThan ( const IPv4MulticastRoute a,
const IPv4MulticastRoute b 
)
staticprotected
645 {
646  // We want routes with longer
647  // prefixes to be at front, so we compare them as "less".
648  if (a->getOriginNetmask() != b->getOriginNetmask())
649  return a->getOriginNetmask() > b->getOriginNetmask();
650 
651  // For metric, a smaller value is better (we report that as "less").
652  if (a->getOrigin() != b->getOrigin())
653  return a->getOrigin() < b->getOrigin();
654 
655  // put the unspecified group after the specified ones
656  if (a->getMulticastGroup() != b->getMulticastGroup())
657  return a->getMulticastGroup() > b->getMulticastGroup();
658 
659  return a->getMetric() < b->getMetric();
660 }
value< double, units::m > b
Definition: Units.h:1054
virtual int inet::IPv4RoutingTable::numInitStages ( ) const
inlineoverrideprotectedvirtual
158 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::IPv4RoutingTable::printMulticastRoutingTable ( ) const
overridevirtual

For debugging.

Implements inet::IIPv4RoutingTable.

266 {
267  EV << "-- Multicast routing table --\n";
268  EV << stringf("%-16s %-16s %-16s %-6s %-6s %s\n",
269  "Source", "Netmask", "Group", "Metric", "In", "Outs");
270 
271  for (int i = 0; i < getNumMulticastRoutes(); i++) {
272  IPv4MulticastRoute *route = getMulticastRoute(i);
273  EV << stringf("%-16s %-16s %-16s %-6d %-6s ",
274  route->getOrigin().isUnspecified() ? "*" : route->getOrigin().str().c_str(),
275  route->getOriginNetmask().isUnspecified() ? "*" : route->getOriginNetmask().str().c_str(),
276  route->getMulticastGroup().isUnspecified() ? "*" : route->getMulticastGroup().str().c_str(),
277  route->getMetric(),
278  !route->getInInterface() ? "*" : route->getInInterface()->getInterface()->getName());
279  for (unsigned int i = 0; i < route->getNumOutInterfaces(); i++) {
280  if (i != 0)
281  EV << ",";
282  EV << route->getOutInterface(i)->getInterface()->getName();
283  }
284  EV << "\n";
285  }
286  EV << "\n";
287 }
virtual IPv4MulticastRoute * getMulticastRoute(int k) const override
Returns the kth multicast route.
Definition: IPv4RoutingTable.h:326
std::string stringf(const char *fmt,...)
Accepts a printf-like argument list, and returns the result in a string.
Definition: INETUtils.cc:68
virtual int getNumMulticastRoutes() const override
Returns the total number of multicast routes.
Definition: IPv4RoutingTable.h:321
void inet::IPv4RoutingTable::printRoutingTable ( ) const
overridevirtual

For debugging.

Implements inet::IRoutingTable.

246 {
247  EV << "-- Routing table --\n";
248  EV << stringf("%-16s %-16s %-16s %-4s %-16s %s\n",
249  "Destination", "Netmask", "Gateway", "Iface", "", "Metric");
250 
251  for (int i = 0; i < getNumRoutes(); i++) {
252  IPv4Route *route = getRoute(i);
253  InterfaceEntry *interfacePtr = route->getInterface();
254  EV << stringf("%-16s %-16s %-16s %-4s (%s) %d\n",
255  route->getDestination().isUnspecified() ? "*" : route->getDestination().str().c_str(),
256  route->getNetmask().isUnspecified() ? "*" : route->getNetmask().str().c_str(),
257  route->getGateway().isUnspecified() ? "*" : route->getGateway().str().c_str(),
258  !interfacePtr ? "*" : interfacePtr->getName(),
259  !interfacePtr ? "* " : interfacePtr->ipv4Data()->getIPAddress().str().c_str(),
260  route->getMetric());
261  }
262  EV << "\n";
263 }
virtual IPv4Route * getRoute(int k) const override
Returns the kth route.
Definition: IPv4RoutingTable.cc:507
virtual int getNumRoutes() const override
Returns the total number of routes (unicast, multicast, plus the default route).
Definition: IPv4RoutingTable.h:286
std::string stringf(const char *fmt,...)
Accepts a printf-like argument list, and returns the result in a string.
Definition: INETUtils.cc:68
void inet::IPv4RoutingTable::purge ( )
overridevirtual

Deletes invalid routes from the routing table.

Invalid routes are those where the isValid() method returns false.

Implements inet::IIPv4RoutingTable.

413 {
414  bool deleted = false;
415 
416  // purge unicast routes
417  for (auto it = routes.begin(); it != routes.end(); ) {
418  IPv4Route *route = *it;
419  if (route->isValid())
420  ++it;
421  else {
422  it = routes.erase(it);
423  ASSERT(route->getRoutingTable() == this); // still filled in, for the listeners' benefit
424  emit(NF_ROUTE_DELETED, route);
425  delete route;
426  deleted = true;
427  }
428  }
429 
430  // purge multicast routes
431  for (auto it = multicastRoutes.begin(); it != multicastRoutes.end(); ) {
432  IPv4MulticastRoute *route = *it;
433  if (route->isValid())
434  ++it;
435  else {
436  it = multicastRoutes.erase(it);
437  ASSERT(route->getRoutingTable() == this); // still filled in, for the listeners' benefit
438  emit(NF_MROUTE_DELETED, route);
439  delete route;
440  deleted = true;
441  }
442  }
443 
444  if (deleted) {
445  invalidateCache();
446  }
447 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
RouteVector routes
Definition: IPv4RoutingTable.h:107
simsignal_t NF_MROUTE_DELETED
Definition: NotifierConsts.cc:61
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
void inet::IPv4RoutingTable::receiveSignal ( cComponent *  source,
simsignal_t  signalID,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual

Called by the signal handler whenever a change of a category occurs to which this client has subscribed.

159 {
160  if (getSimulation()->getContextType() == CTX_INITIALIZE)
161  return; // ignore notifications during initialize
162 
163  Enter_Method_Silent();
164  printNotificationBanner(signalID, obj);
165 
166  if (signalID == NF_INTERFACE_CREATED) {
167  // add netmask route for the new interface
169  }
170  else if (signalID == NF_INTERFACE_DELETED) {
171  // remove all routes that point to that interface
172  const InterfaceEntry *entry = check_and_cast<const InterfaceEntry *>(obj);
173  deleteInterfaceRoutes(entry);
174  }
175  else if (signalID == NF_INTERFACE_STATE_CHANGED) {
176  invalidateCache();
177  }
178  else if (signalID == NF_INTERFACE_CONFIG_CHANGED) {
179  invalidateCache();
180  }
181  else if (signalID == NF_INTERFACE_IPv4CONFIG_CHANGED) {
182  // if anything IPv4-related changes in the interfaces, interface netmask
183  // based routes have to be re-built.
185  }
186 }
virtual void deleteInterfaceRoutes(const InterfaceEntry *entry)
Definition: IPv4RoutingTable.cc:193
simsignal_t NF_INTERFACE_CONFIG_CHANGED
Definition: NotifierConsts.cc:51
virtual void updateNetmaskRoutes()
Definition: IPv4RoutingTable.cc:776
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
simsignal_t NF_INTERFACE_STATE_CHANGED
Definition: NotifierConsts.cc:50
simsignal_t NF_INTERFACE_CREATED
Definition: NotifierConsts.cc:48
simsignal_t NF_INTERFACE_IPv4CONFIG_CHANGED
Definition: NotifierConsts.cc:53
void printNotificationBanner(simsignal_t signalID, const cObject *obj)
Utility function.
Definition: NotifierConsts.cc:109
simsignal_t NF_INTERFACE_DELETED
Definition: NotifierConsts.cc:49
void inet::IPv4RoutingTable::refreshDisplay ( ) const
overrideprotectedvirtual
144 {
145  char buf[80];
146  if (routerId.isUnspecified())
147  sprintf(buf, "%d+%d routes", (int)routes.size(), (int)multicastRoutes.size());
148  else
149  sprintf(buf, "routerId: %s\n%d+%d routes", routerId.str().c_str(), (int)routes.size(), (int)multicastRoutes.size());
150  getDisplayString().setTagArg("t", 0, buf);
151 }
bool isUnspecified() const
True if all four address bytes are zero.
Definition: IPv4Address.h:176
std::string str(bool printUnspec=true) const
Returns the string representation of the address (e.g.
Definition: IPv4Address.cc:109
RouteVector routes
Definition: IPv4RoutingTable.h:107
IPv4Address routerId
Definition: IPv4RoutingTable.h:80
MulticastRouteVector multicastRoutes
Definition: IPv4RoutingTable.h:110
IPv4MulticastRoute * inet::IPv4RoutingTable::removeMulticastRoute ( IPv4MulticastRoute entry)
overridevirtual

Removes the given route from the routing table, and returns it.

nullptr is returned of the route was not in the routing table.

Implements inet::IIPv4RoutingTable.

721 {
722  Enter_Method("removeMulticastRoute(...)");
723 
724  entry = internalRemoveMulticastRoute(entry);
725 
726  if (entry != nullptr) {
727  invalidateCache();
728  ASSERT(entry->getRoutingTable() == this); // still filled in, for the listeners' benefit
729  emit(NF_MROUTE_DELETED, entry);
730  entry->setRoutingTable(nullptr);
731  }
732  return entry;
733 }
simsignal_t NF_MROUTE_DELETED
Definition: NotifierConsts.cc:61
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
IPv4MulticastRoute * internalRemoveMulticastRoute(IPv4MulticastRoute *entry)
Definition: IPv4RoutingTable.cc:710
virtual IMulticastRoute* inet::IPv4RoutingTable::removeMulticastRoute ( IMulticastRoute entry)
inlineoverrideprivatevirtual

Removes the given route from the routing table, and returns it.

nullptr is returned of the route was not in the routing table.

Implements inet::IRoutingTable.

Referenced by removeMulticastRoute().

395 { return removeMulticastRoute(check_and_cast<IPv4MulticastRoute *>(entry)); }
virtual IPv4MulticastRoute * removeMulticastRoute(IPv4MulticastRoute *entry) override
Removes the given route from the routing table, and returns it.
Definition: IPv4RoutingTable.cc:720
IPv4Route * inet::IPv4RoutingTable::removeRoute ( IPv4Route entry)
overridevirtual

Removes the given route from the routing table, and returns it.

nullptr is returned of the route was not in the routing table.

Implements inet::IIPv4RoutingTable.

613 {
614  Enter_Method("removeRoute(...)");
615 
616  entry = internalRemoveRoute(entry);
617 
618  if (entry != nullptr) {
619  EV_INFO << "remove route " << entry->info() << "\n";
620  invalidateCache();
621  ASSERT(entry->getRoutingTable() == this); // still filled in, for the listeners' benefit
622  emit(NF_ROUTE_DELETED, entry);
623  entry->setRoutingTable(nullptr);
624  }
625  return entry;
626 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
IPv4Route * internalRemoveRoute(IPv4Route *entry)
Definition: IPv4RoutingTable.cc:602
virtual IRoute* inet::IPv4RoutingTable::removeRoute ( IRoute entry)
inlineoverrideprivatevirtual

Removes the given route from the routing table, and returns it.

nullptr is returned if the route was not in the routing table.

Implements inet::IRoutingTable.

Referenced by removeRoute().

391 { return removeRoute(check_and_cast<IPv4Route *>(entry)); }
virtual IPv4Route * removeRoute(IPv4Route *entry) override
Removes the given route from the routing table, and returns it.
Definition: IPv4RoutingTable.cc:612
void inet::IPv4RoutingTable::routeChanged ( IPv4Route entry,
int  fieldCode 
)
overridevirtual

To be called from route objects whenever a field changes.

Used for maintaining internal data structures and firing "routing table changed" notifications.

Implements inet::IIPv4RoutingTable.

751 {
752  if (fieldCode == IPv4Route::F_DESTINATION || fieldCode == IPv4Route::F_PREFIX_LENGTH || fieldCode == IPv4Route::F_METRIC) { // our data structures depend on these fields
753  entry = internalRemoveRoute(entry);
754  ASSERT(entry != nullptr); // failure means inconsistency: route was not found in this routing table
755  internalAddRoute(entry);
756 
757  invalidateCache();
758  }
759  emit(NF_ROUTE_CHANGED, entry); // TODO include fieldCode in the notification
760 }
Definition: IRoute.h:64
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
Definition: IRoute.h:57
void internalAddRoute(IPv4Route *entry)
Definition: IPv4RoutingTable.cc:551
simsignal_t NF_ROUTE_CHANGED
Definition: NotifierConsts.cc:59
IPv4Route * internalRemoveRoute(IPv4Route *entry)
Definition: IPv4RoutingTable.cc:602
Definition: IRoute.h:58
bool inet::IPv4RoutingTable::routeLessThan ( const IPv4Route a,
const IPv4Route b 
) const
protected

Referenced by inet::IPv4RoutingTable::RouteLessThan::operator()().

528 {
529  // longer prefixes are better, because they are more specific
530  if (a->getNetmask() != b->getNetmask())
531  return a->getNetmask() > b->getNetmask();
532 
533  if (a->getDestination() != b->getDestination())
534  return a->getDestination() < b->getDestination();
535 
536  // for the same destination/netmask:
537 
538  // smaller administration distance is better (if useAdminDist)
539  if (useAdminDist && (a->getAdminDist() != b->getAdminDist()))
540  return a->getAdminDist() < b->getAdminDist();
541 
542  // smaller metric is better
543  return a->getMetric() < b->getMetric();
544 }
bool useAdminDist
Definition: IPv4RoutingTable.h:85
value< double, units::m > b
Definition: Units.h:1054
void inet::IPv4RoutingTable::setRouterId ( IPv4Address  a)
overridevirtual

Sets routerId.

Implements inet::IIPv4RoutingTable.

547 {
548  routerId = a;
549 }
IPv4Address routerId
Definition: IPv4RoutingTable.h:80
void inet::IPv4RoutingTable::updateNetmaskRoutes ( )
protectedvirtual
777 {
778  // first, delete all routes with src=IFACENETMASK
779  for (unsigned int k = 0; k < routes.size(); k++) {
780  if (routes[k]->getSourceType() == IRoute::IFACENETMASK) {
781  auto it = routes.begin() + (k--); // '--' is necessary because indices shift down
782  IPv4Route *route = *it;
783  routes.erase(it);
784  ASSERT(route->getRoutingTable() == this); // still filled in, for the listeners' benefit
785  emit(NF_ROUTE_DELETED, route);
786  delete route;
787  }
788  }
789 
790  // then re-add them, according to actual interface configuration
791  // TODO: say there's a node somewhere in the network that belongs to the interface's subnet
792  // TODO: and it is not on the same link, and the gateway does not use proxy ARP, how will packets reach that node?
793  PatternMatcher interfaceNameMatcher(netmaskRoutes, false, true, true);
794  for (int i = 0; i < ift->getNumInterfaces(); i++) {
795  InterfaceEntry *ie = ift->getInterface(i);
796  if (interfaceNameMatcher.matches(ie->getFullName()) && ie->ipv4Data() && ie->ipv4Data()->getNetmask() != IPv4Address::ALLONES_ADDRESS)
797  {
798  IPv4Route *route = createNewRoute();
799  route->setSourceType(IRoute::IFACENETMASK);
800  route->setSource(ie);
801  route->setDestination(ie->ipv4Data()->getIPAddress().doAnd(ie->ipv4Data()->getNetmask()));
802  route->setNetmask(ie->ipv4Data()->getNetmask());
803  route->setGateway(IPv4Address());
804  route->setAdminDist(IPv4Route::dDirectlyConnected);
805  route->setMetric(ie->ipv4Data()->getMetric());
806  route->setInterface(ie);
807  route->setRoutingTable(this);
808  auto pos = upper_bound(routes.begin(), routes.end(), route, RouteLessThan(*this));
809  routes.insert(pos, route);
810  emit(NF_ROUTE_ADDED, route);
811  }
812  }
813 
814  invalidateCache();
815 }
simsignal_t NF_ROUTE_DELETED
Definition: NotifierConsts.cc:58
RouteVector routes
Definition: IPv4RoutingTable.h:107
const char * netmaskRoutes
Definition: IPv4RoutingTable.h:81
comes from an interface&#39;s netmask
Definition: IRoute.h:41
virtual void invalidateCache()
Definition: IPv4RoutingTable.cc:238
virtual int getNumInterfaces() const =0
Returns the number of interfaces.
Definition: IPv4Route.h:41
simsignal_t NF_ROUTE_ADDED
Definition: NotifierConsts.cc:57
virtual IPv4Route * createNewRoute()
Definition: IPv4RoutingTable.cc:851
IInterfaceTable * ift
Definition: IPv4RoutingTable.h:78
static const IPv4Address ALLONES_ADDRESS
255.255.255.255
Definition: IPv4Address.h:105
virtual InterfaceEntry * getInterface(int pos) const =0
Returns the InterfaceEntry specified by an index 0..numInterfaces-1.
const double k
Definition: QAM16Modulation.cc:24

Member Data Documentation

bool inet::IPv4RoutingTable::forwarding = false
protected
IInterfaceTable* inet::IPv4RoutingTable::ift = nullptr
protected
bool inet::IPv4RoutingTable::isNodeUp = false
protected
AddressSet inet::IPv4RoutingTable::localAddresses
mutableprotected
AddressSet inet::IPv4RoutingTable::localBroadcastAddresses
mutableprotected
bool inet::IPv4RoutingTable::multicastForward = false
protected
MulticastRouteVector inet::IPv4RoutingTable::multicastRoutes
private
const char* inet::IPv4RoutingTable::netmaskRoutes = nullptr
protected
IPv4Address inet::IPv4RoutingTable::routerId
protected
RouteVector inet::IPv4RoutingTable::routes
private
RoutingCache inet::IPv4RoutingTable::routingCache
mutableprotected
bool inet::IPv4RoutingTable::useAdminDist = false
protected

The documentation for this class was generated from the following files: