pppos_client: support for PPPAUTHTYPE_NONE

Closes https://github.com/espressif/esp-idf/issues/4616
Closes WIFI-1652
This commit is contained in:
David Cermak 2020-03-31 13:10:42 +02:00
parent 817c0e3019
commit 6aabfd50d5
4 changed files with 15 additions and 2 deletions

View file

@ -246,7 +246,8 @@ esp_err_t esp_netif_ppp_set_auth(esp_netif_t *netif, esp_netif_auth_type_t autht
struct lwip_ppp_ctx *obj = netif->lwip_ppp_ctx;
pppapi_set_auth(obj->ppp, authtype, user, passwd);
#else
#error "Unsupported AUTH Negotiation"
ESP_LOGE(TAG, "%s failed: No authorisation enabled in menuconfig", __func__);
return ESP_ERR_ESP_NETIF_IF_NOT_READY;
#endif
return ESP_OK;
}

View file

@ -661,6 +661,8 @@
#if PPP_DEBUG_ON
#define PPP_DEBUG LWIP_DBG_ON
#define PRINTPKT_SUPPORT 1
#define PPP_PROTOCOLNAME 1
#else
#define PPP_DEBUG LWIP_DBG_OFF
#endif

View file

@ -19,15 +19,23 @@ menu "Example Configuration"
config EXAMPLE_MODEM_PPP_AUTH_USERNAME
string "Set username for authentication"
default "espressif"
depends on !EXAMPLE_MODEM_PPP_AUTH_NONE
help
Set username for PPP Authentication.
config EXAMPLE_MODEM_PPP_AUTH_PASSWORD
string "Set password for authentication"
default "esp32"
depends on !EXAMPLE_MODEM_PPP_AUTH_NONE
help
Set password for PPP Authentication.
config EXAMPLE_MODEM_PPP_AUTH_NONE
bool "Skip PPP authentication"
default n
help
Set to true for the PPP client to skip authentication
config EXAMPLE_SEND_MSG
bool "Short message (SMS)"
default n

View file

@ -217,7 +217,7 @@ void app_main(void)
esp_netif_auth_type_t auth_type = NETIF_PPP_AUTHTYPE_PAP;
#elif CONFIG_LWIP_PPP_CHAP_SUPPORT
esp_netif_auth_type_t auth_type = NETIF_PPP_AUTHTYPE_CHAP;
#else
#elif !defined(CONFIG_EXAMPLE_MODEM_PPP_AUTH_NONE)
#error "Unsupported AUTH Negotiation"
#endif
ESP_ERROR_CHECK(esp_netif_init());
@ -273,7 +273,9 @@ void app_main(void)
ESP_ERROR_CHECK(dce->get_battery_status(dce, &bcs, &bcl, &voltage));
ESP_LOGI(TAG, "Battery voltage: %d mV", voltage);
/* setup PPPoS network parameters */
#if !defined(CONFIG_EXAMPLE_MODEM_PPP_AUTH_NONE) && (defined(CONFIG_LWIP_PPP_PAP_SUPPORT) || defined(CONFIG_LWIP_PPP_CHAP_SUPPORT))
esp_netif_ppp_set_auth(esp_netif, auth_type, CONFIG_EXAMPLE_MODEM_PPP_AUTH_USERNAME, CONFIG_EXAMPLE_MODEM_PPP_AUTH_PASSWORD);
#endif
void *modem_netif_adapter = esp_modem_netif_setup(dte);
esp_modem_netif_set_default_handlers(modem_netif_adapter, esp_netif);
/* attach the modem to the network interface */