Bug 1881 - assert failed. cond="address.m_len <= Address::MAX_SIZE"
assert failed. cond="address.m_len <= Address::MAX_SIZE"
Status: RESOLVED DUPLICATE of bug 1870
Product: ns-3
Classification: Unclassified
Component: network
ns-3-dev
PC Linux
: P5 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-14 08:49 UTC by Taqi
Modified: 2014-03-14 17:51 UTC (History)
1 user (show)

See Also:


Attachments
replace AsInt with strtoul in address.cc (1.57 KB, patch)
2014-03-14 08:49 UTC, Taqi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Taqi 2014-03-14 08:49:31 UTC
Created attachment 1802 [details]
replace AsInt with strtoul in address.cc

When trying to set default value for an 'Address' attribute using a ConfigStore the above assertion fails. Even when the value being set is the same as the default value.
I used udp-trace-client-server.cc to reproduce the bug. I just read the default attribute values, then isolated these two lines without any changes in input-attributes.txt: 
default ns3::UdpClient::RemoteAddress "00-00-00"
default ns3::UdpTraceClient::RemoteAddress "00-00-00"

The configuration is loaded this way:
  
  Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("input-attributes.txt"));
  Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Load"));
  Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("RawText"));
  ConfigStore inputConfig;
  inputConfig.ConfigureDefaults ();

That's when the bug is triggered. Obviously any other value will trigger the 'assert fail'.

I suspect it is related to the AsInt() function in address.cc, I had to replace it with strtoul to get around this problem (A patch is attached).
Comment 1 Tommaso Pecorella 2014-03-14 17:00:43 UTC
Hi,

I have some doubts about this bug. However they're mostly academic. AsInt has been already replaced by strtoul as strtoul is 20x faster than AsInt...

It's nice when you remove a bug you wasn't aware of, isn't it ?

Mind updating ns-3-dev to the latest version and check that everything is working as intended ?
Comment 2 Taqi 2014-03-14 17:49:28 UTC
Indeed, it has already been fixed. I made the stupid mistake of forgetting an 'hg up'. I wasted some time on that one!.
Comment 3 Tommaso Pecorella 2014-03-14 17:51:45 UTC

*** This bug has been marked as a duplicate of bug 1870 ***