Bug 173 - Comparing one Address to another is a PITA
Comparing one Address to another is a PITA
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: network
pre-release
All All
: P3 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-16 04:58 UTC by Gustavo J. A. M. Carneiro
Modified: 2008-07-01 13:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2008-04-16 04:58:35 UTC
Because of this:

bool operator == (const Address &a, const Address &b)
{
  NS_ASSERT (a.m_type == b.m_type || 
	     a.m_type == 0 || 
	     b.m_type == 0);
  NS_ASSERT (a.GetLength() == b.GetLength());  
  return memcmp (a.m_data, b.m_data, a.m_len) == 0;
}

If I try to compare addresses of different types, NS-3 aborts.  Why?  Addresses of different types should just compare not equal, nothing more.  Especially since there is no method to get the type of a generic Address...
Comment 1 Mathieu Lacage 2008-04-16 12:16:58 UTC
looks good to me. Feel free to apply.
Comment 2 Gustavo J. A. M. Carneiro 2008-04-16 12:28:56 UTC
http://code.nsnam.org/ns-3-dev/rev/6244ea5e7831