From: JINMEI Tatuya Date: Tue, 31 Jan 2012 22:43:45 +0000 (-0800) Subject: [1578] set RESULT_WILDCARD flag for SUCCESS case X-Git-Tag: trac2351_base~268^2~4^2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ceeb013ba37445e7728d82a850c69d8b2c3377b0;p=thirdparty%2Fkea.git [1578] set RESULT_WILDCARD flag for SUCCESS case --- diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc index 0a3280be4a..22864f8447 100644 --- a/src/lib/datasrc/memory_datasrc.cc +++ b/src/lib/datasrc/memory_datasrc.cc @@ -626,6 +626,16 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { } } + FindResult createFindResult(Result code, ConstRRsetPtr rrset, + bool wild) const + { + FindResultFlags flags = RESULT_DEFAULT; + if (wild) { + flags = flags | RESULT_WILDCARD; + } + return (FindResult(code, rrset, flags)); + } + // Implementation of InMemoryZoneFinder::find FindResult find(const Name& name, RRType type, std::vector *target, @@ -665,13 +675,14 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { // We were traversing a DNAME node (and wanted to go // lower below it), so return the DNAME return (FindResult(DNAME, prepareRRset(name, state.rrset_, - rename))); + false))); } if (state.zonecut_node_ != NULL) { LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_DELEG_FOUND). arg(state.rrset_->getName()); - return (FindResult(DELEGATION, prepareRRset(name, - state.rrset_, rename))); + return (FindResult(DELEGATION, + prepareRRset(name, state.rrset_, + false))); } // If the RBTree search stopped at a node for a super domain @@ -722,7 +733,7 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { DATASRC_MEM_WILDCARD_CANCEL).arg(name); return (FindResult(NXDOMAIN, ConstRRsetPtr())); } - Name wildcard(Name("*").concatenate( + const Name wildcard(Name("*").concatenate( node_path.getAbsoluteName())); DomainTree::Result result = zone_data_->domains_.find(wildcard, &node); @@ -773,8 +784,8 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { if (found != node->getData()->end()) { LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_EXACT_DELEGATION).arg(name); - return (FindResult(DELEGATION, prepareRRset(name, - found->second, rename))); + return (FindResult(DELEGATION, + prepareRRset(name, found->second, rename))); } } @@ -796,15 +807,16 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { // Good, it is here LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_SUCCESS).arg(name). arg(type); - return (FindResult(SUCCESS, prepareRRset(name, found->second, - rename))); + return (createFindResult(SUCCESS, prepareRRset(name, + found->second, + rename), rename)); } else { // Next, try CNAME. found = node->getData()->find(RRType::CNAME()); if (found != node->getData()->end()) { LOG_DEBUG(logger, DBG_TRACE_DATA, DATASRC_MEM_CNAME).arg(name); return (FindResult(CNAME, prepareRRset(name, found->second, - rename))); + rename))); } } // No exact match or CNAME. Return NXRRSET.