Bugzilla – Bug 588
"New" Ipv4: cannot change address
Last modified: 2009-06-19 11:08:58 UTC
The previous Ipv4 object had SetAddress and SetMask methods that could be used to change the address. The current seems to lack them, and this is critical when adding an interface/an address is not an option.
API proposal: --- a/src/node/ipv4.h Sat Jun 13 14:59:35 2009 -0700 +++ b/src/node/ipv4.h Sat Jun 13 15:35:17 2009 -0700 @@ -159,9 +159,9 @@ public: /** * \param interface Interface number of an Ipv4 interface * \param address Ipv4InterfaceAddress address to associate with the underlying Ipv4 interface - * \returns The address index of the newly-added address + * \returns true if the operation succeeded */ - virtual uint32_t AddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0; + virtual bool AddAddress (uint32_t interface, Ipv4InterfaceAddress address) = 0; /** * \param interface Interface number of an Ipv4 interface @@ -170,11 +170,26 @@ public: virtual uint32_t GetNAddresses (uint32_t interface) const = 0; /** + * Because addresses can be removed, the addressIndex is not guaranteed + * to be static across calls to this method. + * * \param interface Interface number of an Ipv4 interface * \param addressIndex index of Ipv4InterfaceAddress * \returns the Ipv4InterfaceAddress associated to the interface and addresIndex */ virtual Ipv4InterfaceAddress GetAddress (uint32_t interface, uint32_t addressIndex) const = 0; + + /** + * Remove the address at addressIndex on named interface. The addressIndex + * for all higher indices will decrement by one after this method is called; + * so, for example, to remove 5 addresses from an interface i, one could + * call RemoveAddress (i, 0); 5 times. + * + * \param interface Interface number of an Ipv4 interface + * \param addressIndex index of Ipv4InterfaceAddress to remove + * \returns true if the operation succeeded + */ + virtual bool RemoveAddress (uint32_t interface, uint32_t addressIndex) = 0;
Created attachment 465 [details] untested patch to fix
+1
changeset 55948d1baa64