From 40991b93a2526920180c8439e45d7a6d469fc651 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sat, 18 Apr 2015 19:47:21 +0200 Subject: [PATCH] PPP, CCP, reworked ppp_pcb ccp_localstate and all_rejected fields --- src/include/netif/ppp/ppp.h | 10 ++++++---- src/netif/ppp/ccp.c | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/include/netif/ppp/ppp.h b/src/include/netif/ppp/ppp.h index fb98ae99..fd4133af 100644 --- a/src/include/netif/ppp/ppp.h +++ b/src/include/netif/ppp/ppp.h @@ -366,12 +366,16 @@ struct ppp_pcb_s { unsigned int :2; /* 2 bit of padding */ #endif /* PPP_IPV6_SUPPORT */ unsigned int lcp_echo_timer_running :1; /* set if a timer is running */ +#if CCP_SUPPORT + unsigned int ccp_all_rejected :1; /* we rejected all peer's options */ +#else /* CCP_SUPPORT */ + unsigned int :1; /* 1 bit of padding */ +#endif /* CCP_SUPPORT */ #if MPPE_SUPPORT unsigned int mppe_keys_set :1; /* Have the MPPE keys been set? */ #else /* MPPE_SUPPORT */ unsigned int :1; /* 1 bit of padding */ #endif /* MPPE_SUPPORT */ - unsigned int :1; /* 1 bit of padding to round out to 8 bits */ #if PPP_AUTH_SUPPORT /* auth data */ @@ -415,9 +419,7 @@ struct ppp_pcb_s { ccp_options ccp_gotoptions; /* what the peer agreed to do */ ccp_options ccp_allowoptions; /* what we'll agree to do */ ccp_options ccp_hisoptions; /* what we agreed to do */ - int ccp_localstate; /* Local state (mainly for handling reset-reqs and reset-acks). */ - int all_rejected; /* we rejected all peer's options */ - + u8_t ccp_localstate; /* Local state (mainly for handling reset-reqs and reset-acks). */ #if MPPE_SUPPORT ppp_mppe_state mppe_comp; /* MPPE "compressor" structure */ ppp_mppe_state mppe_decomp; /* MPPE "decompressor" structure */ diff --git a/src/netif/ppp/ccp.c b/src/netif/ppp/ccp.c index 70b1f49b..3bacaa65 100644 --- a/src/netif/ppp/ccp.c +++ b/src/netif/ppp/ccp.c @@ -546,7 +546,7 @@ static void ccp_resetci(fsm *f) { #endif /* DEFLATE_SUPPORT || BSDCOMPRESS_SUPPORT */ *go = *wo; - pcb->all_rejected = 0; + pcb->ccp_all_rejected = 0; #if MPPE_SUPPORT if (go->mppe) { @@ -1023,7 +1023,7 @@ static int ccp_rejci(fsm *f, u_char *p, int len) { * Cope with empty configure-rejects by ceasing to send * configure-requests. */ - if (len == 0 && pcb->all_rejected) + if (len == 0 && pcb->ccp_all_rejected) return -1; #if MPPE_SUPPORT @@ -1374,7 +1374,7 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) { if (ret != CONFACK) { if (ret == CONFREJ && *lenp == retp - p0) - pcb->all_rejected = 1; + pcb->ccp_all_rejected = 1; else *lenp = retp - p0; }