PPP, PPPoL2TP: wait for ICCN ack before starting PPP

L2TP tunnel is really UP only once we received the ICCN Ack packet,
generally with a ZLB packet. We actually drop all data packets until
we reach the "data" L2TP state, which is a sane thing to do, therefore
it makes no sense at all to start the PPP session a bit earlier.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
This commit is contained in:
Sylvain Rochet 2018-06-15 00:47:29 +02:00
parent b9fe13c105
commit 5b8760601b

View File

@ -500,6 +500,7 @@ static void pppol2tp_dispatch_control_packet(pppol2tp_pcb *l2tp, u16_t port, str
/* Handle the special case of the ICCN acknowledge */ /* Handle the special case of the ICCN acknowledge */
if (l2tp->phase == PPPOL2TP_STATE_ICCN_SENT && l2tp->peer_nr > l2tp->our_ns) { if (l2tp->phase == PPPOL2TP_STATE_ICCN_SENT && l2tp->peer_nr > l2tp->our_ns) {
l2tp->phase = PPPOL2TP_STATE_DATA; l2tp->phase = PPPOL2TP_STATE_DATA;
ppp_start(l2tp->ppp); /* notify upper layers */
} }
/* ZLB packets */ /* ZLB packets */
@ -686,7 +687,6 @@ nextavp:
l2tp->iccn_retried = 0; l2tp->iccn_retried = 0;
l2tp->phase = PPPOL2TP_STATE_ICCN_SENT; l2tp->phase = PPPOL2TP_STATE_ICCN_SENT;
l2tp->our_ns++; l2tp->our_ns++;
ppp_start(l2tp->ppp); /* notify upper layers */
if ((err = pppol2tp_send_iccn(l2tp, l2tp->our_ns)) != 0) { if ((err = pppol2tp_send_iccn(l2tp, l2tp->our_ns)) != 0) {
PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send ICCN, error=%d\n", err)); PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send ICCN, error=%d\n", err));
LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */