PPP: cleanup

Code cleaning only (misleading indents or comments, etc.), no behavior
change.
This commit is contained in:
Sylvain Rochet 2020-10-17 16:01:00 +02:00
parent bedb4e4745
commit 88ac7460f0
2 changed files with 11 additions and 26 deletions

View File

@ -874,7 +874,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
}
#endif /* CCP_SUPPORT */
switch(protocol) {
switch (protocol) {
#if PPP_IPV4_SUPPORT
case PPP_IP: /* Internet Protocol */
@ -963,13 +963,14 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
#endif /* PPP_PROTOCOLNAME */
ppp_warn(("Unsupported protocol 0x%x received", protocol));
#endif /* PPP_DEBUG */
if (pbuf_add_header(pb, sizeof(protocol))) {
PPPDEBUG(LOG_WARNING, ("ppp_input[%d]: Dropping (pbuf_add_header failed)\n", pcb->netif->num));
goto drop;
}
lcp_sprotrej(pcb, (u8_t*)pb->payload, pb->len);
if (pbuf_add_header(pb, sizeof(protocol))) {
PPPDEBUG(LOG_WARNING, ("ppp_input[%d]: Dropping (pbuf_add_header failed)\n", pcb->netif->num));
goto drop;
}
break;
lcp_sprotrej(pcb, (u8_t*)pb->payload, pb->len);
}
break;
}
drop:

View File

@ -502,6 +502,7 @@ pppos_input(ppp_pcb *ppp, u8_t *s, int l)
}
escaped = ESCAPE_P(pppos->in_accm, cur_char);
PPPOS_UNPROTECT(lev);
/* Handle special characters. */
if (escaped) {
/* Check for escape sequences. */
@ -591,50 +592,33 @@ pppos_input(ppp_pcb *ppp, u8_t *s, int l)
}
/* Process character relative to current state. */
switch(pppos->in_state) {
switch (pppos->in_state) {
case PDIDLE: /* Idle state - waiting. */
/* Drop the character if it's not 0xff
* we would have processed a flag character above. */
if (cur_char != PPP_ALLSTATIONS) {
break;
}
/* no break */
/* Fall through */
case PDSTART: /* Process start flag. */
/* Prepare for a new packet. */
pppos->in_fcs = PPP_INITFCS;
/* no break */
/* Fall through */
case PDADDRESS: /* Process address field. */
if (cur_char == PPP_ALLSTATIONS) {
pppos->in_state = PDCONTROL;
break;
}
/* no break */
/* Else assume compressed address and control fields so
* fall through to get the protocol... */
/* Fall through */
case PDCONTROL: /* Process control field. */
/* If we don't get a valid control code, restart. */
if (cur_char == PPP_UI) {
pppos->in_state = PDPROTOCOL1;
break;
}
/* no break */
#if 0
else {
PPPDEBUG(LOG_WARNING,
("pppos_input[%d]: Invalid control <%d>\n", ppp->netif->num, cur_char));
pppos->in_state = PDSTART;
}
#endif
/* Fall through */
case PDPROTOCOL1: /* Process protocol field 1. */
case PDPROTOCOL1: /* Process protocol field 1. */
/* If the lower bit is set, this is the end of the protocol
* field. */
if (cur_char & 1) {