PPP: introduce ppp_set_mppe

Helper function to setup MPPE (Microsoft Point to Point Encryption) for
a PPP link. Allows enabling/disabled MPPE itself, enabling/disabling
stateless support, and whether we are willing to negotiate 40-bit
and/or 128-bit encryptions.
This commit is contained in:
Sylvain Rochet
2016-07-02 18:53:59 +02:00
parent f226e107a6
commit b9b36084a5
2 changed files with 30 additions and 4 deletions

View File

@@ -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;