Skip to content

Commit

Permalink
plugins/pppoe: Remove 5 second delay before PADR in verbose mode
Browse files Browse the repository at this point in the history
This partially reverts commit 1c082ac ("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 <[email protected]>
  • Loading branch information
pali authored and paulusmack committed Apr 29, 2024
1 parent cc12c3d commit 73bd762
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pppd/plugins/pppoe/discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/***********************************************************************
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion pppd/plugins/pppoe/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pppd/plugins/pppoe/pppoe-discovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ int main(int argc, char *argv[])
exit(1);
}

discovery1(conn);
discovery1(conn, 1);

if (!conn->numPADOs)
exit(1);
Expand Down
2 changes: 1 addition & 1 deletion pppd/plugins/pppoe/pppoe.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 73bd762

Please sign in to comment.