Chat freely about anything...

User avatar
By Bomb3rman
#8975 So what I basically did is take the lwip stuff from the IOT demo from the SDK 0.9.3 and apply it to my application which is compiled against the SDK 0.9.5.

So it basically compiles a new lwip static library and uses that for linking (instead of talking the one from the SDK).

Yes, once I have the correct DNS server published and open a server on UDP port 53 DNS requests are coming in. The problem now is answering these DNS requests properly. Unfortunately I did not find a quick and easy explanation or example yet, how such a DNS response would look like. So I can not verify if that solution works properly. I hope I will find some time on the weekend to read through the DNS specification.
User avatar
By cyberswordman
#8979 Thanks again for the explanation.
I hope to be able to try the SDK as soon as possible (I remember I read here somewhere here yesterday a guide on installing the unofficial SDK but I still have to understand what is the best solution, unofficial or the official one, or maybe the virtualmachine)
Thanks again, if I should find something I'll let you know for sure ;)
User avatar
By Bomb3rman
#9195 Hi,

just tested it and it works very well. I set up the UDP server on port 53 and am sending the ESPs ip address as answer to every DNS query.

When I connect now with my laptop to the ESP and enter any url in the browser I am directed to my setup page on the ESP. When I connect with my phone, it opens the same websit as hotspot login.

Here is my DNS code:
Code: Select all        //build response
    char response[100] = {data[0], data[1],
                0b10000100 | (0b00000001 & data[2]), //response, authorative answer, not truncated, copy the recursion bit
                0b00000000, //no recursion available, no errors
                data[4], data[5], //Question count
                data[4], data[5], //answer count
                0x00, 0x00,       //NS record count
                0x00, 0x00};      //Resource record count

    int idx = 12;
    memcpy(response+12, data+12, len-12); //Copy the rest of the query section
    idx += len-12;

    //Set a pointer to the domain name in the question section
    response[idx] = 0xC0;
    response[idx+1] = 0x0C;

    //Set the type to "Host Address"
    response[idx+2] = 0x00;
    response[idx+3] = 0x01;

    //Set the response class to IN
    response[idx+4] = 0x00;
    response[idx+5] = 0x01;

    //A 32 bit integer specifying TTL in seconds, 0 meas no caching
    response[idx+6] = 0x00;
    response[idx+7] = 0x00;
    response[idx+8] = 0x00;
    response[idx+9] = 0x00;

    //RDATA length
    response[idx+10] = 0x00;
    response[idx+11] = 0x04; //4 byte IP address

    //The IP address
    response[idx + 12] = 192;
    response[idx + 13] = 168;
    response[idx + 14] = 4;
    response[idx + 15] = 1;

    espconn_sent((struct espconn *)arg, (char*)response, idx+16);
User avatar
By Iron
#10021 Dear Bomb3rman,

I am pretty new with all these... do you think you can also provide the code where you set up the UDP server on port 53 and the code that you handle the request?

I would be very much obliged...

Thanks
Dimitris