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 */ #endif /* CCP_SUPPORT */
switch(protocol) { switch (protocol) {
#if PPP_IPV4_SUPPORT #if PPP_IPV4_SUPPORT
case PPP_IP: /* Internet Protocol */ case PPP_IP: /* Internet Protocol */
@ -963,13 +963,14 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
#endif /* PPP_PROTOCOLNAME */ #endif /* PPP_PROTOCOLNAME */
ppp_warn(("Unsupported protocol 0x%x received", protocol)); ppp_warn(("Unsupported protocol 0x%x received", protocol));
#endif /* PPP_DEBUG */ #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)); if (pbuf_add_header(pb, sizeof(protocol))) {
goto drop; 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);
} }
break; lcp_sprotrej(pcb, (u8_t*)pb->payload, pb->len);
}
break;
} }
drop: 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); escaped = ESCAPE_P(pppos->in_accm, cur_char);
PPPOS_UNPROTECT(lev); PPPOS_UNPROTECT(lev);
/* Handle special characters. */ /* Handle special characters. */
if (escaped) { if (escaped) {
/* Check for escape sequences. */ /* Check for escape sequences. */
@ -591,50 +592,33 @@ pppos_input(ppp_pcb *ppp, u8_t *s, int l)
} }
/* Process character relative to current state. */ /* Process character relative to current state. */
switch(pppos->in_state) { switch (pppos->in_state) {
case PDIDLE: /* Idle state - waiting. */ case PDIDLE: /* Idle state - waiting. */
/* Drop the character if it's not 0xff /* Drop the character if it's not 0xff
* we would have processed a flag character above. */ * we would have processed a flag character above. */
if (cur_char != PPP_ALLSTATIONS) { if (cur_char != PPP_ALLSTATIONS) {
break; break;
} }
/* no break */
/* Fall through */ /* Fall through */
case PDSTART: /* Process start flag. */ case PDSTART: /* Process start flag. */
/* Prepare for a new packet. */ /* Prepare for a new packet. */
pppos->in_fcs = PPP_INITFCS; pppos->in_fcs = PPP_INITFCS;
/* no break */
/* Fall through */ /* Fall through */
case PDADDRESS: /* Process address field. */ case PDADDRESS: /* Process address field. */
if (cur_char == PPP_ALLSTATIONS) { if (cur_char == PPP_ALLSTATIONS) {
pppos->in_state = PDCONTROL; pppos->in_state = PDCONTROL;
break; break;
} }
/* no break */
/* Else assume compressed address and control fields so /* Else assume compressed address and control fields so
* fall through to get the protocol... */ * fall through to get the protocol... */
/* Fall through */ /* Fall through */
case PDCONTROL: /* Process control field. */ case PDCONTROL: /* Process control field. */
/* If we don't get a valid control code, restart. */
if (cur_char == PPP_UI) { if (cur_char == PPP_UI) {
pppos->in_state = PDPROTOCOL1; pppos->in_state = PDPROTOCOL1;
break; 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 */ /* 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 /* If the lower bit is set, this is the end of the protocol
* field. */ * field. */
if (cur_char & 1) { if (cur_char & 1) {