DNSServer fix custom code replies (#7475)
custom code reply was sending garbage from a buffer instead of crafted DNS header
This commit is contained in:
parent
5bc37a701b
commit
27e6f35f69
1 changed files with 1 additions and 4 deletions
|
|
@ -175,8 +175,6 @@ String DNSServer::getDomainNameWithoutWwwPrefix()
|
||||||
|
|
||||||
void DNSServer::replyWithIP()
|
void DNSServer::replyWithIP()
|
||||||
{
|
{
|
||||||
if (_buffer == NULL) return;
|
|
||||||
|
|
||||||
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort());
|
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort());
|
||||||
|
|
||||||
// Change the type of message to a response and set the number of answers equal to
|
// Change the type of message to a response and set the number of answers equal to
|
||||||
|
|
@ -215,12 +213,11 @@ void DNSServer::replyWithIP()
|
||||||
|
|
||||||
void DNSServer::replyWithCustomCode()
|
void DNSServer::replyWithCustomCode()
|
||||||
{
|
{
|
||||||
if (_buffer == NULL) return;
|
|
||||||
_dnsHeader->QR = DNS_QR_RESPONSE;
|
_dnsHeader->QR = DNS_QR_RESPONSE;
|
||||||
_dnsHeader->RCode = (unsigned char)_errorReplyCode;
|
_dnsHeader->RCode = (unsigned char)_errorReplyCode;
|
||||||
_dnsHeader->QDCount = 0;
|
_dnsHeader->QDCount = 0;
|
||||||
|
|
||||||
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort());
|
_udp.beginPacket(_udp.remoteIP(), _udp.remotePort());
|
||||||
_udp.write(_buffer, sizeof(DNSHeader));
|
_udp.write((unsigned char*)_dnsHeader, sizeof(DNSHeader));
|
||||||
_udp.endPacket();
|
_udp.endPacket();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue