mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-05 05:54:37 +08:00
LQR (Link Quality Report) support is now optional
This commit is contained in:
parent
5464ed6661
commit
05817aa3b9
@ -1748,6 +1748,13 @@
|
|||||||
#define ECP_SUPPORT 0
|
#define ECP_SUPPORT 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LQR_SUPPORT==1: Support Link Quality Report. Do nothing except exchanging some LCP packets.
|
||||||
|
*/
|
||||||
|
#ifndef LQR_SUPPORT
|
||||||
|
#define LQR_SUPPORT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VJ_SUPPORT==1: Support VJ header compression.
|
* VJ_SUPPORT==1: Support VJ header compression.
|
||||||
*/
|
*/
|
||||||
|
@ -313,7 +313,9 @@ int lcp_loopbackfail = DEFLOOPBACKFAIL;
|
|||||||
#define CILEN_CHAP 5 /* CILEN_VOID + 2 + 1 */
|
#define CILEN_CHAP 5 /* CILEN_VOID + 2 + 1 */
|
||||||
#endif /* CHAP_SUPPORT */
|
#endif /* CHAP_SUPPORT */
|
||||||
#define CILEN_LONG 6 /* CILEN_VOID + 4 */
|
#define CILEN_LONG 6 /* CILEN_VOID + 4 */
|
||||||
|
#if LQR_SUPPORT
|
||||||
#define CILEN_LQR 8 /* CILEN_VOID + 2 + 4 */
|
#define CILEN_LQR 8 /* CILEN_VOID + 2 + 4 */
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#define CILEN_CBCP 3
|
#define CILEN_CBCP 3
|
||||||
|
|
||||||
#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
|
#define CODENAME(x) ((x) == CONFACK ? "ACK" : \
|
||||||
@ -721,7 +723,9 @@ lcp_cilen(f)
|
|||||||
#endif /* CHAP_SUPPORT */
|
#endif /* CHAP_SUPPORT */
|
||||||
#define LENCISHORT(neg) ((neg) ? CILEN_SHORT : 0)
|
#define LENCISHORT(neg) ((neg) ? CILEN_SHORT : 0)
|
||||||
#define LENCILONG(neg) ((neg) ? CILEN_LONG : 0)
|
#define LENCILONG(neg) ((neg) ? CILEN_LONG : 0)
|
||||||
|
#if LQR_SUPPORT
|
||||||
#define LENCILQR(neg) ((neg) ? CILEN_LQR: 0)
|
#define LENCILQR(neg) ((neg) ? CILEN_LQR: 0)
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#define LENCICBCP(neg) ((neg) ? CILEN_CBCP: 0)
|
#define LENCICBCP(neg) ((neg) ? CILEN_CBCP: 0)
|
||||||
/*
|
/*
|
||||||
* NB: we only ask for one of CHAP, UPAP, or EAP, even if we will
|
* NB: we only ask for one of CHAP, UPAP, or EAP, even if we will
|
||||||
@ -755,7 +759,9 @@ lcp_cilen(f)
|
|||||||
LENCISHORT(go->neg_upap) +
|
LENCISHORT(go->neg_upap) +
|
||||||
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
|
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
|
||||||
#endif /* PAP_SUPPORT */
|
#endif /* PAP_SUPPORT */
|
||||||
|
#if LQR_SUPPORT
|
||||||
LENCILQR(go->neg_lqr) +
|
LENCILQR(go->neg_lqr) +
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
LENCICBCP(go->neg_cbcp) +
|
LENCICBCP(go->neg_cbcp) +
|
||||||
LENCILONG(go->neg_magicnumber) +
|
LENCILONG(go->neg_magicnumber) +
|
||||||
LENCIVOID(go->neg_pcompression) +
|
LENCIVOID(go->neg_pcompression) +
|
||||||
@ -804,6 +810,7 @@ lcp_addci(f, ucp, lenp)
|
|||||||
PUTCHAR(CILEN_LONG, ucp); \
|
PUTCHAR(CILEN_LONG, ucp); \
|
||||||
PUTLONG(val, ucp); \
|
PUTLONG(val, ucp); \
|
||||||
}
|
}
|
||||||
|
#if LQR_SUPPORT
|
||||||
#define ADDCILQR(opt, neg, val) \
|
#define ADDCILQR(opt, neg, val) \
|
||||||
if (neg) { \
|
if (neg) { \
|
||||||
PUTCHAR(opt, ucp); \
|
PUTCHAR(opt, ucp); \
|
||||||
@ -811,6 +818,7 @@ lcp_addci(f, ucp, lenp)
|
|||||||
PUTSHORT(PPP_LQR, ucp); \
|
PUTSHORT(PPP_LQR, ucp); \
|
||||||
PUTLONG(val, ucp); \
|
PUTLONG(val, ucp); \
|
||||||
}
|
}
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#define ADDCICHAR(opt, neg, val) \
|
#define ADDCICHAR(opt, neg, val) \
|
||||||
if (neg) { \
|
if (neg) { \
|
||||||
PUTCHAR(opt, ucp); \
|
PUTCHAR(opt, ucp); \
|
||||||
@ -855,7 +863,9 @@ lcp_addci(f, ucp, lenp)
|
|||||||
ADDCISHORT(CI_AUTHTYPE, go->neg_upap, PPP_PAP);
|
ADDCISHORT(CI_AUTHTYPE, go->neg_upap, PPP_PAP);
|
||||||
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
|
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
|
||||||
#endif /* PAP_SUPPORT */
|
#endif /* PAP_SUPPORT */
|
||||||
|
#if LQR_SUPPORT
|
||||||
ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
|
ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
ADDCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
|
ADDCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
|
||||||
ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
|
ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
|
||||||
ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
|
ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
|
||||||
@ -963,6 +973,7 @@ lcp_ackci(f, p, len)
|
|||||||
if (cilong != val) \
|
if (cilong != val) \
|
||||||
goto bad; \
|
goto bad; \
|
||||||
}
|
}
|
||||||
|
#if LQR_SUPPORT
|
||||||
#define ACKCILQR(opt, neg, val) \
|
#define ACKCILQR(opt, neg, val) \
|
||||||
if (neg) { \
|
if (neg) { \
|
||||||
if ((len -= CILEN_LQR) < 0) \
|
if ((len -= CILEN_LQR) < 0) \
|
||||||
@ -979,6 +990,7 @@ lcp_ackci(f, p, len)
|
|||||||
if (cilong != val) \
|
if (cilong != val) \
|
||||||
goto bad; \
|
goto bad; \
|
||||||
}
|
}
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#define ACKCIENDP(opt, neg, class, val, vlen) \
|
#define ACKCIENDP(opt, neg, class, val, vlen) \
|
||||||
if (neg) { \
|
if (neg) { \
|
||||||
int i; \
|
int i; \
|
||||||
@ -1027,7 +1039,9 @@ lcp_ackci(f, p, len)
|
|||||||
ACKCISHORT(CI_AUTHTYPE, go->neg_upap, PPP_PAP);
|
ACKCISHORT(CI_AUTHTYPE, go->neg_upap, PPP_PAP);
|
||||||
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
|
#endif /* !EAP_SUPPORT && !CHAP_SUPPORT */
|
||||||
#endif /* PAP_SUPPORT */
|
#endif /* PAP_SUPPORT */
|
||||||
|
#if LQR_SUPPORT
|
||||||
ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
|
ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period);
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
ACKCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
|
ACKCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT);
|
||||||
ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
|
ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber);
|
||||||
ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
|
ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression);
|
||||||
@ -1140,6 +1154,7 @@ lcp_nakci(f, p, len, treat_as_reject)
|
|||||||
no.neg = 1; \
|
no.neg = 1; \
|
||||||
code \
|
code \
|
||||||
}
|
}
|
||||||
|
#if LQR_SUPPORT
|
||||||
#define NAKCILQR(opt, neg, code) \
|
#define NAKCILQR(opt, neg, code) \
|
||||||
if (go->neg && \
|
if (go->neg && \
|
||||||
len >= CILEN_LQR && \
|
len >= CILEN_LQR && \
|
||||||
@ -1152,6 +1167,7 @@ lcp_nakci(f, p, len, treat_as_reject)
|
|||||||
no.neg = 1; \
|
no.neg = 1; \
|
||||||
code \
|
code \
|
||||||
}
|
}
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#define NAKCIENDP(opt, neg) \
|
#define NAKCIENDP(opt, neg) \
|
||||||
if (go->neg && \
|
if (go->neg && \
|
||||||
len >= CILEN_CHAR && \
|
len >= CILEN_CHAR && \
|
||||||
@ -1328,6 +1344,7 @@ lcp_nakci(f, p, len, treat_as_reject)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if LQR_SUPPORT
|
||||||
/*
|
/*
|
||||||
* If they can't cope with our link quality protocol, we'll have
|
* If they can't cope with our link quality protocol, we'll have
|
||||||
* to stop asking for LQR. We haven't got any other protocol.
|
* to stop asking for LQR. We haven't got any other protocol.
|
||||||
@ -1339,6 +1356,7 @@ lcp_nakci(f, p, len, treat_as_reject)
|
|||||||
else
|
else
|
||||||
try.lqr_period = cilong;
|
try.lqr_period = cilong;
|
||||||
);
|
);
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only implementing CBCP...not the rest of the callback options
|
* Only implementing CBCP...not the rest of the callback options
|
||||||
@ -1456,10 +1474,12 @@ lcp_nakci(f, p, len, treat_as_reject)
|
|||||||
|| cilen != CILEN_VOID)
|
|| cilen != CILEN_VOID)
|
||||||
goto bad;
|
goto bad;
|
||||||
break;
|
break;
|
||||||
|
#if LQR_SUPPORT
|
||||||
case CI_QUALITY:
|
case CI_QUALITY:
|
||||||
if (go->neg_lqr || no.neg_lqr || cilen != CILEN_LQR)
|
if (go->neg_lqr || no.neg_lqr || cilen != CILEN_LQR)
|
||||||
goto bad;
|
goto bad;
|
||||||
break;
|
break;
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
case CI_MRRU:
|
case CI_MRRU:
|
||||||
if (go->neg_mrru || no.neg_mrru || cilen != CILEN_SHORT)
|
if (go->neg_mrru || no.neg_mrru || cilen != CILEN_SHORT)
|
||||||
goto bad;
|
goto bad;
|
||||||
@ -1636,6 +1656,7 @@ lcp_rejci(f, p, len)
|
|||||||
goto bad; \
|
goto bad; \
|
||||||
try.neg = 0; \
|
try.neg = 0; \
|
||||||
}
|
}
|
||||||
|
#if LQR_SUPPORT
|
||||||
#define REJCILQR(opt, neg, val) \
|
#define REJCILQR(opt, neg, val) \
|
||||||
if (go->neg && \
|
if (go->neg && \
|
||||||
len >= CILEN_LQR && \
|
len >= CILEN_LQR && \
|
||||||
@ -1650,6 +1671,7 @@ lcp_rejci(f, p, len)
|
|||||||
goto bad; \
|
goto bad; \
|
||||||
try.neg = 0; \
|
try.neg = 0; \
|
||||||
}
|
}
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#define REJCICBCP(opt, neg, val) \
|
#define REJCICBCP(opt, neg, val) \
|
||||||
if (go->neg && \
|
if (go->neg && \
|
||||||
len >= CILEN_CBCP && \
|
len >= CILEN_CBCP && \
|
||||||
@ -1701,7 +1723,9 @@ lcp_rejci(f, p, len)
|
|||||||
#if EAP_SUPPORT
|
#if EAP_SUPPORT
|
||||||
}
|
}
|
||||||
#endif /* EAP_SUPPORT */
|
#endif /* EAP_SUPPORT */
|
||||||
|
#if LQR_SUPPORT
|
||||||
REJCILQR(CI_QUALITY, neg_lqr, go->lqr_period);
|
REJCILQR(CI_QUALITY, neg_lqr, go->lqr_period);
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
REJCICBCP(CI_CALLBACK, neg_cbcp, CBCP_OPT);
|
REJCICBCP(CI_CALLBACK, neg_cbcp, CBCP_OPT);
|
||||||
REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber);
|
REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber);
|
||||||
REJCIVOID(CI_PCOMPRESSION, neg_pcompression);
|
REJCIVOID(CI_PCOMPRESSION, neg_pcompression);
|
||||||
@ -2026,6 +2050,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree)
|
|||||||
{}
|
{}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if LQR_SUPPORT
|
||||||
case CI_QUALITY:
|
case CI_QUALITY:
|
||||||
if (!ao->neg_lqr ||
|
if (!ao->neg_lqr ||
|
||||||
cilen != CILEN_LQR) {
|
cilen != CILEN_LQR) {
|
||||||
@ -2049,6 +2074,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
|
|
||||||
case CI_MAGICNUMBER:
|
case CI_MAGICNUMBER:
|
||||||
if (!(ao->neg_magicnumber || go->neg_magicnumber) ||
|
if (!(ao->neg_magicnumber || go->neg_magicnumber) ||
|
||||||
@ -2394,6 +2420,7 @@ lcp_printpkt(p, plen, printer, arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#if LQR_SUPPORT
|
||||||
case CI_QUALITY:
|
case CI_QUALITY:
|
||||||
if (olen >= CILEN_SHORT) {
|
if (olen >= CILEN_SHORT) {
|
||||||
p += 2;
|
p += 2;
|
||||||
@ -2408,6 +2435,7 @@ lcp_printpkt(p, plen, printer, arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
case CI_CALLBACK:
|
case CI_CALLBACK:
|
||||||
if (olen >= CILEN_CHAR) {
|
if (olen >= CILEN_CHAR) {
|
||||||
p += 2;
|
p += 2;
|
||||||
|
@ -103,7 +103,9 @@ typedef struct lcp_options {
|
|||||||
bool neg_magicnumber; /* Ask for magic number? */
|
bool neg_magicnumber; /* Ask for magic number? */
|
||||||
bool neg_pcompression; /* HDLC Protocol Field Compression? */
|
bool neg_pcompression; /* HDLC Protocol Field Compression? */
|
||||||
bool neg_accompression; /* HDLC Address/Control Field Compression? */
|
bool neg_accompression; /* HDLC Address/Control Field Compression? */
|
||||||
|
#if LQR_SUPPORT
|
||||||
bool neg_lqr; /* Negotiate use of Link Quality Reports */
|
bool neg_lqr; /* Negotiate use of Link Quality Reports */
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
bool neg_cbcp; /* Negotiate use of CBCP */
|
bool neg_cbcp; /* Negotiate use of CBCP */
|
||||||
bool neg_mrru; /* negotiate multilink MRRU */
|
bool neg_mrru; /* negotiate multilink MRRU */
|
||||||
bool neg_ssnhf; /* negotiate short sequence numbers */
|
bool neg_ssnhf; /* negotiate short sequence numbers */
|
||||||
@ -116,7 +118,9 @@ typedef struct lcp_options {
|
|||||||
u_int32_t asyncmap; /* Value of async map */
|
u_int32_t asyncmap; /* Value of async map */
|
||||||
u_int32_t magicnumber;
|
u_int32_t magicnumber;
|
||||||
int numloops; /* Number of loops during magic number neg. */
|
int numloops; /* Number of loops during magic number neg. */
|
||||||
|
#if LQR_SUPPORT
|
||||||
u_int32_t lqr_period; /* Reporting period for LQR 1/100ths second */
|
u_int32_t lqr_period; /* Reporting period for LQR 1/100ths second */
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
struct epdisc endpoint; /* endpoint discriminator */
|
struct epdisc endpoint; /* endpoint discriminator */
|
||||||
} lcp_options;
|
} lcp_options;
|
||||||
|
|
||||||
|
@ -491,7 +491,10 @@ static void ppp_input(void *arg) {
|
|||||||
* except LCP, LQR and authentication packets.
|
* except LCP, LQR and authentication packets.
|
||||||
*/
|
*/
|
||||||
if (phase <= PHASE_AUTHENTICATE
|
if (phase <= PHASE_AUTHENTICATE
|
||||||
&& !(protocol == PPP_LCP || protocol == PPP_LQR
|
&& !(protocol == PPP_LCP
|
||||||
|
#if LQR_SUPPORT
|
||||||
|
|| protocol == PPP_LQR
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#if PAP_SUPPORT
|
#if PAP_SUPPORT
|
||||||
|| protocol == PPP_PAP
|
|| protocol == PPP_PAP
|
||||||
#endif /* PAP_SUPPORT */
|
#endif /* PAP_SUPPORT */
|
||||||
|
@ -109,8 +109,9 @@ typedef unsigned char bool;
|
|||||||
#if PAP_SUPPORT
|
#if PAP_SUPPORT
|
||||||
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
|
#define PPP_PAP 0xc023 /* Password Authentication Protocol */
|
||||||
#endif /* PAP_SUPPORT */
|
#endif /* PAP_SUPPORT */
|
||||||
/* FIXME: make LQR support optional, anyway, there is no LQR support at all in pppd */
|
#if LQR_SUPPORT
|
||||||
#define PPP_LQR 0xc025 /* Link Quality Report protocol */
|
#define PPP_LQR 0xc025 /* Link Quality Report protocol */
|
||||||
|
#endif /* LQR_SUPPORT */
|
||||||
#if CHAP_SUPPORT
|
#if CHAP_SUPPORT
|
||||||
#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
|
#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
|
||||||
#endif /* CHAP_SUPPORT */
|
#endif /* CHAP_SUPPORT */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user