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.
This commit is contained in:
Sylvain Rochet 2016-06-19 19:49:46 +02:00
parent 6d95a34971
commit c751802fad

View File

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