From 6cdbc1fbbfd1de615402e1ddcc1dbb1590b69dd5 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 12 Dec 2000 07:37:48 +0000 Subject: add MAXFAIL patch for maximum number of failures (#10639) --- src/ppp-watch.c | 24 +++++++++++++++++++++++- sysconfig.txt | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/ppp-watch.c b/src/ppp-watch.c index a264dd90..2a7e53e4 100644 --- a/src/ppp-watch.c +++ b/src/ppp-watch.c @@ -85,6 +85,9 @@ static int theSigio = 0; static int theSigchld = 0; static int theSigalrm = 0; +// patch to respect the maxfail parameter to ppp +// Scott Sharkey +static int dialCount = 0; static int theChild; @@ -454,6 +457,7 @@ main(int argc, char **argv) { int dieing = 0; int sendsig; int connectedOnce = 0; + int maxfail = 0; // MAXFAIL Patch if (argc < 2) { fprintf (stderr, "usage: ppp-watch [ifcfg-] [boot]\n"); @@ -636,7 +640,25 @@ main(int argc, char **argv) { tv.tv_sec = timeout; select(0, NULL, NULL, NULL, &tv); } - fork_exec(0, "/etc/sysconfig/network-scripts/ifup-ppp", "daemon", device, theBoot); +// Scott Sharkey +// MAXFAIL Patch... + temp = svGetValue(ifcfg, "MAXFAIL"); + if (temp) { + maxfail = atoi(temp); + free(temp); + } else { + maxfail = 0; + } + if ( maxfail != 0 ) { + dialCount++; + if ( dialCount < maxfail ) { + fork_exec(0, "/etc/sysconfig/network-scripts/ifup-ppp", "daemon", device, theBoot); + } else { + cleanExit(WEXITSTATUS(status)); + } + } else { + fork_exec(0, "/etc/sysconfig/network-scripts/ifup-ppp", "daemon", device, theBoot); + } } else { cleanExit(WEXITSTATUS(status)); } diff --git a/sysconfig.txt b/sysconfig.txt index 673d20af..712231e2 100644 --- a/sysconfig.txt +++ b/sysconfig.txt @@ -427,6 +427,9 @@ Files in /etc/sysconfig/network-scripts/ is made to bring up the connection. Note that some connect scripts (for example, wvdial) might do their own retries (such as BUSY or NO DIALTONE conditions). + MAXFAIL= + If this is set, this will cause ppp-watch to exit after + the specified number of attempts. DEMAND=yes|no Switches on demand-dialing mode using pppd's "demand" option. IDLETIMEOUT=600 -- cgit v1.2.1