Skip to content

Commit

Permalink
adds debugging to dnsserver (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
tablatronix authored Oct 2, 2020
1 parent fb6d5ad commit f76ec4f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions libraries/DNSServer/src/DNSServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#include <lwip/def.h>
#include <Arduino.h>

// #define DEBUG_ESP_DNS
#ifdef DEBUG_ESP_PORT
#define DEBUG_OUTPUT DEBUG_ESP_PORT
#else
#define DEBUG_OUTPUT Serial
#endif

DNSServer::DNSServer()
{
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit f76ec4f

Please sign in to comment.