1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Added captive portal functionality

This commit is contained in:
Kristijan Novoselic
2015-06-19 20:21:19 +02:00
committed by Ivan Grokhotkov
parent bcdb580d7a
commit 3bbe9b56c6
5 changed files with 40 additions and 6 deletions

View File

@ -54,7 +54,8 @@ void DNSServer::processNextRequest()
if (_dnsHeader->QR == DNS_QR_QUERY &&
_dnsHeader->OPCode == DNS_OPCODE_QUERY &&
requestIncludesOnlyOneQuestion() &&
getDomainNameWithoutWwwPrefix() == _domainName)
(_domainName == "*" || getDomainNameWithoutWwwPrefix() == _domainName)
)
{
replyWithIP();
}

View File

@ -27,7 +27,7 @@ struct DNSHeader
unsigned char AA : 1; // authoritive answer
unsigned char OPCode : 4; // message_type
unsigned char QR : 1; // query/response flag
unsigned char RCode : 4; // response code
unsigned char RCode : 4; // response code
unsigned char Z : 3; // its z! reserved
unsigned char RA : 1; // recursion available
uint16_t QDCount; // number of question entries
@ -62,7 +62,6 @@ class DNSServer
uint32_t _ttl;
DNSReplyCode _errorReplyCode;
void downcaseAndRemoveWwwPrefix(String &domainName);
String getDomainNameWithoutWwwPrefix();
bool requestIncludesOnlyOneQuestion();