From f76ec4f50b6e59770c0a51017375137209b4d590 Mon Sep 17 00:00:00 2001 From: Shawn A Date: Fri, 2 Oct 2020 18:59:55 -0500 Subject: [PATCH] adds debugging to dnsserver (#1046) --- libraries/DNSServer/src/DNSServer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libraries/DNSServer/src/DNSServer.cpp b/libraries/DNSServer/src/DNSServer.cpp index eafa97cf..a7f0d15e 100644 --- a/libraries/DNSServer/src/DNSServer.cpp +++ b/libraries/DNSServer/src/DNSServer.cpp @@ -2,6 +2,12 @@ #include #include +// #define DEBUG_ESP_DNS +#ifdef DEBUG_ESP_PORT +#define DEBUG_OUTPUT DEBUG_ESP_PORT +#else +#define DEBUG_OUTPUT Serial +#endif DNSServer::DNSServer() { @@ -184,6 +190,11 @@ void DNSServer::replyWithIP() _udp.write((unsigned char*) &answerIPv4, 2 ); _udp.write(_resolvedIP, sizeof(_resolvedIP)); // The IP address to return _udp.endPacket(); + + #ifdef DEBUG_ESP_DNS + DEBUG_OUTPUT.printf("DNS responds: %s for %s\n", + IPAddress(_resolvedIP).toString().c_str(), getDomainNameWithoutWwwPrefix().c_str() ); + #endif } void DNSServer::replyWithCustomCode()