-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples/wifi/softap_sta not working as intended. (IDFGH-10968) #12160
Comments
Can anyone please help me solve this issue. |
Looking at esp_netif_napt_enable(), there's disagreement between the argument being passed to ip_napt_enable_netif() and the log message. It's not clear to me if the argument to ip_napt_enable_netif() is wrong (passing netif->lwip_netif) or if the argument to ESP_LOGW() is wrong (passing esp_netif). The comment "Disable napt on all other interface (sic)" and "if (netif != esp_netif)" which seems to indicate the intention is to disable napt on all other interfaces except esp_netif. If that's the case, then the argument to ESP_LOGW() is incorrect, and the argument to ESP_LOGW() should be netif instead of esp_netif, because clearly esp_netif is NOT the netif being modified. |
Incidentally, I have the softap_sta code running, and both a linux machine and an iPad successfully reach the internet through the ESP32. At first, DNS wasn't working because it was pointing to the ESP32 which has no DNS running. Once I set both host's DNS to 8.8.8.8, I was able to browse the internet, ping hosts by name, etc, via the softAP. Truly amazing for a $5 board and a bunch of free software. |
@Saum025 did you find a solution for your issue, I'm facing the same problem. |
@letorresdev I have not found any solutions. Let me know if anyone finds any solution. @mgssnr can you post your code. |
I would love to post the code, but I don't think I have it any longer. I'm looking around. |
I found the code, and git diff shows that the only changes I made were in the log messages in esp_netif_napt_enable (ESP_LOGW("napt disable on esp_netif:%p", netif) instead of ESP_LOGW("napt disable on esp_netif:%p", esp_netif)), and in components/lwip/port/lwopopts.h where I set IP_FORWARD = 1 and IP_NAPT = 1. |
So, last I'll say on this: the examples/wifi/softap_sta works out of the box, once you configure the SOFTAP and STA options. I just grabbed the most up-to-date esp-idf from git (git clone ...), followed the installation setup instructions here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html and then configured the project with my local WiFi SSID and password, and connected my iPad to it. After connecting to the SOFTAP, and setting the iPad's DNS to manual and 8.8.8.8 everything works perfectly. I can visit any website, I can ping the router (192.168.1.1 is my office's main router IP). The only thing I cannot do is ping the SOFTAP IP address (192.168.4.1) and that's probably because I didn't set the option in LWIP to allow it to respond to pings. I hope this helps. If it's not, I'll try to answer any questions you have. FYI the message from esp netif about napt being disabled on a port is wrong IMO, because esp_netif isn't what's being checked, rather netif is. I don't know if it's worth fixing. |
hi @Saum025 @mgssnr @letorresdev void softap_set_dns_addr(esp_netif_t *esp_netif_ap){ in the code call the func after after esp_netif_t *esp_netif_ap = wifi_init_softap(); |
Since there was no further response from the user I am closing this issue. If you will encounter any further problems please reopen this or create new issue related to the problem. Cheers! |
Answers checklist.
General issue report
After downloading and configuring this example, I build the code and uploaded it to my ESP32 dev board (ESP32 Wroom 23). ESP 32 dev board was able to connect to my Wifi Router and it was also able to create an AP as intended. But Wifi NAT router functionality was not working. I was not able to access internet through ESP32's AP. Example code can be viewed here.
Debug Terminal
The third line from bottom, says that NAPT is disabled on esp_netif but it return ESP_OK.
Screenshots
The text was updated successfully, but these errors were encountered: