mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-04 05:39:53 +00:00
PPP, L2TP: remove useless L2TP state conditions
L2TP state can't be anything else than initial state in pppol2tp_connect, this function is called from PPP core only when PPP is in the dead phase, if PPP is in the dead phase it means the link protocol is dead as well. L2TP can't be anything else than data phase in pppol2tp_xmit, this function is only called by pppol2tp_write and pppol2tp_netif_output which are both called by PPP core only when PPP session is up, if PPP session is UP it means the link protocol is UP as well. L2TP can't be anything else than data phase in pppol2tp_disconnect, this function is only called by PPP core only when PPP session is up, if PPP session is UP it means the link protocol is UP as well.
This commit is contained in:
parent
bae67915ab
commit
e8d8c5dcc9
@ -262,10 +262,6 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
|
||||
ipcp_options *ipcp_ao;
|
||||
#endif /* PPP_IPV4_SUPPORT && VJ_SUPPORT */
|
||||
|
||||
if (l2tp->phase != PPPOL2TP_STATE_INITIAL) {
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
pppol2tp_clear(l2tp);
|
||||
|
||||
ppp_link_start(ppp);
|
||||
@ -328,10 +324,6 @@ static err_t pppol2tp_connect(ppp_pcb *ppp, void *ctx) {
|
||||
static void pppol2tp_disconnect(ppp_pcb *ppp, void *ctx) {
|
||||
pppol2tp_pcb *l2tp = (pppol2tp_pcb *)ctx;
|
||||
|
||||
if (l2tp->phase < PPPOL2TP_STATE_DATA) {
|
||||
return;
|
||||
}
|
||||
|
||||
l2tp->our_ns++;
|
||||
pppol2tp_send_stopccn(l2tp, l2tp->our_ns);
|
||||
|
||||
@ -346,6 +338,7 @@ static void pppol2tp_input(void *arg, struct udp_pcb *pcb, struct pbuf *p, const
|
||||
u8_t *inp;
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
|
||||
/* we can't unbound a UDP pcb, thus we can still receive UDP frames after the link is closed */
|
||||
if (l2tp->phase < PPPOL2TP_STATE_SCCRQ_SENT) {
|
||||
goto free_and_return;
|
||||
}
|
||||
@ -1113,12 +1106,6 @@ static err_t pppol2tp_send_stopccn(pppol2tp_pcb *l2tp, u16_t ns) {
|
||||
static err_t pppol2tp_xmit(pppol2tp_pcb *l2tp, struct pbuf *pb) {
|
||||
u8_t *p;
|
||||
|
||||
/* are we ready to process data yet? */
|
||||
if (l2tp->phase < PPPOL2TP_STATE_DATA) {
|
||||
pbuf_free(pb);
|
||||
return ERR_CONN;
|
||||
}
|
||||
|
||||
/* make room for L2TP header - should not fail */
|
||||
if (pbuf_header(pb, (s16_t)PPPOL2TP_OUTPUT_DATA_HEADER_LEN) != 0) {
|
||||
/* bail out */
|
||||
|
Loading…
Reference in New Issue
Block a user