From 6aabfd50d5342b49668ad227948f6762c16f4580 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 31 Mar 2020 13:10:42 +0200 Subject: [PATCH] pppos_client: support for PPPAUTHTYPE_NONE Closes https://github.com/espressif/esp-idf/issues/4616 Closes WIFI-1652 --- components/esp_netif/lwip/esp_netif_lwip_ppp.c | 3 ++- components/lwip/port/esp32/include/lwipopts.h | 2 ++ examples/protocols/pppos_client/main/Kconfig.projbuild | 8 ++++++++ examples/protocols/pppos_client/main/pppos_client_main.c | 4 +++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/components/esp_netif/lwip/esp_netif_lwip_ppp.c b/components/esp_netif/lwip/esp_netif_lwip_ppp.c index 95f7201026..bea508da1d 100644 --- a/components/esp_netif/lwip/esp_netif_lwip_ppp.c +++ b/components/esp_netif/lwip/esp_netif_lwip_ppp.c @@ -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; } diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index d6aa757f01..2b4a593f38 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -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 diff --git a/examples/protocols/pppos_client/main/Kconfig.projbuild b/examples/protocols/pppos_client/main/Kconfig.projbuild index c85e73b45e..0618de0b82 100644 --- a/examples/protocols/pppos_client/main/Kconfig.projbuild +++ b/examples/protocols/pppos_client/main/Kconfig.projbuild @@ -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 diff --git a/examples/protocols/pppos_client/main/pppos_client_main.c b/examples/protocols/pppos_client/main/pppos_client_main.c index 2a03c4a461..9bf3b44949 100644 --- a/examples/protocols/pppos_client/main/pppos_client_main.c +++ b/examples/protocols/pppos_client/main/pppos_client_main.c @@ -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 */