mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-19 23:12:09 +00:00
PPP, PPPoL2TP: take care of Ns/Nr wraparounds
It can't be an issue since we only send and receive a few L2TP control packets and we don't care about anything received next other than sending Ack packet. For the sake of correctness properly handle Ns/Nr counters wraparounds, it doesn't add more code anyway. Signed-off-by: Sylvain Rochet <gradator@gradator.net>
This commit is contained in:
parent
5b8760601b
commit
047c3c6528
@ -498,7 +498,7 @@ static void pppol2tp_dispatch_control_packet(pppol2tp_pcb *l2tp, u16_t port, str
|
||||
/* printf("L2TP CTRL INPUT, ns=%d, nr=%d, len=%d\n", ns, nr, p->len); */
|
||||
|
||||
/* 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 && (s16_t)(l2tp->peer_nr - l2tp->our_ns) > 0) {
|
||||
l2tp->phase = PPPOL2TP_STATE_DATA;
|
||||
ppp_start(l2tp->ppp); /* notify upper layers */
|
||||
}
|
||||
@ -742,7 +742,7 @@ static void pppol2tp_timeout(void *arg) {
|
||||
return;
|
||||
}
|
||||
PPPDEBUG(LOG_DEBUG, ("pppol2tp: icrq_retried=%d\n", l2tp->icrq_retried));
|
||||
if (l2tp->peer_nr <= l2tp->our_ns -1) { /* the SCCCN was not acknowledged */
|
||||
if ((s16_t)(l2tp->peer_nr - l2tp->our_ns) < 0) { /* the SCCCN was not acknowledged */
|
||||
if ((err = pppol2tp_send_scccn(l2tp, l2tp->our_ns -1)) != 0) {
|
||||
l2tp->icrq_retried--;
|
||||
PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send SCCCN, error=%d\n", err));
|
||||
|
Loading…
Reference in New Issue
Block a user