mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-12 13:13:21 +00:00
PPP: fix don't print valid LCP echo request/reply packets if the link is up
The check for link up was missing, meaning valid LCP echo request/reply packets are filtered whatever the PPP state is, despite what the comment says. Fix it by checking the PPP state as we would like to have done when it was written.
This commit is contained in:
parent
4e1f8effaf
commit
4af297fc20
@ -620,7 +620,7 @@ void ppp_warn(const char *fmt, ...); /* log a warning message */
|
||||
void ppp_error(const char *fmt, ...); /* log an error message */
|
||||
void ppp_fatal(const char *fmt, ...); /* log an error message and die(1) */
|
||||
#if PRINTPKT_SUPPORT
|
||||
void ppp_dump_packet(const char *tag, unsigned char *p, int len);
|
||||
void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len);
|
||||
/* dump packet to debug log if interesting */
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
|
@ -780,7 +780,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
|
||||
protocol = (((u8_t *)pb->payload)[0] << 8) | ((u8_t*)pb->payload)[1];
|
||||
|
||||
#if PRINTPKT_SUPPORT
|
||||
ppp_dump_packet("rcvd", (unsigned char *)pb->payload, pb->len);
|
||||
ppp_dump_packet(pcb, "rcvd", (unsigned char *)pb->payload, pb->len);
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
|
||||
pbuf_header(pb, -(s16_t)sizeof(protocol));
|
||||
@ -1006,7 +1006,7 @@ struct pbuf *ppp_singlebuf(struct pbuf *p) {
|
||||
*/
|
||||
err_t ppp_write(ppp_pcb *pcb, struct pbuf *p) {
|
||||
#if PRINTPKT_SUPPORT
|
||||
ppp_dump_packet("sent", (unsigned char *)p->payload+2, p->len-2);
|
||||
ppp_dump_packet(pcb, "sent", (unsigned char *)p->payload+2, p->len-2);
|
||||
#endif /* PRINTPKT_SUPPORT */
|
||||
return pcb->link_cb->write(pcb, pcb->link_ctx_cb, p);
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ void ppp_dbglog(const char *fmt, ...) {
|
||||
* ppp_dump_packet - print out a packet in readable form if it is interesting.
|
||||
* Assumes len >= PPP_HDRLEN.
|
||||
*/
|
||||
void ppp_dump_packet(const char *tag, unsigned char *p, int len) {
|
||||
void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len) {
|
||||
int proto;
|
||||
|
||||
/*
|
||||
@ -713,9 +713,9 @@ void ppp_dump_packet(const char *tag, unsigned char *p, int len) {
|
||||
return;
|
||||
|
||||
/*
|
||||
* don't print LCP echo request/reply packets if the link is up.
|
||||
* don't print valid LCP echo request/reply packets if the link is up.
|
||||
*/
|
||||
if (proto == PPP_LCP && len >= 2 + HEADERLEN) {
|
||||
if (proto == PPP_LCP && pcb->phase == PPP_PHASE_RUNNING && len >= 2 + HEADERLEN) {
|
||||
unsigned char *lcp = p + 2;
|
||||
int l = (lcp[2] << 8) + lcp[3];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user