improved lcp_options structure size

This commit is contained in:
Sylvain Rochet 2012-06-20 00:03:08 +02:00
parent 4bbf443ba2
commit e330983408
2 changed files with 39 additions and 23 deletions

View File

@ -688,8 +688,8 @@ static void lcp_resetci(fsm *f) {
*go = *wo;
#ifdef HAVE_MULTILINK
if (!multilink) {
#endif /* HAVE_MULTILINK */
go->neg_mrru = 0;
#endif /* HAVE_MULTILINK */
go->neg_ssnhf = 0;
go->neg_endpoint = 0;
#ifdef HAVE_MULTILINK
@ -758,7 +758,9 @@ static int lcp_cilen(fsm *f) {
LENCILONG(go->neg_magicnumber) +
LENCIVOID(go->neg_pcompression) +
LENCIVOID(go->neg_accompression) +
#ifdef HAVE_MULTILINK
LENCISHORT(go->neg_mrru) +
#endif /* HAVE_MULTILINK */
LENCIVOID(go->neg_ssnhf) +
(go->neg_endpoint? CILEN_CHAR + go->endpoint.length: 0));
}
@ -858,7 +860,9 @@ static void lcp_addci(fsm *f, u_char *ucp, int *lenp) {
ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
ADDCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
#ifdef HAVE_MULTILINK
ADDCISHORT(CI_MRRU, go->neg_mrru, go->mrru);
#endif
ADDCIVOID(CI_SSNHF, go->neg_ssnhf);
ADDCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class,
go->endpoint.value, go->endpoint.length);
@ -1030,7 +1034,9 @@ static int lcp_ackci(fsm *f, u_char *p, int len) {
ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
ACKCIVOID(CI_ACCOMPRESSION, go->neg_accompression);
#ifdef HAVE_MULTILINK
ACKCISHORT(CI_MRRU, go->neg_mrru, go->mrru);
#endif /* HAVE_MULTILINK */
ACKCIVOID(CI_SSNHF, go->neg_ssnhf);
ACKCIENDP(CI_EPDISC, go->neg_endpoint, go->endpoint.class,
go->endpoint.value, go->endpoint.length);
@ -1360,6 +1366,7 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
NAKCIVOID(CI_PCOMPRESSION, neg_pcompression);
NAKCIVOID(CI_ACCOMPRESSION, neg_accompression);
#ifdef HAVE_MULTILINK
/*
* Nak for MRRU option - accept their value if it is smaller
* than the one we want.
@ -1372,6 +1379,7 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
try.mrru = cishort;
);
}
#endif /* HAVE_MULTILINK */
/*
* Nak for short sequence numbers shouldn't be sent, treat it
@ -1459,10 +1467,12 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
goto bad;
break;
#endif /* LQR_SUPPORT */
#ifdef HAVE_MULTILINK
case CI_MRRU:
if (go->neg_mrru || no.neg_mrru || cilen != CILEN_SHORT)
goto bad;
break;
#endif /* HAVE_MULTILINK */
case CI_SSNHF:
if (go->neg_ssnhf || no.neg_ssnhf || cilen != CILEN_VOID)
goto bad;
@ -1706,7 +1716,9 @@ static int lcp_rejci(fsm *f, u_char *p, int len) {
REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber);
REJCIVOID(CI_PCOMPRESSION, neg_pcompression);
REJCIVOID(CI_ACCOMPRESSION, neg_accompression);
#ifdef HAVE_MULTILINK
REJCISHORT(CI_MRRU, neg_mrru, go->mrru);
#endif /* HAVE_MULTILINK */
REJCIVOID(CI_SSNHF, neg_ssnhf);
REJCIENDP(CI_EPDISC, neg_endpoint, go->endpoint.class,
go->endpoint.value, go->endpoint.length);
@ -2097,11 +2109,10 @@ static int lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) {
ho->neg_accompression = 1;
break;
#ifdef HAVE_MULTILINK
case CI_MRRU:
if (!ao->neg_mrru
#ifdef HAVE_MULTILINK
|| !multilink
#endif /* HAVE_MULTILINK */
|| cilen != CILEN_SHORT) {
orc = CONFREJ;
break;
@ -2112,6 +2123,7 @@ static int lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) {
ho->neg_mrru = 1;
ho->mrru = cishort;
break;
#endif /* HAVE_MULTILINK */
case CI_SSNHF:
if (!ao->neg_ssnhf

View File

@ -106,38 +106,42 @@ struct epdisc {
* The state of options is described by an lcp_options structure.
*/
typedef struct lcp_options {
bool passive; /* Don't die if we don't get a response */
bool silent; /* Wait for the other end to start first */
bool restart; /* Restart vs. exit after close */
bool neg_mru; /* Negotiate the MRU? */
bool neg_asyncmap; /* Negotiate the async map? */
u_int passive :1; /* Don't die if we don't get a response */
u_int silent :1; /* Wait for the other end to start first */
u_int restart :1; /* Restart vs. exit after close */
u_int neg_mru :1; /* Negotiate the MRU? */
u_int neg_asyncmap :1; /* Negotiate the async map? */
#if PAP_SUPPORT
bool neg_upap; /* Ask for UPAP authentication? */
u_int neg_upap :1; /* Ask for UPAP authentication? */
#endif /* PAP_SUPPORT */
#if CHAP_SUPPORT
bool neg_chap; /* Ask for CHAP authentication? */
u_int neg_chap :1; /* Ask for CHAP authentication? */
#endif /* CHAP_SUPPORT */
#if EAP_SUPPORT
bool neg_eap; /* Ask for EAP authentication? */
u_int neg_eap :1; /* Ask for EAP authentication? */
#endif /* EAP_SUPPORT */
bool neg_magicnumber; /* Ask for magic number? */
bool neg_pcompression; /* HDLC Protocol Field Compression? */
bool neg_accompression; /* HDLC Address/Control Field Compression? */
u_int neg_magicnumber :1; /* Ask for magic number? */
u_int neg_pcompression :1; /* HDLC Protocol Field Compression? */
u_int neg_accompression :1; /* HDLC Address/Control Field Compression? */
#if LQR_SUPPORT
bool neg_lqr; /* Negotiate use of Link Quality Reports */
u_int neg_lqr :1; /* Negotiate use of Link Quality Reports */
#endif /* LQR_SUPPORT */
bool neg_cbcp; /* Negotiate use of CBCP */
bool neg_mrru; /* negotiate multilink MRRU */
bool neg_ssnhf; /* negotiate short sequence numbers */
bool neg_endpoint; /* negotiate endpoint discriminator */
int mru; /* Value of MRU */
int mrru; /* Value of MRRU, and multilink enable */
u_int neg_cbcp :1; /* Negotiate use of CBCP */
#ifdef HAVE_MULTILINK
u_int neg_mrru :1; /* negotiate multilink MRRU */
#endif /* HAVE_MULTILINK */
u_int neg_ssnhf :1; /* negotiate short sequence numbers */
u_int neg_endpoint :1; /* negotiate endpoint discriminator */
u16_t mru; /* Value of MRU */
#ifdef HAVE_MULTILINK
u16_t mrru; /* Value of MRRU, and multilink enable */
#endif /* MULTILINK */
#if CHAP_SUPPORT
u_char chap_mdtype; /* which MD types (hashing algorithm) */
u8_t chap_mdtype; /* which MD types (hashing algorithm) */
#endif /* CHAP_SUPPORT */
u_int32_t asyncmap; /* Value of async map */
u_int32_t magicnumber;
int numloops; /* Number of loops during magic number neg. */
u8_t numloops; /* Number of loops during magic number neg. */
#if LQR_SUPPORT
u_int32_t lqr_period; /* Reporting period for LQR 1/100ths second */
#endif /* LQR_SUPPORT */