mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-29 00:32:51 +00:00
PPP, CCP, MPPE, handle CCP Reset-Request and Reset-Ack for MPPE
This commit is contained in:
parent
74670ec07f
commit
42fb74ce22
@ -277,10 +277,10 @@ extern int maxoctets_timeout; /* Timeout for check of octets limit */
|
||||
#define PPP_OCTETS_DIRECTION_MAXSESSION 4
|
||||
#endif
|
||||
|
||||
/* Data input is only used by CCP and ECP, which are not supported at this time,
|
||||
* remove this entry from struct protent to save some flash
|
||||
/* Data input may be used by CCP and ECP, remove this entry
|
||||
* from struct protent to save some flash
|
||||
*/
|
||||
#define PPP_DATAINPUT (CCP_SUPPORT || ECP_SUPPORT)
|
||||
#define PPP_DATAINPUT 0
|
||||
|
||||
/*
|
||||
* The following struct gives the addresses of procedures to call
|
||||
@ -474,9 +474,15 @@ void netif_set_mtu(ppp_pcb *pcb, int mtu);
|
||||
int netif_get_mtu(ppp_pcb *pcb);
|
||||
|
||||
#if CCP_SUPPORT
|
||||
#if 0 /* unused */
|
||||
int ccp_test(ppp_pcb *pcb, u_char *opt_ptr, int opt_len, int for_transmit);
|
||||
#endif /* unused */
|
||||
void ccp_set(ppp_pcb *pcb, u8_t isopen, u8_t isup, u8_t receive_method, u8_t transmit_method);
|
||||
void ccp_reset_comp(ppp_pcb *pcb);
|
||||
void ccp_reset_decomp(ppp_pcb *pcb);
|
||||
#if 0 /* unused */
|
||||
int ccp_fatal_error(ppp_pcb *pcb);
|
||||
#endif /* unused */
|
||||
#endif /* CCP_SUPPORT */
|
||||
|
||||
#if PPP_IDLETIMELIMIT
|
||||
|
@ -175,7 +175,9 @@ static void ccp_protrej(ppp_pcb *pcb);
|
||||
#if PRINTPKT_SUPPORT
|
||||
static int ccp_printpkt(u_char *p, int plen, void (*printer) (void *, const char *, ...), void *arg);
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
#if PPP_DATAINPUT
|
||||
static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len);
|
||||
#endif /* PPP_DATAINPUT */
|
||||
|
||||
const struct protent ccp_protent = {
|
||||
PPP_CCP,
|
||||
@ -502,6 +504,7 @@ static int ccp_extcode(fsm *f, int code, int id, u_char *p, int len) {
|
||||
case CCP_RESETREQ:
|
||||
if (f->state != PPP_FSM_OPENED)
|
||||
break;
|
||||
ccp_reset_comp(pcb);
|
||||
/* send a reset-ack, which the transmitter will see and
|
||||
reset its compression state. */
|
||||
fsm_sdata(f, CCP_RESETACK, id, NULL, 0);
|
||||
@ -511,6 +514,7 @@ static int ccp_extcode(fsm *f, int code, int id, u_char *p, int len) {
|
||||
if ((pcb->ccp_localstate & RACK_PENDING) && id == f->reqid) {
|
||||
pcb->ccp_localstate &= ~(RACK_PENDING | RREQ_REPEAT);
|
||||
UNTIMEOUT(ccp_rack_timeout, f);
|
||||
ccp_reset_decomp(pcb);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1642,6 +1646,7 @@ static int ccp_printpkt(u_char *p, int plen, void (*printer) (void *, const char
|
||||
}
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
#if PPP_DATAINPUT
|
||||
/*
|
||||
* We have received a packet that the decompressor failed to
|
||||
* decompress. Here we would expect to issue a reset-request, but
|
||||
@ -1694,6 +1699,7 @@ static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* PPP_DATAINPUT */
|
||||
|
||||
/*
|
||||
* Timeout waiting for reset-ack.
|
||||
|
@ -1216,6 +1216,7 @@ int netif_get_mtu(ppp_pcb *pcb) {
|
||||
}
|
||||
|
||||
#if CCP_SUPPORT
|
||||
#if 0 /* unused */
|
||||
/*
|
||||
* ccp_test - whether a given compression method is acceptable for use.
|
||||
*/
|
||||
@ -1228,6 +1229,7 @@ ccp_test(ppp_pcb *pcb, u_char *opt_ptr, int opt_len, int for_transmit)
|
||||
LWIP_UNUSED_ARG(for_transmit);
|
||||
return -1;
|
||||
}
|
||||
#endif /* unused */
|
||||
|
||||
/*
|
||||
* ccp_set - inform about the current state of CCP.
|
||||
@ -1243,6 +1245,35 @@ ccp_set(ppp_pcb *pcb, u8_t isopen, u8_t isup, u8_t receive_method, u8_t transmit
|
||||
pcb->netif->num, isopen, isup, receive_method, transmit_method));
|
||||
}
|
||||
|
||||
void
|
||||
ccp_reset_comp(ppp_pcb *pcb)
|
||||
{
|
||||
switch (pcb->ccp_transmit_method) {
|
||||
#if MPPE_SUPPORT
|
||||
case CI_MPPE:
|
||||
mppe_comp_reset(pcb, &pcb->mppe_comp);
|
||||
break;
|
||||
#endif /* MPPE_SUPPORT */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ccp_reset_decomp(ppp_pcb *pcb)
|
||||
{
|
||||
switch (pcb->ccp_receive_method) {
|
||||
#if MPPE_SUPPORT
|
||||
case CI_MPPE:
|
||||
mppe_decomp_reset(pcb, &pcb->mppe_decomp);
|
||||
break;
|
||||
#endif /* MPPE_SUPPORT */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 /* unused */
|
||||
/*
|
||||
* ccp_fatal_error - returns 1 if decompression was disabled as a
|
||||
* result of an error detected after decompression of a packet,
|
||||
@ -1254,6 +1285,7 @@ ccp_fatal_error(ppp_pcb *pcb)
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
return 1;
|
||||
}
|
||||
#endif /* unused */
|
||||
#endif /* CCP_SUPPORT */
|
||||
|
||||
#if PPP_IDLETIMELIMIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user