Fix bug 606: Arp depends on IP routing system

This commit is contained in:
Tom Henderson
2009-12-11 23:23:37 -08:00
parent 74e5bc66c7
commit 741de0e8f2
4 changed files with 98 additions and 9 deletions

View File

@@ -215,6 +215,44 @@ public:
*/
virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
/**
* \brief Return the first primary source address with scope less than
* or equal to the requested scope, to use in sending a packet to
* destination dst out of the specified device.
*
* This method mirrors the behavior of Linux inet_select_addr() and is
* provided because interfaces may have multiple IP addresses configured
* on them with different scopes, and with a primary and secondary status.
* Secondary addresses are never returned.
* \see Ipv4InterfaceAddress
*
* If a non-zero device pointer is provided, the method first tries to
* return a primary address that is configured on that device, and whose
* subnet matches that of dst and whose scope is less than or equal to
* the requested scope. If a primary address does not match the
* subnet of dst but otherwise matches the scope, it is returned.
* If no such address on the device is found, the other devices are
* searched in order of their interface index, but not considering dst
* as a factor in the search. Because a loopback interface is typically
* the first one configured on a node, it will be the first alternate
* device to be tried. Addresses scoped at LINK scope are not returned
* in this phase.
*
* If no device pointer is provided, the same logic as above applies, only
* that there is no preferred device that is consulted first. This means
* that if the device pointer is null, input parameter dst will be ignored.
*
* If there are no possible addresses to return, a warning log message
* is issued and the all-zeroes address is returned.
*
* \param device output NetDevice (optionally provided, only to constrain the search)
* \param dst Destination address to match, if device is provided
* \param scope Scope of returned address must be less than or equal to this
* \returns the first primary Ipv4Address that meets the search criteria
*/
virtual Ipv4Address SelectSourceAddress (Ptr<const NetDevice> device,
Ipv4Address dst, Ipv4InterfaceAddress::InterfaceAddressScope_e scope) = 0;
/**
* \param interface The interface number of an Ipv4 interface
* \param metric routing metric (cost) associated to the underlying