esp_netif_lwip_ppp: Allow esp_netif_ppp_set_auth set auth_type with NETIF_PPP_AUTHTYPE_NONE

The ppp_set_auth() is guard by #if PPP_AUTH_SUPPORT in lwIP, so
make it consistent. This also simplify the code a bit because the code
in #if PAP_SUPPORT guard and #if CHAP_SUPPORT guard are exactly the same.

Once NETIF_PPP_AUTHTYPE_NONE added to esp_netif_auth_type_t, it also allows
setting NETIF_PPP_AUTHTYPE_NONE with this change.

Signed-off-by: Axel Lin <axel.lin@gmail.com>

Merges https://github.com/espressif/esp-idf/pull/4639
This commit is contained in:
Axel Lin 2020-01-17 09:54:38 +08:00 committed by David Cermak
parent 57a56b55c0
commit 3f5d19016a

View File

@ -207,10 +207,8 @@ esp_err_t esp_netif_ppp_set_auth(esp_netif_t *netif, esp_netif_auth_type_t autht
if (netif == NULL || !netif->is_ppp_netif) {
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
}
#if PPP_AUTH_SUPPORT
struct lwip_ppp_ctx *obj = netif->lwip_ppp_ctx;
#if PAP_SUPPORT
pppapi_set_auth(obj->ppp, authtype, user, passwd);
#elif CHAP_SUPPORT
pppapi_set_auth(obj->ppp, authtype, user, passwd);
#else
#error "Unsupported AUTH Negotiation"