daemon: Support query that explicitly specify version

Change-Id: I8eac2c5d2a646fbb965691498f8d416a86b70763
diff --git a/src/daemon/name-server.cpp b/src/daemon/name-server.cpp
index f796e13..7411697 100644
--- a/src/daemon/name-server.cpp
+++ b/src/daemon/name-server.cpp
@@ -95,7 +95,8 @@
 
   NDNS_LOG_TRACE("query record: " << interest.getName());
 
-  if (m_dbMgr.find(rrset)) {
+  if (m_dbMgr.find(rrset) &&
+      (re.version.empty() || re.version == rrset.getVersion())) {
     // find the record: NDNS-RESP, NDNS-AUTH, NDNS-RAW, or NDNS-NACK
     shared_ptr<Data> answer = make_shared<Data>(rrset.getData());
     NDNS_LOG_TRACE("answer query with existing Data: " << answer->getName());