Bug 1881

Summary: assert failed. cond="address.m_len <= Address::MAX_SIZE"
Product: ns-3 Reporter: Taqi <takai.kenn>
Component: networkAssignee: ns-bugs <ns-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: tommaso.pecorella
Priority: P5    
Version: ns-3-dev   
Hardware: PC   
OS: Linux   
Attachments: replace AsInt with strtoul in address.cc

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 ***