]> git.ozlabs.org Git - ppp.git/commitdiff
plugins/pppoe: Remove 5 second delay before PADR in verbose mode
authorPali Rohár <pali@kernel.org>
Sun, 21 Apr 2024 09:03:54 +0000 (11:03 +0200)
committerPaul Mackerras <paulus@ozlabs.org>
Mon, 29 Apr 2024 02:46:07 +0000 (12:46 +1000)
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 <paulus@ozlabs.org>
pppd/plugins/pppoe/discovery.c
pppd/plugins/pppoe/plugin.c
pppd/plugins/pppoe/pppoe-discovery.c
pppd/plugins/pppoe/pppoe.h

index ccb88b2d6bf576e775758add1ec8af397393cb1d..4f0b561593b1a34a2468e54314c5f4547c1d38f7 100644 (file)
@@ -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);
index 7d4709ecf6fbd69068fefc919d579bb4c99885a3..56a7255e1c24fd470ba1d04f9c973f7b1c6f6bfd 100644 (file)
@@ -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;
index 5b1b2dc05295257f5e79878f64aaf8e7cce1af53..79ad805cfabd93c6119b9dc2d5e047b6fb3c384d 100644 (file)
@@ -258,7 +258,7 @@ int main(int argc, char *argv[])
        exit(1);
     }
 
-    discovery1(conn);
+    discovery1(conn, 1);
 
     if (!conn->numPADOs)
        exit(1);
index 9360eddf8149a83b309d3f0867a75b41f9943040..88c3c233a4987b597b283944d12a6e89baaecc7d 100644 (file)
@@ -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);