Bug 1464 - ConfigStore Save + Load => Could not set default value for ns3::UdpSocketImpl::IcmpCallback
ConfigStore Save + Load => Could not set default value for ns3::UdpSocketImpl...
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: config-store
ns-3-dev
All All
: P5 normal
Assigned To: Mitch Watrous
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-26 12:45 UTC by Nicola Baldo
Modified: 2012-07-11 13:31 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola Baldo 2012-06-26 12:45:26 UTC
changeset f43017db07ec 

I get this error when using the ConfigStore trying to Save a config file and then Load it again.

The bug can be reproduced with the following sequence of two commands. First this:

$ ./waf --command-template="%s --ns3::ConfigStore::Filename=conf.txt --simTime=0.008 --ns3::ConfigStore::Mode=Save" --run src/lte/examples/lena-dual-stripe

[conf.txt generated successfully]

then this:

$ ./waf --command-template="%s --ns3::ConfigStore::Filename=conf.txt --simTime=0.008 --ns3::ConfigStore::Mode=Load" --run src/lte/examples/lena-dual-stripe
Waf: Entering directory `/locale/ns-3-dev/build'
Waf: Leaving directory `/locale/ns-3-dev/build'
'build' finished successfully (0.907s)
msg="Could not set default value for ns3::UdpSocketImpl::IcmpCallback", file=../src/core/model/config.cc, line=627
terminate called without an active exception
Command ['/locale/ns-3-dev/build/src/lte/examples/ns3-dev-lena-dual-stripe-debug', '--ns3::ConfigStore::Filename=conf.txt', '--simTime=0.008', '--ns3::ConfigStore::Mode=Load'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>").


As a workaround, removing the following two entries in the conf file

default ns3::UdpSocketImpl::IcmpCallback "0"
default ns3::UdpSocketImpl::IcmpCallback6 "0"

makes it load properly.
Comment 1 Mitch Watrous 2012-07-09 20:10:07 UTC
Here are the attributes of interest for the UdpSocketImpl class:

    .AddAttribute ("IcmpCallback", "Callback invoked whenever an icmp error is received on this socket.",
                   CallbackValue (),
                   MakeCallbackAccessor (&UdpSocketImpl::m_icmpCallback),
                   MakeCallbackChecker ())
    .AddAttribute ("IcmpCallback6", "Callback invoked whenever an icmpv6 error is received on this socket.",
                   CallbackValue (),
                   MakeCallbackAccessor (&UdpSocketImpl::m_icmpCallback6),
                   MakeCallbackChecker ())

Default attribute values are currently stored as strings by the ConfigStore in the configuration file:

       ...
    default ns3::ArpCache::MaxRetries "3"
    default ns3::ArpCache::PendingQueueSize "3"
    default ns3::UdpSocketImpl::IcmpCallback "0"
    default ns3::UdpSocketImpl::IcmpCallback6 "0"
    default ns3::UdpSocket::RcvBufSize "131072"
    default ns3::UdpSocket::IpTtl "0"
       ...

In principle any arbitrary callback could be set as the default callback attribute, but there is no way to represent any arbitrary callback function as a string.

I propose that the writing and reading of default callback attributes should be disabled.
Comment 2 Mitch Watrous 2012-07-11 13:31:03 UTC
Bug fixed.

ns-3-dev changeset:  b5ef4158fb8f