From 5545aa4c42e3ec729896d2f3dd4d8e8554f4ea38 Mon Sep 17 00:00:00 2001 From: Takashi Oguma Date: Thu, 20 Apr 2023 13:27:31 +0900 Subject: [PATCH 1/3] use new header file instead of the deprecated header this commit fixes the warning below: ``` In file included from .pio/libdeps/m5stack-fire/WireGuard-ESP32/src/wireguardif.c:51: .platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/tcpip_adapter/include/tcpip_adapter.h:15:2: warning: #warning "This header is deprecated, please use new network related API in esp_netif.h" [-Wcpp] #warning "This header is deprecated, please use new network related API in esp_netif.h" ^~~~~~~ --- src/wireguardif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wireguardif.c b/src/wireguardif.c index d64ad85..4f9881f 100644 --- a/src/wireguardif.c +++ b/src/wireguardif.c @@ -48,7 +48,7 @@ #include "wireguard.h" #include "crypto.h" #include "esp_log.h" -#include "tcpip_adapter.h" +#include "esp_netif.h" #include "esp32-hal-log.h" From 58131a5a31737e4c93ee00794b167b8c73a18b07 Mon Sep 17 00:00:00 2001 From: Takashi Oguma Date: Thu, 20 Apr 2023 13:29:56 +0900 Subject: [PATCH 2/3] add pointer cast to avoid warning message This commit fixes the following warning: .pio/libdeps/m5stack-fire/WireGuard-ESP32/src/wireguardif.c: In function 'wireguardif_init': .pio/libdeps/m5stack-fire/WireGuard-ESP32/src/wireguardif.c:1103:48: warning: passing argument 2 of 'tcpip_adapter_get_netif' from incompatible pointer type [-Wincompatible-pointer-types] tcpip_adapter_get_netif(TCPIP_ADAPTER_IF_STA, &underlying_netif); ^~~~~~~~~~~~~~~~~ In file included from .platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/esp_netif/include/esp_netif.h:35, from .platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/tcpip_adapter/include/tcpip_adapter.h:16, from .pio/libdeps/m5stack-fire/WireGuard-ESP32/src/wireguardif.c:51: .platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/tcpip_adapter/include/tcpip_adapter.h:95:72: note: expected 'void **' but argument is of type 'struct netif **' esp_err_t tcpip_adapter_get_netif(tcpip_adapter_if_t tcpip_if, void ** netif); ~~~~~~~~^~~~~ --- src/wireguardif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wireguardif.c b/src/wireguardif.c index 4f9881f..c8192f6 100644 --- a/src/wireguardif.c +++ b/src/wireguardif.c @@ -921,7 +921,7 @@ err_t wireguardif_init(struct netif *netif) { size_t private_key_len = sizeof(private_key); struct netif* underlying_netif; - tcpip_adapter_get_netif(TCPIP_ADAPTER_IF_STA, &underlying_netif); + tcpip_adapter_get_netif(TCPIP_ADAPTER_IF_STA, (void **)&underlying_netif); log_i(TAG "underlying_netif = %p", underlying_netif); LWIP_ASSERT("netif != NULL", (netif != NULL)); From 8b244c85c5b1956f2db7a6e557d766b52825a054 Mon Sep 17 00:00:00 2001 From: Takashi Oguma Date: Thu, 20 Apr 2023 13:33:12 +0900 Subject: [PATCH 3/3] add function prototype to avoid a warning This commit fixes the following warning: .pio/libdeps/m5stack-fire/WireGuard-ESP32/src/wireguardif.c: In function 'wireguardif_tmr': .pio/libdeps/m5stack-fire/WireGuard-ESP32/src/wireguardif.c:1039:5: warning: implicit declaration of function 'handshake_destroy'; did you mean 'keypair_destroy'? [-Wimplicit-function-declaration] handshake_destroy(&peer->handshake); ^~~~~~~~~~~~~~~~~ keypair_destroy --- src/wireguard.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wireguard.h b/src/wireguard.h index 961792a..c8ecac2 100644 --- a/src/wireguard.h +++ b/src/wireguard.h @@ -284,4 +284,6 @@ bool wireguard_decrypt_packet(uint8_t *dst, const uint8_t *src, size_t src_len, bool wireguard_base64_decode(const char *str, uint8_t *out, size_t *outlen); bool wireguard_base64_encode(const uint8_t *in, size_t inlen, char *out, size_t *outlen); +void handshake_destroy(struct wireguard_handshake *handshake); + #endif /* _WIREGUARD_H_ */