From 6318da07a6773dbf631d56a86119fd1bf9c3c430 Mon Sep 17 00:00:00 2001 From: Mitch Watrous Date: Tue, 29 Apr 2014 22:38:13 +0200 Subject: [PATCH] Bug 1717 - Detect unsettable attributes --- RELEASE_NOTES | 1 + src/core/model/object-base.cc | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 919e4b920..9b50454f6 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -46,6 +46,7 @@ Bugs fixed - Bug 1276 - optimize NistErrorRateModel - Bug 1294 - New PeekU8 () and Read (Buffer::Iterator start, uint32_t size) methods in Buffer::Iterator - Bug 1653 - Extension of CommandLine interface: restored operator << (CommandLine) +- Bug 1717 - Detect unsettable attributes - Bug 1739 - The endpoint is not deallocated for UDP sockets - Bug 1786 - os << int64x64_t prints un-normalized fractional values - Bug 1787 - Runtime error when using AnimationInterface::EnablePacketMetadata() to fetch metadata of CSMA packet diff --git a/src/core/model/object-base.cc b/src/core/model/object-base.cc index 470189684..db2182131 100644 --- a/src/core/model/object-base.cc +++ b/src/core/model/object-base.cc @@ -75,13 +75,29 @@ ObjectBase::ConstructSelf (const AttributeConstructionList &attributes) struct TypeId::AttributeInformation info = tid.GetAttribute(i); NS_LOG_DEBUG ("try to construct \""<< tid.GetName ()<<"::"<< info.name <<"\""); - if (!(info.flags & TypeId::ATTR_CONSTRUCT)) - { - continue; - } - bool found = false; // is this attribute stored in this AttributeConstructionList instance ? Ptr value = attributes.Find(info.checker); + // See if this attribute should not be set here in the + // constructor. + if (!(info.flags & TypeId::ATTR_CONSTRUCT)) + { + // Handle this attribute if it should not be + // set here. + if (value == 0) + { + // Skip this attribute if it's not in the + // AttributeConstructionList. + continue; + } + else + { + // This is an error because this attribute is not + // settable in its constructor but is present in + // the AttributeConstructionList. + NS_FATAL_ERROR ("Attribute name="<