diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index 99b8aeae..d819a9f3 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -482,6 +482,21 @@ void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *pas #endif /* LWIP_DNS */ #endif /* PPP_IPV4_SUPPORT */ +#if MPPE_SUPPORT +/* Disable MPPE (Microsoft Point to Point Encryption). This parameter is exclusive. */ +#define PPP_MPPE_DISABLE 0x00 +/* Require the use of MPPE (Microsoft Point to Point Encryption). */ +#define PPP_MPPE_ENABLE 0x01 +/* Allow MPPE to use stateful mode. Stateless mode is still attempted first. */ +#define PPP_MPPE_ALLOW_STATEFUL 0x02 +/* Refuse the use of MPPE with 40-bit encryption. Conflict with PPP_MPPE_REFUSE_128. */ +#define PPP_MPPE_REFUSE_40 0x04 +/* Refuse the use of MPPE with 128-bit encryption. Conflict with PPP_MPPE_REFUSE_40. */ +#define PPP_MPPE_REFUSE_128 0x08 +/* Set MPPE configuration */ +void ppp_set_mppe(ppp_pcb *pcb, u8_t flags); +#endif /* MPPE_SUPPORT */ + /* * Wait for up to intval milliseconds for a valid PPP packet from the peer. * At the end of this time, or when a valid PPP packet is received from the diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index e5630b81..7f7e9c3f 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -234,6 +234,21 @@ void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *pas #endif /* PPP_AUTH_SUPPORT */ } +#if MPPE_SUPPORT +/* Set MPPE configuration */ +void ppp_set_mppe(ppp_pcb *pcb, u8_t flags) { + if (flags == PPP_MPPE_DISABLE) { + pcb->settings.require_mppe = 0; + return; + } + + pcb->settings.require_mppe = 1; + pcb->settings.refuse_mppe_stateful = !(flags & PPP_MPPE_ALLOW_STATEFUL); + pcb->settings.refuse_mppe_40 = !!(flags & PPP_MPPE_REFUSE_40); + pcb->settings.refuse_mppe_128 = !!(flags & PPP_MPPE_REFUSE_128); +} +#endif /* MPPE_SUPPORT */ + #if PPP_NOTIFY_PHASE void ppp_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_phase_cb) { pcb->notify_phase_cb = notify_phase_cb; @@ -658,10 +673,6 @@ ppp_pcb *ppp_new(struct netif *pppif, const struct link_callbacks *callbacks, vo #endif /* PPP_SERVER */ #endif /* EAP_SUPPORT */ -#if MPPE_SUPPORT - pcb->settings.refuse_mppe_stateful = 1; -#endif /* MPPE_SUPPORT */ - pcb->settings.lcp_loopbackfail = LCP_DEFLOOPBACKFAIL; pcb->settings.lcp_echo_interval = LCP_ECHOINTERVAL; pcb->settings.lcp_echo_fails = LCP_MAXECHOFAILS;