mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-13 07:14:31 +00:00
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:
parent
f226e107a6
commit
b9b36084a5
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user