aboutsummaryrefslogtreecommitdiffstats
path: root/src/ppp-watch.c
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2001-01-29 22:58:43 +0000
committerBill Nottingham <notting@redhat.com>2001-01-29 22:58:43 +0000
commit48308fb5d11f1b7a55cbeb3127ec0d549cc0440e (patch)
tree1e1bf5635a9c739bf15104560942faf9750ccc38 /src/ppp-watch.c
parent5a6393159db215f4dcaadfa1dc1fb388634bc6ec (diff)
downloadinitscripts-48308fb5d11f1b7a55cbeb3127ec0d549cc0440e.tar
initscripts-48308fb5d11f1b7a55cbeb3127ec0d549cc0440e.tar.gz
initscripts-48308fb5d11f1b7a55cbeb3127ec0d549cc0440e.tar.bz2
initscripts-48308fb5d11f1b7a55cbeb3127ec0d549cc0440e.tar.xz
initscripts-48308fb5d11f1b7a55cbeb3127ec0d549cc0440e.zip
don't ignore RETRYTIMEOUT when we never connect (#14701)
Diffstat (limited to 'src/ppp-watch.c')
-rw-r--r--src/ppp-watch.c79
1 files changed, 42 insertions, 37 deletions
diff --git a/src/ppp-watch.c b/src/ppp-watch.c
index 2a7e53e4..7bc483ae 100644
--- a/src/ppp-watch.c
+++ b/src/ppp-watch.c
@@ -449,11 +449,10 @@ main(int argc, char **argv) {
char *device, *real_device, *physicalDevice = NULL;
char *theBoot = NULL;
shvarFile *ifcfg;
- sigset_t sigs;
+ sigset_t blockedsigs, unblockedsigs;
int pppdPid = 0;
int timeout = 30;
char *temp;
- struct timeval tv;
int dieing = 0;
int sendsig;
int connectedOnce = 0;
@@ -500,23 +499,23 @@ main(int argc, char **argv) {
/* don't set up the procmask until after we have received the netreport
* signal
*/
- sigemptyset(&sigs);
- sigaddset(&sigs, SIGTERM);
- sigaddset(&sigs, SIGINT);
- sigaddset(&sigs, SIGHUP);
- sigaddset(&sigs, SIGIO);
- sigaddset(&sigs, SIGCHLD);
- if (theBoot) sigaddset(&sigs, SIGALRM);
- sigprocmask(SIG_BLOCK, &sigs, NULL);
+ sigemptyset(&blockedsigs);
+ sigaddset(&blockedsigs, SIGTERM);
+ sigaddset(&blockedsigs, SIGINT);
+ sigaddset(&blockedsigs, SIGHUP);
+ sigaddset(&blockedsigs, SIGIO);
+ sigaddset(&blockedsigs, SIGCHLD);
+ if (theBoot) sigaddset(&blockedsigs, SIGALRM);
+ sigprocmask(SIG_BLOCK, &blockedsigs, NULL);
/* prepare for sigsuspend later */
- sigfillset(&sigs);
- sigdelset(&sigs, SIGTERM);
- sigdelset(&sigs, SIGINT);
- sigdelset(&sigs, SIGHUP);
- sigdelset(&sigs, SIGIO);
- sigdelset(&sigs, SIGCHLD);
- if (theBoot) sigdelset(&sigs, SIGALRM);
+ sigfillset(&unblockedsigs);
+ sigdelset(&unblockedsigs, SIGTERM);
+ sigdelset(&unblockedsigs, SIGINT);
+ sigdelset(&unblockedsigs, SIGHUP);
+ sigdelset(&unblockedsigs, SIGIO);
+ sigdelset(&unblockedsigs, SIGCHLD);
+ if (theBoot) sigdelset(&unblockedsigs, SIGALRM);
fork_exec(0, "/etc/sysconfig/network-scripts/ifup-ppp", "daemon", device, theBoot);
temp = svGetValue(ifcfg, "RETRYTIMEOUT");
@@ -528,7 +527,8 @@ main(int argc, char **argv) {
}
while (1) {
- sigsuspend(&sigs);
+ if (!theSigterm && !theSigint && !theSighup && !theSigio && !theSigchld && !theSigalrm)
+ sigsuspend(&unblockedsigs);
if (theSigterm || theSigint) {
theSigterm = theSigint = 0;
@@ -568,13 +568,6 @@ main(int argc, char **argv) {
theSigio = 0;
if (connectedOnce) {
if (physicalDevice) { free(physicalDevice); physicalDevice = NULL; }
- temp = svGetValue(ifcfg, "DISCONNECTTIMEOUT");
- if (temp) {
- timeout = atoi(temp);
- free(temp);
- } else {
- timeout = 2;
- }
}
physicalDevice = pppLogicalToPhysical(NULL, real_device);
if (physicalDevice) {
@@ -628,18 +621,30 @@ main(int argc, char **argv) {
if ((WEXITSTATUS(status) == 8) ||
!connectedOnce || svTrueValue(ifcfg, "PERSIST", 0)) {
- temp = svGetValue(ifcfg, "RETRYTIMEOUT");
- if (temp) {
- timeout = atoi(temp);
- free(temp);
- } else {
- timeout = 30;
- }
- if (connectedOnce) {
- memset(&tv, 0, sizeof(tv));
- tv.tv_sec = timeout;
- select(0, NULL, NULL, NULL, &tv);
- }
+ if (!connectedOnce) {
+ temp = svGetValue(ifcfg, "RETRYTIMEOUT");
+ if (temp) {
+ timeout = atoi(temp);
+ free(temp);
+ } else {
+ timeout = 30;
+ }
+
+ } else {
+ connectedOnce = 0;
+ temp = svGetValue(ifcfg, "DISCONNECTTIMEOUT");
+ if (temp) {
+ timeout = atoi(temp);
+ free(temp);
+ } else {
+ timeout = 2;
+ }
+ }
+ sigprocmask(SIG_UNBLOCK, &blockedsigs, NULL);
+ sleep(timeout);
+ sigprocmask(SIG_BLOCK, &blockedsigs, NULL);
+ if (!theSigterm && !theSighup && !theSigio && !theSighchld && !theSigalrm)
+ fork_exec(0, "/etc/sysconfig/network-scripts/ifup-ppp", "daemon", device, theBoot);
// Scott Sharkey <ssharkey@linux-no-limits.com>
// MAXFAIL Patch...
temp = svGetValue(ifcfg, "MAXFAIL");