]> git.ozlabs.org Git - ppp.git/commitdiff
rp-pppoe plugin: Add options to tune discovery timeout and number of attempts
authorAlexis Cellier <alexis.cellier@openwide.fr>
Wed, 11 Jul 2018 14:16:42 +0000 (16:16 +0200)
committerPaul Mackerras <paulus@samba.org>
Sat, 25 May 2019 10:00:44 +0000 (20:00 +1000)
Add new options pppoe-padi-timeout and pppoe-padi-attempts.

These modifications are the similar to the ones done on
pppoe-discovery in commit 70a8ad3d ("pppoe-discovery: add options to
tune discovery timeout and attempts", 2017-12-07).

Signed-off-by: Alexis Cellier <alexis.cellier@smile.fr>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pppd/plugins/rp-pppoe/discovery.c
pppd/plugins/rp-pppoe/plugin.c

index 16a59f77f09b0761951684d8868c277913066abd..2aebcd1c13ac1205511e32bade4d9d22442668b7 100644 (file)
@@ -622,7 +622,7 @@ discovery(PPPoEConnection *conn)
 
     do {
        padiAttempts++;
-       if (padiAttempts > MAX_PADI_ATTEMPTS) {
+       if (padiAttempts > conn->discoveryAttempts) {
            warn("Timeout waiting for PADO packets");
            close(conn->discoverySocket);
            conn->discoverySocket = -1;
@@ -638,7 +638,7 @@ discovery(PPPoEConnection *conn)
     timeout = conn->discoveryTimeout;
     do {
        padrAttempts++;
-       if (padrAttempts > MAX_PADI_ATTEMPTS) {
+       if (padrAttempts > conn->discoveryAttempts) {
            warn("Timeout waiting for PADS packets");
            close(conn->discoverySocket);
            conn->discoverySocket = -1;
index 9ceb66d8fcc034fceba9caa8e79f42284116370d..9e838d30d58b81208b9289ff239acfb9937f03fb 100644 (file)
@@ -69,6 +69,8 @@ static int printACNames = 0;
 static char *pppoe_reqd_mac = NULL;
 unsigned char pppoe_reqd_mac_addr[6];
 static char *host_uniq;
+static int pppoe_padi_timeout = PADI_TIMEOUT;
+static int pppoe_padi_attempts = MAX_PADI_ATTEMPTS;
 
 static int PPPoEDevnameHook(char *cmd, char **argv, int doit);
 static option_t Options[] = {
@@ -88,6 +90,10 @@ static option_t Options[] = {
       "Only connect to specified MAC address" },
     { "host-uniq", o_string, &host_uniq,
       "Set the Host-Uniq to the supplied hex string" },
+    { "pppoe-padi-timeout", o_int, &pppoe_padi_timeout,
+      "Initial timeout for discovery packets in seconds" },
+    { "pppoe-padi-attempts", o_int, &pppoe_padi_attempts,
+      "Number of discovery attempts" },
     { NULL }
 };
 int (*OldDevnameHook)(char *cmd, char **argv, int doit) = NULL;
@@ -114,7 +120,8 @@ PPPOEInitDevice(void)
     conn->discoverySocket = -1;
     conn->sessionSocket = -1;
     conn->printACNames = printACNames;
-    conn->discoveryTimeout = PADI_TIMEOUT;
+    conn->discoveryTimeout = pppoe_padi_timeout;
+    conn->discoveryAttempts = pppoe_padi_attempts;
     return 1;
 }