diff options
author | Bill Nottingham <notting@redhat.com> | 2001-01-29 22:58:43 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2001-01-29 22:58:43 +0000 |
commit | 48308fb5d11f1b7a55cbeb3127ec0d549cc0440e (patch) | |
tree | 1e1bf5635a9c739bf15104560942faf9750ccc38 | |
parent | 5a6393159db215f4dcaadfa1dc1fb388634bc6ec (diff) | |
download | initscripts-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)
-rw-r--r-- | initscripts.spec | 3 | ||||
-rw-r--r-- | src/ppp-watch.c | 79 | ||||
-rwxr-xr-x | sysconfig/network-scripts/ifdown-ppp | 7 |
3 files changed, 51 insertions, 38 deletions
diff --git a/initscripts.spec b/initscripts.spec index 6ad7ce38..f56139e2 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -245,6 +245,9 @@ rm -rf $RPM_BUILD_ROOT %ghost %attr(0664,root,utmp) /var/run/utmp %changelog +* Mon Jan 29 2001 Bill Nottingham <notting@redhat.com> +- add plusb support (#18892, patch from <eric.ayers@compgen.com>) + * Wed Jan 24 2001 Bill Nottingham <notting@redhat.com> - quiet LVM setup (#24841) - fix inability to shutdown cleanly (#24889) 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"); diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp index 9ebb8c91..e76732b9 100755 --- a/sysconfig/network-scripts/ifdown-ppp +++ b/sysconfig/network-scripts/ifdown-ppp @@ -12,8 +12,9 @@ if [ "${DEMAND}" != no -a -f /var/run/ppp-${DEVICE}.pid ] ; then kill -TERM ${PID} sleep 2 [ ! -d /proc/${PID} ] && exit 0 + sleep 5 + [ ! -d /proc/${PID} ] && exit 0 kill -TERM ${PID} - sleep 2 [ ! -d /proc/${PID} ] && exit 0 exit 1 fi @@ -32,6 +33,10 @@ kill -TERM ${PID} > /dev/null 2>&1 [ ! -d /proc/${PID} ] && exit 0 sleep 2 [ ! -d /proc/${PID} ] && exit 0 +sleep 5 +[ ! -d /proc/${PID} ] && exit 0 +sleep 10 +[ ! -d /proc/${PID} ] && exit 0 # killing ppp-watch twice in a row causes it to send a SIGKILL to pppd pgrp kill -TERM ${PID} > /dev/null 2>&1 |