diff --git a/doc/ppp.txt b/doc/ppp.txt index 3dc8ad73..bf4673ef 100644 --- a/doc/ppp.txt +++ b/doc/ppp.txt @@ -323,6 +323,9 @@ ppp_set_ipcp_dnsaddr(ppp, 1, &addr); /* Auth configuration, this is pretty self-explanatory */ ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password"); +/* Require peer to authenticate */ +ppp_set_auth_required(ppp, 1); + /* * Initiate PPP listener (i.e. wait for an incoming connection), can only * be called if PPP session is in the dead state (i.e. disconnected). diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index 20f41dbb..1ed10298 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -453,6 +453,13 @@ struct ppp_pcb_s { #define PPPAUTHTYPE_ANY 0xff void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd); +#if PPP_AUTH_SUPPORT +/* + * Whether peer is required to authenticate. This is mostly necessary for PPP server support. + */ +#define ppp_set_auth_required(ppp, boolval) (ppp->settings.auth_required = boolval) +#endif /* PPP_AUTH_SUPPORT */ + #if PPP_IPV4_SUPPORT /* * Set PPP interface "our" and "his" IPv4 addresses. This is mostly necessary for PPP server diff --git a/src/netif/ppp/pppos.c b/src/netif/ppp/pppos.c index 3478a76b..0ecbec7a 100644 --- a/src/netif/ppp/pppos.c +++ b/src/netif/ppp/pppos.c @@ -351,12 +351,6 @@ pppos_listen(ppp_pcb *ppp, void *ctx) lcp_wo = &ppp->lcp_wantoptions; lcp_wo->silent = 1; -#if PPP_AUTH_SUPPORT - if (ppp->settings.user && ppp->settings.passwd) { - ppp->settings.auth_required = 1; - } -#endif /* PPP_AUTH_SUPPORT */ - /* * Default the in and out accm so that escape and flag characters * are always escaped.