From 7633c24213279e0e0095b56f75ed34b9a5ffdcbf Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 18 Oct 2020 17:10:13 +0200 Subject: [PATCH] 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. --- src/netif/ppp/pppoe.c | 2 -- src/netif/ppp/pppol2tp.c | 4 ---- 2 files changed, 6 deletions(-) diff --git a/src/netif/ppp/pppoe.c b/src/netif/ppp/pppoe.c index ee85af4f..9e4f3468 100644 --- a/src/netif/ppp/pppoe.c +++ b/src/netif/ppp/pppoe.c @@ -869,7 +869,6 @@ pppoe_timeout(void *arg) /* initialize for quick retry mode */ retry_wait = LWIP_MIN(PPPOE_DISC_TIMEOUT * sc->sc_padi_retried, PPPOE_SLOW_RETRY); 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)); LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ } @@ -890,7 +889,6 @@ pppoe_timeout(void *arg) return; } 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)); LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ } diff --git a/src/netif/ppp/pppol2tp.c b/src/netif/ppp/pppol2tp.c index 9cf06f4d..56838696 100644 --- a/src/netif/ppp/pppol2tp.c +++ b/src/netif/ppp/pppol2tp.c @@ -754,7 +754,6 @@ static void pppol2tp_timeout(void *arg) { retry_wait = LWIP_MIN(PPPOL2TP_CONTROL_TIMEOUT * l2tp->sccrq_retried, PPPOL2TP_SLOW_RETRY); PPPDEBUG(LOG_DEBUG, ("pppol2tp: sccrq_retried=%d\n", l2tp->sccrq_retried)); if ((err = pppol2tp_send_sccrq(l2tp)) != 0) { - l2tp->sccrq_retried--; PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send SCCRQ, error=%d\n", err)); 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)); 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)); LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ 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) { - l2tp->icrq_retried--; PPPDEBUG(LOG_DEBUG, ("pppol2tp: failed to send ICRQ, error=%d\n", err)); 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)); 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)); LWIP_UNUSED_ARG(err); /* if PPPDEBUG is disabled */ }