PPP, CCP, various fix if MPPE is enabled

This commit is contained in:
Sylvain Rochet
2015-03-19 01:25:52 +01:00
parent 794c93b540
commit 5937932370
7 changed files with 162 additions and 31 deletions

View File

@@ -954,7 +954,7 @@ void start_networks(ppp_pcb *pcb) {
ecp_required = ecp_gotoptions[unit].required;
#endif /* ECP_SUPPORT */
#ifdef MPPE
mppe_required = ccp_gotoptions[unit].mppe;
mppe_required = pcb->ccp_gotoptions.mppe;
#endif /* MPPE */
if (1

View File

@@ -62,7 +62,6 @@ static int setbsdcomp (char **);
static int setdeflate (char **);
static char bsd_value[8];
static char deflate_value[8];
#endif /* PPP_OPTIONS */
/*
* Option variables.
@@ -71,7 +70,6 @@ static char deflate_value[8];
bool refuse_mppe_stateful = 1; /* Allow stateful mode? */
#endif
#if PPP_OPTIONS
static option_t ccp_option_list[] = {
{ "noccp", o_bool, &ccp_protent.enabled_flag,
"Disable CCP negotiation" },
@@ -896,7 +894,7 @@ static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
* Fail if we aren't willing to use his suggestion.
*/
MPPE_CI_TO_OPTS(&p[2], try_.mppe);
if ((try_.mppe & MPPE_OPT_STATEFUL) && refuse_mppe_stateful) {
if ((try_.mppe & MPPE_OPT_STATEFUL) && pcb->settings.refuse_mppe_stateful) {
ppp_error("Refusing MPPE stateful mode offered by peer");
try_.mppe = 0;
} else if (((go->mppe | MPPE_OPT_STATEFUL) & try_.mppe) != try_.mppe) {
@@ -1049,7 +1047,7 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
u_char *p0, *retp;
int len, clen, type, nb;
#ifdef MPPE
bool rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
u8_t rej_for_ci_mppe = 1; /* Are we rejecting based on a bad/missing */
/* CI_MPPE, or due to other options? */
#endif
@@ -1098,7 +1096,7 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) {
* it if he can do it; stateful mode is bad over
* the Internet -- which is where we expect MPPE.
*/
if (refuse_mppe_stateful) {
if (pcb->settings.refuse_mppe_stateful) {
ppp_error("Refusing MPPE stateful mode offered by peer");
newret = CONFREJ;
break;

View File

@@ -857,6 +857,7 @@ void ChapMS2(u_char *rchallenge, u_char *PeerChallenge,
#endif
}
#if 0 /* UNUSED */
#ifdef MPPE
/*
* Set MPPE options from plugins.
@@ -887,6 +888,7 @@ void set_mppe_enc_types(int policy, int types) {
}
}
#endif /* MPPE */
#endif /* UNUSED */
const struct chap_digest_type chapms_digest = {
CHAP_MICROSOFT, /* code */

View File

@@ -542,6 +542,10 @@ ppp_pcb *ppp_new(struct netif *pppif, ppp_link_status_cb_fn link_status_cb, void
#endif /* PPP_SERVER */
#endif /* EAP_SUPPORT */
#ifdef MPPE
pcb->settings.refuse_mppe_stateful = 1;
#endif /* MPPE */
pcb->settings.lcp_loopbackfail = LCP_DEFLOOPBACKFAIL;
pcb->settings.lcp_echo_interval = LCP_ECHOINTERVAL;
pcb->settings.lcp_echo_fails = LCP_MAXECHOFAILS;