Skip to content

Commit 16726c0

Browse files
committed
fix captive portal espressif#1037
Not sure if this was left out on purpose or not
1 parent 7fa8caf commit 16726c0

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

libraries/DNSServer/src/DNSServer.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,21 @@ void DNSServer::replyWithIP()
123123
if (_buffer == NULL) return;
124124
_dnsHeader->QR = DNS_QR_RESPONSE;
125125
_dnsHeader->ANCount = _dnsHeader->QDCount;
126-
_dnsHeader->QDCount = 0;
126+
_dnsHeader->QDCount = _dnsHeader->QDCount;
127+
// _dnsHeader->QDCount = 0;
127128

128129
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort());
129130
_udp.write(_buffer, _currentPacketSize);
131+
132+
_udp.write((uint8_t)192); // answer name is a pointer
133+
_udp.write((uint8_t)12); // pointer to offset at 0x00c
134+
135+
_udp.write((uint8_t)0); // 0x0001 answer is type A query (host address)
136+
_udp.write((uint8_t)1);
137+
138+
_udp.write((uint8_t)0); //0x0001 answer is class IN (internet address)
139+
_udp.write((uint8_t)1);
140+
130141
_udp.write((unsigned char*)&_ttl, 4);
131142
_udp.write((uint8_t)0);
132143
_udp.write((uint8_t)4);

0 commit comments

Comments
 (0)