Closed zekageri closed 2 years ago
Thank you for your report.
As a matter of fact, I have a clue about this bug. The current code assumes to be used with a WLAN connection and does not support a wired connection.
But I think it is not so difficult to fix, so I will fix it.
Thank you. I was about to debug further but i will wait for your fix! Really appreciate your help
Hi.
I have pushed the fix of this issue to this branch https://github.com/ciniml/WireGuard-ESP32-Arduino/tree/15_fix_crash_with_eth
I've confirmed the fixed code works with WLAN. But I cannot confirm this works with wired connection, since I have no hardware which can use wired connection.
Could you try the fixed code in the branch?
Yes of course. Thank you for the notification. I will try it next monday.
Sorry for not getting back to it. I was sick for two days. But i'm testing now.
Same error after wg.begin()
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x40157cf1 PS : 0x00060f30 A0 : 0x80157f5c A1
: 0x3ffce570
A2 : 0x3ffdef10 A3 : 0x3ffe455c A4 : 0x3ffdf044 A5
: 0x00000000
A6 : 0x0000002e A7 : 0x00000004 A8 : 0x00000000 A9
: 0x3ffbfa20
A10 : 0x00000000 A11 : 0x3ffbbf40 A12 : 0x00000001 A13
: 0x00000001
A14 : 0x00060021 A15 : 0x00000000 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000014 LBEG : 0x4008c8c8 LEND : 0x4008c8e4 LCOUNT : 0x00000000
ELF file SHA256: 0000000000000000
Backtrace: 0x40157cf1:0x3ffce570 0x40157f59:0x3ffce5b0 0x40104dab:0x3ffce5d0 0x40154fa1:0x3ffce6a0 0x401551a8:0x3ffce6c0 0x40161318:0x3ffce6e0 0x4009070a:0x3ffce710
#0 0x40157cf1:0x3ffce570 in udp_sendto_if_src at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/udp.c:720 (discriminator 2)
#1 0x40157f59:0x3ffce5b0 in udp_sendto_if at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/udp.c:689
#2 0x40104dab:0x3ffce5d0 in wireguardif_peer_output at lib\WireGuard-ESP32-Arduino-15_fix_crash_with_eth\src/wireguardif.c:912
(inlined by) wireguard_start_handshake at lib\WireGuard-ESP32-Arduino-15_fix_crash_with_eth\src/wireguardif.c:635
(inlined by) wireguardif_tmr at lib\WireGuard-ESP32-Arduino-15_fix_crash_with_eth\src/wireguardif.c:882
#3 0x40154fa1:0x3ffce6a0 in sys_check_timeouts at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/timeouts.c:381
#4 0x401551a8:0x3ffce6c0 in sys_timeouts_mbox_fetch at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/timeouts.c:433
#5 0x40161318:0x3ffce6e0 in tcpip_thread at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:483
#6 0x4009070a:0x3ffce710 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
Rebooting...
Maybe there is a problem with the internal time since i'm already using an RTC and an NTP server for fetching the time. I will check it.
static const inline void beginWireGuard(){
if(canWireGuardBegin){
canWireGuardBegin = false;
Serial.println("Setting up WireGuard...");
//configTime(9 * 60 * 60, 0, "ntp.jst.mfeed.ad.jp", "ntp.nict.jp", "time.google.com");
isWgConfigured = wg.begin(
local_ip, // IP address of the local interface
private_key, // Private key of the local interface
endpoint_address, // Address of the endpoint peer.
public_key, // Public key of the endpoint peer.
endpoint_port); // Port pf the endpoint peer.
Serial.println("isWgConfigured: " + String(isWgConfigured));
}
}
I commented out the config time on wireguard and enabling the setup process with a flag after i got a time from my NTP server. It seems to be working for now. The setup part at least. No crash
Yap, confirmed. No crash just had to wait for the time syncing. Thank you for your help i will continue my testings now. I appreciate.
@ciniml : Could you please merge the change into the main branch ? It is working here and it's very hard to find the solution within a closed issue with a change that is not commited to the main branch.
Best regards
underlying_netif = netif_default; // Use current netif as the underlying netif of the WireGuard interface.
Hi! Thank you for the implementation. It sure looks really promising. I'm trying to initiate a basic communication between esp32 and an android apk for now.
I'm using ETH implementation by espressif with lan8720 eth board.
A snippet from my sketch:
Crash LOG:
All other standard ethernet communication is working. I have an Async webserver and i can do http requests, websockets and everything else.