From c751802fad4b0eda89965f575035cee318df29e7 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 19 Jun 2016 19:49:46 +0200 Subject: [PATCH] PPP, CCP, move user configuration from ccp_init to ccp_resetci ccp_init() is meant to be called once, providing default configuration before user specific configuration is applied. In pppd user configuration is set just after all protocol init functions are called, in lwIP we use protocol reset functions to do that, which is more or less the same. Therefore, be consistent and move CCP user configuration from ccp_init to ccp_resetci. --- src/netif/ppp/ccp.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/netif/ppp/ccp.c b/src/netif/ppp/ccp.c index 69b69592..8428dfb7 100644 --- a/src/netif/ppp/ccp.c +++ b/src/netif/ppp/ccp.c @@ -367,8 +367,6 @@ setdeflate(argv) */ static void ccp_init(ppp_pcb *pcb) { fsm *f = &pcb->ccp_fsm; - ccp_options *wo = &pcb->ccp_wantoptions; - ccp_options *ao = &pcb->ccp_allowoptions; f->pcb = pcb; f->protocol = PPP_CCP; @@ -403,14 +401,6 @@ static void ccp_init(ppp_pcb *pcb) { #if PREDICTOR_SUPPORT ao->predictor_1 = 1; #endif /* PREDICTOR_SUPPORT */ - -#if MPPE_SUPPORT - if (pcb->settings.require_mppe) { - wo->mppe = ao->mppe = - (pcb->settings.refuse_mppe_40 ? 0 : MPPE_OPT_40) - | (pcb->settings.refuse_mppe_128 ? 0 : MPPE_OPT_128); - } -#endif /* MPPE_SUPPORT */ } /* @@ -552,6 +542,9 @@ static void ccp_resetci(fsm *f) { ppp_pcb *pcb = f->pcb; ccp_options *go = &pcb->ccp_gotoptions; ccp_options *wo = &pcb->ccp_wantoptions; +#if MPPE_SUPPORT + ccp_options *ao = &pcb->ccp_allowoptions; +#endif /* MPPE_SUPPORT */ #if DEFLATE_SUPPORT || BSDCOMPRESS_SUPPORT || PREDICTOR_SUPPORT u_char opt_buf[CCP_MAX_OPTION_LENGTH]; #endif /* DEFLATE_SUPPORT || BSDCOMPRESS_SUPPORT || PREDICTOR_SUPPORT */ @@ -559,12 +552,19 @@ static void ccp_resetci(fsm *f) { int res; #endif /* DEFLATE_SUPPORT || BSDCOMPRESS_SUPPORT */ +#if MPPE_SUPPORT + if (pcb->settings.require_mppe) { + wo->mppe = ao->mppe = + (pcb->settings.refuse_mppe_40 ? 0 : MPPE_OPT_40) + | (pcb->settings.refuse_mppe_128 ? 0 : MPPE_OPT_128); + } +#endif /* MPPE_SUPPORT */ + *go = *wo; pcb->ccp_all_rejected = 0; #if MPPE_SUPPORT if (go->mppe) { - ccp_options *ao = &pcb->ccp_allowoptions; int auth_mschap_bits = pcb->auth_done; int numbits;