Skip to content

Commit f76ec4f

Browse files
authored
adds debugging to dnsserver (#1046)
1 parent fb6d5ad commit f76ec4f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: libraries/DNSServer/src/DNSServer.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
#include <lwip/def.h>
33
#include <Arduino.h>
44

5+
// #define DEBUG_ESP_DNS
6+
#ifdef DEBUG_ESP_PORT
7+
#define DEBUG_OUTPUT DEBUG_ESP_PORT
8+
#else
9+
#define DEBUG_OUTPUT Serial
10+
#endif
511

612
DNSServer::DNSServer()
713
{
@@ -184,6 +190,11 @@ void DNSServer::replyWithIP()
184190
_udp.write((unsigned char*) &answerIPv4, 2 );
185191
_udp.write(_resolvedIP, sizeof(_resolvedIP)); // The IP address to return
186192
_udp.endPacket();
193+
194+
#ifdef DEBUG_ESP_DNS
195+
DEBUG_OUTPUT.printf("DNS responds: %s for %s\n",
196+
IPAddress(_resolvedIP).toString().c_str(), getDomainNameWithoutWwwPrefix().c_str() );
197+
#endif
187198
}
188199

189200
void DNSServer::replyWithCustomCode()

0 commit comments

Comments
 (0)