-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
ip_napt_enable_no defined in lwip/lwip_napt.h, but not there in precompiled lib #6421
ip_napt_enable_no defined in lwip/lwip_napt.h, but not there in precompiled lib #6421
Comments
Yes this is not set in the sdkonfig for the compiled libs used here. |
I just copied all files from
Do I need to do something else? |
I copied two lib files |
You have to copy ALL files. NAPT is working. We use it as wifi range extender. |
It worked if I try |
Hello, is this still valid @sekarpdkt? |
@VojtechBartoska yes, since the Options are not set in |
From what I gather, this needs:
@david-cermak will there be any negative consequences from these setting for people that do not use code that requires them? Mainly |
Yes, negative effect on WiFi throughput. And yes, mainly the Note, that users who are only interested in the NAPT feature, could possibly use IDF with The other two ( |
In that case we will hold until 4.4.2 to add NAPT support. Thanks @david-cermak ! |
Fixes: espressif/arduino-esp32#6421 Will be part of ESP-IDF 4.4.2
@david-cermak that PR is merged, but NAPT still selects L2_TO_L3_COPY: https://github.com/espressif/esp-idf/blob/release/v4.4/components/lwip/Kconfig#L182 |
Hello, My sketch:
I just updated the ESP32 board framework to 2.0.4 and I still get this output when buiding:
If in fact this is not available in 2.0.4, is there a way I can hack around my local files to make the definitions available? Thanks |
In short no. Define changes in Arduino are useless, since in the precompiled libs the "NAPT" parts are missing. you can compile your own Arduino libs with https://github.com/espressif/esp32-arduino-lib-builder with enabled napt settings in sdkconfig. You can use my fork which has enabled napt (and other small changes). |
@Jason2866 Thanks for this. Much appreciated. I also had the impression that adding the defines to Arduino would't make any changes. I used your fork and my sketch compiles. Does your fork have the following defines? I can't really tell. #define CONFIG_LWIP_IP_FORWARD 1
#define CONFIG_LWIP_IPV4_NAPT 1
#define CONFIG_LWIP_L2_TO_L3_COPY 1
#define PROTO_TCP 6
#define PROTO_UDP 17 UPDATE: Let me explain what I am trying to do for more context: Now what's actually happening when I run my sketch is the following:
I would really appreciate if you can shed some light on this. Thanks :) |
Wifi extender will work with this settings. We have a Tasmota variant doing this. |
Status update: We synced today, this is still pending and we are not able to merge it. |
I'm trying to do this using Arduino as an IDF component without any luck. I have these enabled: I'm trying to do NAT on the station interface so that when my packets leave the STA interface, they get NAT'd on their way into the STA LAN. To test if it's working, I'm opening the STA_AP mode softAP and connecting to that and trying to ping the gateway on the other LAN. So I am like this: Do I only need to do ip_napt_enable_no(0,1) to only enable it on the STA interface, or is there more that I should do? I actually got it to work with part of the code above using:
I had to comment out the 2nd ip_napt_enable() to get it to work, but then I'm enabling NAT on both interfaces which doesn't seem right, right? The NAT should only happen on the STA interface but when I do that it doesn't work. Am I just misunderstanding the concept here? Do you have to re-enable napt if an interface goes down/up? |
@Jason2866 can I use this one and still build as Also, which interface should I enable napt on for NAT'ing back into the STA LAN (which also contains the typical home router)? I assume only enable NAT on STA, right? |
@bwjohns4 To use for IDF and Arduino do
Maybe you find some usefull code in our implementation in Tasmota |
That works! Thanks so much! For the record, it appears that using a 1 or 0 for ip_napt_enable_no() does not work as expected. It must need more of a handle to the interface than a simple 1 or 0. Neither of these seemed to do anything, I tried in various combinations with successful version (bottom):
But this did work without either of the above functions:
It's also strange to me that for this purpose you need to enable NAT on the AP interface even though I want to access the STA network via the NAT mechanism. The NAT must initiate when the packets enter the target interface, then whatever interface they leave would detect that the source IP had been removed and would be triggered to update the NAT table and replace the source IP with the IP of the interface the packet leaves from. |
This adds support for ESP32. *** TESTS Tested: ESP32 Support fully tested in online mode (Tested with ESP32_DevkitC_V4): - DNS: playstation.net redirected ok, playstation.com blocked ok - HTTPS: works ok on PC (with of course certificate warning) and ok on PS5 - PS4 Tests: User Guide redirect works, Tested GoldHEN 2.3 on PS4 - PS5 Tests: User Guide Redirect Works, Tested SpecterDev's exploit on PS5 Untested: - offline mode not tested - ESP8266 not fully tested with these changes. It is supposed to have no impact on ESP8266. **** ESP32 Compilation For people who want to compile this: - IP_NAPT errors: Some SDKs don't have NAT support enabled for ESP32 so I had to use an unofficial build of the ESP32 Library for Arduino. See: espressif/arduino-esp32#6421 (comment) - TAG ESP_LOGI errors: ESP32_HTTPS_SERVER seems to have some code incompatible with some SDKs, I had to manually edit one of the files, see: fhessel/esp32_https_server#156 (comment)
Possibly relates to #8760 |
With IDF 5.1 used for Arduino Core 3.0.0 the features
can be enabled, since the do use just a bit of RAM. The performance degeneration option
is not needed anymore to enable NAPT (with IDF 5.1). |
Board
All ESP32 modules
Device Description
ESP-WROOM-32
Hardware Configuration
Issue with enabling NAPT
Version
v2.0.2
IDE Name
Arduino IDE
Operating System
UBUNTU
Flash frequency
40Mhz
PSRAM enabled
no
Upload speed
115200
Description
Looks like, even though in
lwip/lwip_napt.h
, functionvoid ip_napt_enable_no(u8_t number, int enable);
is defined, actual implementation is missing. So while compiling the code, gettingundefined reference
errorSketch
Code that enables NAT
The text was updated successfully, but these errors were encountered: