PPP, re-enabled MRU defines in opt.h

This commit is contained in:
Sylvain Rochet 2015-05-01 00:08:34 +02:00
parent aacc222b7d
commit 29ba3df717
3 changed files with 28 additions and 27 deletions

View File

@ -2001,7 +2001,7 @@
#endif #endif
/** /**
* pbuf_type PPP is using for LCP, PAP, CHAP, EAP, IPCP and IP6CP packets. * pbuf_type PPP is using for LCP, PAP, CHAP, EAP, CCP, IPCP and IP6CP packets.
* *
* Memory allocated must be single buffered for PPP to works, it requires pbuf * Memory allocated must be single buffered for PPP to works, it requires pbuf
* that are not going to be chained when allocated. This requires setting * that are not going to be chained when allocated. This requires setting
@ -2015,7 +2015,7 @@
#endif #endif
/** /**
* PPP_FCS_TABLE: Keep a 256*2 byte table to speed up FCS calculation * PPP_FCS_TABLE: Keep a 256*2 byte table to speed up FCS calculation for PPPoS
*/ */
#ifndef PPP_FCS_TABLE #ifndef PPP_FCS_TABLE
#define PPP_FCS_TABLE 1 #define PPP_FCS_TABLE 1
@ -2299,28 +2299,27 @@
/* /*
* Packet sizes * Packet sizes
*
* Note - lcp shouldn't be allowed to negotiate stuff outside these
* limits. See lcp.h in the pppd directory.
* (XXX - these constants should simply be shared by lcp.c instead
* of living in lcp.h)
*/ */
#define PPP_MTU 1500 /* Default MTU (size of Info field) */ #ifndef PPP_MRU
#ifndef PPP_MAXMTU #define PPP_MRU 1500 /* Default MRU */
/* #define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN) */
#define PPP_MAXMTU 1500 /* Largest MTU we allow */
#endif #endif
#define PPP_MINMTU 64
#define PPP_MRU 1500 /* default MRU = max length of info field */
#define PPP_MAXMRU 1500 /* Largest MRU we allow */
#ifndef PPP_DEFMRU #ifndef PPP_DEFMRU
#define PPP_DEFMRU 296 /* Try for this */ #define PPP_DEFMRU 1500 /* Default MRU to try */
#endif
#ifndef PPP_MAXMRU
#define PPP_MAXMRU 1500 /* Normally limit MRU to this (pppd default = 16384) */
#endif
#ifndef PPP_MINMRU
#define PPP_MINMRU 128 /* No MRUs below this */
#endif #endif
#define PPP_MINMRU 128 /* No MRUs below this */
#ifndef MAXNAMELEN #ifndef MAXNAMELEN
#define MAXNAMELEN 256 /* max length of hostname or name for auth */ #define MAXNAMELEN 256 /* max length of hostname or name for auth */
#endif #endif
#ifndef MAXSECRETLEN #ifndef MAXSECRETLEN
#define MAXSECRETLEN 256 /* max length of password or secret */ #define MAXSECRETLEN 256 /* max length of password or secret */
#endif #endif

View File

@ -90,9 +90,11 @@
/* Value used as data for CI_CALLBACK option */ /* Value used as data for CI_CALLBACK option */
#define CBCP_OPT 6 /* Use callback control protocol */ #define CBCP_OPT 6 /* Use callback control protocol */
#if 0 /* moved to opt.h */
#define DEFMRU 1500 /* Try for this */ #define DEFMRU 1500 /* Try for this */
#define MINMRU 128 /* No MRUs below this */ #define MINMRU 128 /* No MRUs below this */
#define MAXMRU 16384 /* Normally limit MRU to this */ #define MAXMRU 16384 /* Normally limit MRU to this */
#endif /* moved to opt.h */
/* An endpoint discriminator, used with multilink. */ /* An endpoint discriminator, used with multilink. */
#define MAX_ENDP_LEN 20 /* maximum length of discriminator value */ #define MAX_ENDP_LEN 20 /* maximum length of discriminator value */

View File

@ -373,7 +373,7 @@ static void lcp_init(ppp_pcb *pcb) {
BZERO(wo, sizeof(*wo)); BZERO(wo, sizeof(*wo));
wo->neg_mru = 1; wo->neg_mru = 1;
wo->mru = DEFMRU; wo->mru = PPP_DEFMRU;
wo->neg_asyncmap = 1; wo->neg_asyncmap = 1;
wo->neg_magicnumber = 1; wo->neg_magicnumber = 1;
wo->neg_pcompression = 1; wo->neg_pcompression = 1;
@ -381,7 +381,7 @@ static void lcp_init(ppp_pcb *pcb) {
BZERO(ao, sizeof(*ao)); BZERO(ao, sizeof(*ao));
ao->neg_mru = 1; ao->neg_mru = 1;
ao->mru = MAXMRU; ao->mru = PPP_MAXMRU;
ao->neg_asyncmap = 1; ao->neg_asyncmap = 1;
#if CHAP_SUPPORT #if CHAP_SUPPORT
ao->neg_chap = 1; ao->neg_chap = 1;
@ -782,7 +782,7 @@ static int lcp_cilen(fsm *f) {
* accept more than one. We prefer EAP first, then CHAP, then * accept more than one. We prefer EAP first, then CHAP, then
* PAP. * PAP.
*/ */
return (LENCISHORT(go->neg_mru && go->mru != DEFMRU) + return (LENCISHORT(go->neg_mru && go->mru != PPP_DEFMRU) +
LENCILONG(go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF) + LENCILONG(go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF) +
#if EAP_SUPPORT #if EAP_SUPPORT
LENCISHORT(go->neg_eap) + LENCISHORT(go->neg_eap) +
@ -883,7 +883,7 @@ static void lcp_addci(fsm *f, u_char *ucp, int *lenp) {
PUTCHAR(val[i], ucp); \ PUTCHAR(val[i], ucp); \
} }
ADDCISHORT(CI_MRU, go->neg_mru && go->mru != DEFMRU, go->mru); ADDCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru);
ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF, ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF,
go->asyncmap); go->asyncmap);
#if EAP_SUPPORT #if EAP_SUPPORT
@ -1057,7 +1057,7 @@ static int lcp_ackci(fsm *f, u_char *p, int len) {
} \ } \
} }
ACKCISHORT(CI_MRU, go->neg_mru && go->mru != DEFMRU, go->mru); ACKCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru);
ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF, ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFF,
go->asyncmap); go->asyncmap);
#if EAP_SUPPORT #if EAP_SUPPORT
@ -1234,9 +1234,9 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
* If they send us a bigger MRU than what we asked, accept it, up to * If they send us a bigger MRU than what we asked, accept it, up to
* the limit of the default MRU we'd get if we didn't negotiate. * the limit of the default MRU we'd get if we didn't negotiate.
*/ */
if (go->neg_mru && go->mru != DEFMRU) { if (go->neg_mru && go->mru != PPP_DEFMRU) {
NAKCISHORT(CI_MRU, neg_mru, NAKCISHORT(CI_MRU, neg_mru,
if (cishort <= wo->mru || cishort <= DEFMRU) if (cishort <= wo->mru || cishort <= PPP_DEFMRU)
try_.mru = cishort; try_.mru = cishort;
); );
} }
@ -1479,11 +1479,11 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) {
switch (citype) { switch (citype) {
case CI_MRU: case CI_MRU:
if ((go->neg_mru && go->mru != DEFMRU) if ((go->neg_mru && go->mru != PPP_DEFMRU)
|| no.neg_mru || cilen != CILEN_SHORT) || no.neg_mru || cilen != CILEN_SHORT)
goto bad; goto bad;
GETSHORT(cishort, p); GETSHORT(cishort, p);
if (cishort < DEFMRU) { if (cishort < PPP_DEFMRU) {
try_.neg_mru = 1; try_.neg_mru = 1;
try_.mru = cishort; try_.mru = cishort;
} }
@ -1881,11 +1881,11 @@ static int lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) {
* No need to check a maximum. If he sends a large number, * No need to check a maximum. If he sends a large number,
* we'll just ignore it. * we'll just ignore it.
*/ */
if (cishort < MINMRU) { if (cishort < PPP_MINMRU) {
orc = CONFNAK; /* Nak CI */ orc = CONFNAK; /* Nak CI */
PUTCHAR(CI_MRU, nakoutp); PUTCHAR(CI_MRU, nakoutp);
PUTCHAR(CILEN_SHORT, nakoutp); PUTCHAR(CILEN_SHORT, nakoutp);
PUTSHORT(MINMRU, nakoutp); /* Give him a hint */ PUTSHORT(PPP_MINMRU, nakoutp); /* Give him a hint */
break; break;
} }
ho->neg_mru = 1; /* Remember he sent MRU */ ho->neg_mru = 1; /* Remember he sent MRU */