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 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src') 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)); } -- cgit v1.2.1