From 73bd762a65c68cea716fcd84d2225bb6b3b9104f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sun, 21 Apr 2024 11:03:54 +0200 Subject: [PATCH] plugins/pppoe: Remove 5 second delay before PADR in verbose mode This partially reverts commit 1c082acf77e6 ("pppoe: Show verbose information about all concentrator when pppoe-verbose option is set", 2021-01-01). That commit added a 5-second wait between receiving a valid PADO and sending the PADR response so as to give time to see whether any other PADOs arrive. However, it appears that this delay causes problems with some concentrators. This reverts to the previous behaviour of sending the PADR immediately. Signed-off-by: Paul Mackerras --- pppd/plugins/pppoe/discovery.c | 8 ++++---- pppd/plugins/pppoe/plugin.c | 2 +- pppd/plugins/pppoe/pppoe-discovery.c | 2 +- pppd/plugins/pppoe/pppoe.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pppd/plugins/pppoe/discovery.c b/pppd/plugins/pppoe/discovery.c index ccb88b2..4f0b561 100644 --- a/pppd/plugins/pppoe/discovery.c +++ b/pppd/plugins/pppoe/discovery.c @@ -379,7 +379,7 @@ sendPADI(PPPoEConnection *conn) * Waits for a PADO packet and copies useful information ***********************************************************************/ void -waitForPADO(PPPoEConnection *conn, int timeout) +waitForPADO(PPPoEConnection *conn, int timeout, int waitWholeTimeoutForPADO) { fd_set readable; int r; @@ -480,7 +480,7 @@ waitForPADO(PPPoEConnection *conn, int timeout) conn->discoveryState = STATE_RECEIVED_PADO; } } - } while (pppoe_verbose >= 1 || conn->discoveryState != STATE_RECEIVED_PADO); + } while (waitWholeTimeoutForPADO || conn->discoveryState != STATE_RECEIVED_PADO); } /*********************************************************************** @@ -668,7 +668,7 @@ waitForPADS(PPPoEConnection *conn, int timeout) * Performs the PPPoE discovery phase 1 ***********************************************************************/ void -discovery1(PPPoEConnection *conn) +discovery1(PPPoEConnection *conn, int waitWholeTimeoutForPADO) { int padiAttempts = 0; int timeout = conn->discoveryTimeout; @@ -683,7 +683,7 @@ discovery1(PPPoEConnection *conn) } sendPADI(conn); conn->discoveryState = STATE_SENT_PADI; - waitForPADO(conn, timeout); + waitForPADO(conn, timeout, waitWholeTimeoutForPADO); timeout *= 2; } while (conn->discoveryState == STATE_SENT_PADI); diff --git a/pppd/plugins/pppoe/plugin.c b/pppd/plugins/pppoe/plugin.c index 7d4709e..56a7255 100644 --- a/pppd/plugins/pppoe/plugin.c +++ b/pppd/plugins/pppoe/plugin.c @@ -217,7 +217,7 @@ PPPOEConnectDevice(void) error("Failed to create PPPoE discovery socket: %m"); goto errout; } - discovery1(conn); + discovery1(conn, 0); /* discovery1() may update conn->mtu and conn->mru */ lcp_allowoptions[0].mru = conn->mtu; lcp_wantoptions[0].mru = conn->mru; diff --git a/pppd/plugins/pppoe/pppoe-discovery.c b/pppd/plugins/pppoe/pppoe-discovery.c index 5b1b2dc..79ad805 100644 --- a/pppd/plugins/pppoe/pppoe-discovery.c +++ b/pppd/plugins/pppoe/pppoe-discovery.c @@ -258,7 +258,7 @@ int main(int argc, char *argv[]) exit(1); } - discovery1(conn); + discovery1(conn, 1); if (!conn->numPADOs) exit(1); diff --git a/pppd/plugins/pppoe/pppoe.h b/pppd/plugins/pppoe/pppoe.h index 9360edd..88c3c23 100644 --- a/pppd/plugins/pppoe/pppoe.h +++ b/pppd/plugins/pppoe/pppoe.h @@ -272,7 +272,7 @@ void initPPP(void); void clampMSS(PPPoEPacket *packet, char const *dir, int clampMss); UINT16_t computeTCPChecksum(unsigned char *ipHdr, unsigned char *tcpHdr); UINT16_t pppFCS16(UINT16_t fcs, unsigned char *cp, int len); -void discovery1(PPPoEConnection *conn); +void discovery1(PPPoEConnection *conn, int waitWholeTimeoutForPADO); void discovery2(PPPoEConnection *conn); unsigned char *findTag(PPPoEPacket *packet, UINT16_t tagType, PPPoETag *tag); -- 2.39.5