mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-24 23:25:58 +00:00
PPP, MPPE, using lwIP ERR_BUF instead of Linux DECOMP_ERROR error type
This commit is contained in:
parent
10946e7669
commit
0b7e3610ac
@ -23,6 +23,8 @@
|
|||||||
* deprecated in 2.6
|
* deprecated in 2.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "lwip/err.h"
|
||||||
|
|
||||||
#include "netif/ppp/ppp_impl.h"
|
#include "netif/ppp/ppp_impl.h"
|
||||||
#include "netif/ppp/ccp.h"
|
#include "netif/ppp/ccp.h"
|
||||||
#include "netif/ppp/mppe.h"
|
#include "netif/ppp/mppe.h"
|
||||||
@ -450,7 +452,7 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
|
|||||||
PPPDEBUG(LOG_DEBUG,
|
PPPDEBUG(LOG_DEBUG,
|
||||||
("mppe_decompress[%d]: short pkt (%d)\n",
|
("mppe_decompress[%d]: short pkt (%d)\n",
|
||||||
state->unit, isize));
|
state->unit, isize));
|
||||||
return DECOMP_ERROR;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -463,7 +465,7 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
|
|||||||
PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: osize too small! "
|
PPPDEBUG(LOG_DEBUG, ("mppe_decompress[%d]: osize too small! "
|
||||||
"(have: %d need: %d)\n", state->unit,
|
"(have: %d need: %d)\n", state->unit,
|
||||||
osize, isize - MPPE_OVHD - 1));
|
osize, isize - MPPE_OVHD - 1));
|
||||||
return DECOMP_ERROR;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
osize = isize - MPPE_OVHD - 2; /* assume no PFC */
|
osize = isize - MPPE_OVHD - 2; /* assume no PFC */
|
||||||
|
|
||||||
@ -495,14 +497,15 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
|
|||||||
|
|
||||||
if (sanity) {
|
if (sanity) {
|
||||||
if (state->sanity_errors < SANITY_MAX)
|
if (state->sanity_errors < SANITY_MAX)
|
||||||
return DECOMP_ERROR;
|
return ERR_BUF;
|
||||||
else
|
else
|
||||||
/*
|
/*
|
||||||
* Take LCP down if the peer is sending too many bogons.
|
* Take LCP down if the peer is sending too many bogons.
|
||||||
* We don't want to do this for a single or just a few
|
* We don't want to do this for a single or just a few
|
||||||
* instances since it could just be due to packet corruption.
|
* instances since it could just be due to packet corruption.
|
||||||
*/
|
*/
|
||||||
return DECOMP_FATALERROR;
|
/* FIXME: call lcp_close() here */
|
||||||
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -527,13 +530,13 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
|
|||||||
* Signal the peer to rekey (by sending a CCP Reset-Request).
|
* Signal the peer to rekey (by sending a CCP Reset-Request).
|
||||||
*/
|
*/
|
||||||
state->discard = 1;
|
state->discard = 1;
|
||||||
return DECOMP_ERROR;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* discard state */
|
/* discard state */
|
||||||
if (!flushed) {
|
if (!flushed) {
|
||||||
/* ccp.c will be silent (no additional CCP Reset-Requests). */
|
/* ccp.c will be silent (no additional CCP Reset-Requests). */
|
||||||
return DECOMP_ERROR;
|
return ERR_BUF;
|
||||||
} else {
|
} else {
|
||||||
/* Rekey for every missed "flag" packet. */
|
/* Rekey for every missed "flag" packet. */
|
||||||
while ((ccount & ~0xff) !=
|
while ((ccount & ~0xff) !=
|
||||||
@ -581,7 +584,7 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
|
|||||||
setup_sg(sg_out, obuf, 1);
|
setup_sg(sg_out, obuf, 1);
|
||||||
if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) {
|
if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) {
|
||||||
PPPDEBUG(LOG_DEBUG, ("crypto_cypher_decrypt failed\n"));
|
PPPDEBUG(LOG_DEBUG, ("crypto_cypher_decrypt failed\n"));
|
||||||
return DECOMP_ERROR;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -601,7 +604,7 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
|
|||||||
setup_sg(sg_out, obuf + 1, osize - 1);
|
setup_sg(sg_out, obuf + 1, osize - 1);
|
||||||
if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, isize - 1)) {
|
if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, isize - 1)) {
|
||||||
PPPDEBUG(LOG_DEBUG, ("crypto_cypher_decrypt failed\n"));
|
PPPDEBUG(LOG_DEBUG, ("crypto_cypher_decrypt failed\n"));
|
||||||
return DECOMP_ERROR;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->stats.unc_bytes += osize;
|
state->stats.unc_bytes += osize;
|
||||||
|
Loading…
Reference in New Issue
Block a user