PPP, PPPoE, PPPoL2TP: remove persistent retries if sending packets fails

We currently retry indefinitely if sending packets fails, for example
if the output interface is down. We are even doing it if we are in
a middle of a connection process. This is not a very nice behavior
because PPP low level will retry indefinitely to connect and the user
application will never be warned that something is wrong.

We have the persist boolean in PPP settings to achieve more or less
the same thing anyway. Except it does it better at only retrying
indefinitely the initiation packet.
This commit is contained in:
Sylvain Rochet 2020-10-18 17:10:13 +02:00
parent 39cb84466d
commit 7633c24213
2 changed files with 0 additions and 6 deletions

View File

@ -869,7 +869,6 @@ pppoe_timeout(void *arg)
/* initialize for quick retry mode */ /* initialize for quick retry mode */
retry_wait = LWIP_MIN(PPPOE_DISC_TIMEOUT * sc->sc_padi_retried, PPPOE_SLOW_RETRY); retry_wait = LWIP_MIN(PPPOE_DISC_TIMEOUT * sc->sc_padi_retried, PPPOE_SLOW_RETRY);
if ((err = pppoe_send_padi(sc)) != 0) { if ((err = pppoe_send_padi(sc)) != 0) {
sc->sc_padi_retried--;
PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to transmit PADI, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err)); PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to transmit PADI, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err));
LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */
} }
@ -890,7 +889,6 @@ pppoe_timeout(void *arg)
return; return;
} }
if ((err = pppoe_send_padr(sc)) != 0) { if ((err = pppoe_send_padr(sc)) != 0) {
sc->sc_padr_retried--;
PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to send PADR, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err)); PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to send PADR, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err));
LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */
} }

View File

@ -754,7 +754,6 @@ static void pppol2tp_timeout(void *arg) {
retry_wait = LWIP_MIN(PPPOL2TP_CONTROL_TIMEOUT * l2tp->sccrq_retried, PPPOL2TP_SLOW_RETRY); retry_wait = LWIP_MIN(PPPOL2TP_CONTROL_TIMEOUT * l2tp->sccrq_retried, PPPOL2TP_SLOW_RETRY);
PPPDEBUG(LOG_DEBUG, ("pppol2tp: sccrq_retried=%d\n", l2tp->sccrq_retried)); PPPDEBUG(LOG_DEBUG, ("pppol2tp: sccrq_retried=%d\n", l2tp->sccrq_retried));
if ((err = pppol2tp_send_sccrq(l2tp)) != 0) { if ((err = pppol2tp_send_sccrq(l2tp)) != 0) {
l2tp->sccrq_retried--;
PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send SCCRQ, error=%d\n", err)); PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send SCCRQ, error=%d\n", err));
LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */
} }
@ -770,7 +769,6 @@ static void pppol2tp_timeout(void *arg) {
PPPDEBUG(LOG_DEBUG, ("pppol2tp: icrq_retried=%d\n", l2tp->icrq_retried)); PPPDEBUG(LOG_DEBUG, ("pppol2tp: icrq_retried=%d\n", l2tp->icrq_retried));
if ((s16_t)(l2tp->peer_nr - l2tp->our_ns) < 0) { /* 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) { 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)); PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send SCCCN, error=%d\n", err));
LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */
sys_timeout(PPPOL2TP_CONTROL_TIMEOUT, pppol2tp_timeout, l2tp); sys_timeout(PPPOL2TP_CONTROL_TIMEOUT, pppol2tp_timeout, l2tp);
@ -778,7 +776,6 @@ static void pppol2tp_timeout(void *arg) {
} }
} }
if ((err = pppol2tp_send_icrq(l2tp, l2tp->our_ns)) != 0) { if ((err = pppol2tp_send_icrq(l2tp, l2tp->our_ns)) != 0) {
l2tp->icrq_retried--;
PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send ICRQ, error=%d\n", err)); PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send ICRQ, error=%d\n", err));
LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */
} }
@ -793,7 +790,6 @@ static void pppol2tp_timeout(void *arg) {
} }
PPPDEBUG(LOG_DEBUG, ("pppol2tp: iccn_retried=%d\n", l2tp->iccn_retried)); PPPDEBUG(LOG_DEBUG, ("pppol2tp: iccn_retried=%d\n", l2tp->iccn_retried));
if ((err = pppol2tp_send_iccn(l2tp, l2tp->our_ns)) != 0) { if ((err = pppol2tp_send_iccn(l2tp, l2tp->our_ns)) != 0) {
l2tp->iccn_retried--;
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 */
} }