BIND 10 trac2776, updated. 9a5b9919090672e9c01282f6f75e91a66ec5439c [2776] Don't parse the stack as DNS message

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Feb 28 10:06:24 UTC 2013


The branch, trac2776 has been updated
       via  9a5b9919090672e9c01282f6f75e91a66ec5439c (commit)
      from  abe72e9dff228269f889379f63228001e807982c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9a5b9919090672e9c01282f6f75e91a66ec5439c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Feb 28 11:05:47 2013 +0100

    [2776] Don't parse the stack as DNS message
    
    Also add many debug outputs to help finding it out.

-----------------------------------------------------------------------

Summary of changes:
 src/bin/receptionist/main.cc         |    4 +++-
 src/lib/asiodns/asiodns_messages.mes |    8 ++++++++
 src/lib/asiodns/tcp_server.cc        |    7 +++++--
 3 files changed, 16 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/receptionist/main.cc b/src/bin/receptionist/main.cc
index e9819e3..cf84172 100644
--- a/src/bin/receptionist/main.cc
+++ b/src/bin/receptionist/main.cc
@@ -22,7 +22,7 @@ namespace {
 // Configuration constants
 const uint16_t listen_port = 5310;
 const uint16_t up_port = 5311;
-const size_t conn_count = 4;
+const size_t conn_count = 1;
 const size_t event_cnt = 10;
 const size_t buffer_size = 6553600;
 const size_t msg_size = 65536;
@@ -66,6 +66,7 @@ void udp_ready(size_t) {
     int result;
     CHECK(result = recvmmsg(udp_socket, udp_headers, maxmsg_count, MSG_DONTWAIT, NULL));
     for (size_t i = 0; i < result; i ++) {
+        printf("Adding message of size %u\n", udp_headers[i].msg_len);
         size_t upstream = random() % conn_count;
         uint16_t len = htons(udp_headers[i].msg_len);
         memcpy(conns[upstream].buff + conns[upstream].buff_size, &len, 2);
@@ -130,6 +131,7 @@ int main() {
         for (size_t i = 0; i < conn_count; i ++) {
             if (conns[i].buff_size == 4)
                 continue;
+            printf("Sending batch of %zu bytes\n", conns[i].buff_size - 4);
             uint32_t size = htonl(conns[i].buff_size - 4);
             memcpy(conns[i].buff, &size, 4);
             size_t pos = 0;
diff --git a/src/lib/asiodns/asiodns_messages.mes b/src/lib/asiodns/asiodns_messages.mes
index db2902e..b22a70b 100644
--- a/src/lib/asiodns/asiodns_messages.mes
+++ b/src/lib/asiodns/asiodns_messages.mes
@@ -78,3 +78,11 @@ please submit a bug report.
 An internal error indicating that the termination method of the resolver's
 upstream fetch class was called with an unknown result code (which is
 given in the message).  Please submit a bug report.
+
+% ASIODNS_BATCH_SIZE Batch size %1 bytes
+
+% ASIODNS_MSG_SIZE Message size %1 bytes
+
+% ASIODNS_BEFORE_YIELD Before
+
+% ASIODNS_AFTER_YIELD After
diff --git a/src/lib/asiodns/tcp_server.cc b/src/lib/asiodns/tcp_server.cc
index f0f766a..48fe768 100644
--- a/src/lib/asiodns/tcp_server.cc
+++ b/src/lib/asiodns/tcp_server.cc
@@ -160,6 +160,7 @@ TCPServer::operator()(asio::error_code ec, size_t length) {
         CORO_YIELD {
             InputBuffer dnsbuffer(data_.get(), length);
             msglen = dnsbuffer.readUint32();
+            LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_BATCH_SIZE).arg(msglen);
             async_read(*socket_, asio::buffer(data_.get(), msglen), *this);
         }
 
@@ -196,10 +197,10 @@ TCPServer::operator()(asio::error_code ec, size_t length) {
         while (wholedata_->getPosition() < wholedata_->getLength()) {
             {
                 uint16_t dnslen = wholedata_->readUint16();
+                LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_MSG_SIZE).arg(dnslen);
                 msgdata_.reset(new uint8_t[dnslen]);
                 wholedata_->readData(msgdata_.get(), dnslen);
-                singlemsg_.reset(new InputBuffer(msgdata_.get(), dnslen));
-                io_message_.reset(new IOMessage(singlemsg_.get(), dnslen, *iosock_, *peer_));
+                io_message_.reset(new IOMessage(msgdata_.get(), dnslen, *iosock_, *peer_));
             }
 
             // Perform any necessary operations prior to processing the incoming
@@ -221,7 +222,9 @@ TCPServer::operator()(asio::error_code ec, size_t length) {
             // Schedule a DNS lookup, and yield.  When the lookup is
             // finished, the coroutine will resume immediately after
             // this point.
+            LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_BEFORE_YIELD);
             CORO_YIELD io_.post(AsyncLookup<TCPServer>(*this));
+            LOG_DEBUG(logger, DBGLVL_TRACE_BASIC, ASIODNS_AFTER_YIELD);
 
             // The 'done_' flag indicates whether we have an answer
             // to send back.  If not, check next message.



More information about the bind10-changes mailing list