esp_netif: Add thread safe pppapi set_auth API to esp-netif

This commit is contained in:
David Cermak 2022-03-17 12:59:06 +01:00
parent dbc91f73e6
commit 44a9620c17
4 changed files with 32 additions and 1 deletions

View File

@ -61,6 +61,29 @@ void dns_clear_servers(bool keep_fallback)
dns_setserver(numdns, NULL);
}
}
#if PPP_SUPPORT && PPP_AUTH_SUPPORT
typedef struct {
struct tcpip_api_call_data call;
ppp_pcb *ppp;
u8_t authtype;
const char *user;
const char *passwd;
} set_auth_msg_t;
static err_t pppapi_do_ppp_set_auth(struct tcpip_api_call_data *m)
{
set_auth_msg_t *msg = (set_auth_msg_t *)m;
ppp_set_auth(msg->ppp, msg->authtype, msg->user, msg->passwd);
return ERR_OK;
}
void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd)
{
set_auth_msg_t msg = { .ppp = pcb, .authtype = authtype, .user = user, .passwd = passwd};
tcpip_api_call(pppapi_do_ppp_set_auth, &msg.call);
}
#endif // PPP_SUPPORT && PPP_AUTH_SUPPORT
#ifdef CONFIG_LWIP_GARP_TMR_INTERVAL
void netif_send_garp(void *arg)

View File

@ -11,6 +11,10 @@
#if defined(CONFIG_ESP_NETIF_TCPIP_LWIP_ORIG) || defined(CONFIG_ESP_NETIF_TCPIP_LWIP)
#if PPP_SUPPORT
typedef struct ppp_pcb_s ppp_pcb;
#endif
/**
* @brief Sets one extended lwip netif callbacks for all esp-netif
*/
@ -28,6 +32,10 @@ static inline void nd6_set_cb(struct netif *netif, void (*cb)(struct netif *neti
void dns_clear_servers(bool keep_fallback);
#if PPP_SUPPORT && PPP_AUTH_SUPPORT
void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
#endif
#if ESP_GRATUITOUS_ARP
void netif_set_garp_flag(struct netif *netif);

View File

@ -17,6 +17,7 @@
#include "esp_event.h"
#include "esp_netif_ppp.h"
#include "esp_netif_lwip_internal.h"
#include "esp_netif_lwip_orig.h"
#include <string.h>
#include "lwip/ip6_addr.h"

View File

@ -475,7 +475,6 @@ components/esp_local_ctrl/src/esp_local_ctrl_transport_ble.c
components/esp_netif/include/esp_netif_ppp.h
components/esp_netif/include/esp_netif_slip.h
components/esp_netif/loopback/esp_netif_loopback.c
components/esp_netif/lwip/esp_netif_lwip_ppp.c
components/esp_netif/lwip/esp_netif_lwip_slip.c
components/esp_netif/lwip/esp_netif_lwip_slip.h
components/esp_netif/private_include/esp_netif_private.h