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; struct lwip_ppp_ctx *obj = netif->lwip_ppp_ctx;
pppapi_set_auth(obj->ppp, authtype, user, passwd); pppapi_set_auth(obj->ppp, authtype, user, passwd);
#else #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 #endif
return ESP_OK; return ESP_OK;
} }

View File

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

View File

@@ -19,15 +19,23 @@ menu "Example Configuration"
config EXAMPLE_MODEM_PPP_AUTH_USERNAME config EXAMPLE_MODEM_PPP_AUTH_USERNAME
string "Set username for authentication" string "Set username for authentication"
default "espressif" default "espressif"
depends on !EXAMPLE_MODEM_PPP_AUTH_NONE
help help
Set username for PPP Authentication. Set username for PPP Authentication.
config EXAMPLE_MODEM_PPP_AUTH_PASSWORD config EXAMPLE_MODEM_PPP_AUTH_PASSWORD
string "Set password for authentication" string "Set password for authentication"
default "esp32" default "esp32"
depends on !EXAMPLE_MODEM_PPP_AUTH_NONE
help help
Set password for PPP Authentication. 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 config EXAMPLE_SEND_MSG
bool "Short message (SMS)" bool "Short message (SMS)"
default n default n

View File

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