jonask1337 / esp-idf-nat-example

ESP-IDF example project with NAT setup.
82 stars 15 forks source link

Compilation errors #12

Open nonopx opened 4 years ago

nonopx commented 4 years ago

Hey,

This is what I did: I am using esp-idf on branch release/v3.3. I changed the lwip library with [https://github.com/martin-ger/esp-lwip] (what branch should it be ?) I changed the example branch to v3.3 and run it.

I get a lot of error with asio component, attached some examples of the errors.

img

Maybe you know what is happening ?

Thanks.

jonask1337 commented 4 years ago

Hi, for esp-idf v3.3 you have to use this lwip library: https://github.com/jonask1337/esp-lwip

For a detailed setup instruction check out the readme of the v3.3 branch of this example.

nonopx commented 4 years ago

Thanks for the quick feedback.

I have followed the detailed setup instruction and it got me into one error :

/home/amir/esp/esp-idf/components/tcpip_adapter/tcpip_adapter_lwip.c: In function 'tcpip_adapter_get_dns_info': /home/amir/esp/esp-idf/components/tcpip_adapter/tcpip_adapter_lwip.c:800:16: error: incompatible types when assigning to type 'const ip_addr_t {aka const struct ip_addr }' from type 'ip_addr_t {aka struct ip_addr}' dns_ip = dns_getserver(type);

I tried to solve it and saw there is 2 functions depending on ESP_DNS (currently 0) , I tried changing it to 1 and it created another problems.

If you have idea what is happening I would like to know.

Thank you

jonask1337 commented 4 years ago

I could reproduce the compilation errors. A quick fix would be to apply the following changes to the _esp-idf/components/tcpip_adapter/tcpip_adapterlwip.c file:

esp_err_t tcpip_adapter_get_dns_info(tcpip_adapter_if_t tcpip_if, tcpip_adapter_dns_type_t type, tcpip_adapter_dns_info_t *dns)
{
     tcpip_adapter_dns_param_t dns_param;

     dns_param.dns_type =  type;
     dns_param.dns_info =  dns;
     //const ip_addr_t*  dns_ip = NULL;
     ip_addr_t dns_ip;

     TCPIP_ADAPTER_IPC_CALL(tcpip_if, type,  0, &dns_param, tcpip_adapter_get_dns_info_api);
     if (!dns) {

     ...
     if (tcpip_if == TCPIP_ADAPTER_IF_STA || tcpip_if == TCPIP_ADAPTER_IF_ETH) {
         dns_ip = dns_getserver(type);
        /*if (dns_ip != NULL) {
            dns->ip = *dns_ip;
        }*/
       dns->ip = dns_ip;
     } else {
         dns->ip.u_addr.ip4 = dhcps_dns_getserver();
     }
     ...