X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fplugins%2Frp-pppoe%2Fplugin.c;h=93c0906119d7240fd60ba483768c3654ef642f5f;hp=9ceb66d8fcc034fceba9caa8e79f42284116370d;hb=0f9bd9807d92d624782fa3bc3d2abfb305edf7ee;hpb=c9d9dbfb8459b528ab56bd1cf0c41460801bbfdf diff --git a/pppd/plugins/rp-pppoe/plugin.c b/pppd/plugins/rp-pppoe/plugin.c index 9ceb66d..93c0906 100644 --- a/pppd/plugins/rp-pppoe/plugin.c +++ b/pppd/plugins/rp-pppoe/plugin.c @@ -46,7 +46,6 @@ static char const RCSID[] = #include #include #include -#include #include #include #include @@ -69,6 +68,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 +89,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 +119,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; } @@ -295,8 +301,10 @@ PPPOEDisconnectDevice(void) static void PPPOEDeviceOptions(void) { - char buf[256]; - snprintf(buf, 256, _PATH_ETHOPT "%s", devnam); + char buf[MAXPATHLEN]; + + strlcpy(buf, _PATH_ETHOPT, MAXPATHLEN); + strlcat(buf, devnam, MAXPATHLEN); if (!options_from_file(buf, 0, 0, 1)) exit(EXIT_OPTION_ERROR);