* one argument: the logical name of the device to bring up. Does not
* detach until the interface is up or has permanently failed to come up.
*
- * Copyright 1999-2001 Red Hat, Inc.
+ * Copyright 1999-2003 Red Hat, Inc.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
#include "shvar.h"
#define IFCFGPREFIX "/etc/sysconfig/interfaces/ifcfg-"
-#define IFUP_PPP "/etc/sysconfig/network-scripts/ifup-ppp"
+#define IFUP_PPP "/lib/rc-scripts/ifup-ppp"
static int theSigterm = 0;
static int theSigint = 0;
* of the pppd process to its parent (i.e., it reads nothing). */
close (pipeArray[0]);
+ /* Don't leak this into programs we call. */
+ fcntl(pipeArray[1], F_SETFD, FD_CLOEXEC);
+
/* Redirect stdio to /dev/null. */
fd = open("/dev/null", O_RDONLY);
dup2(fd, STDIN_FILENO);
strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name) - 1);
ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0';
- /* We return TRUE if the ioctl succeeded and the interface is UP. */
+ /* We return TRUE iff the ioctl succeeded and the interface is UP. */
if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) {
retcode = FALSE;
} else if (ifr.ifr_flags & IFF_UP) {
int maxfail = 0; // MAXFAIL Patch <ssharkey@linux-no-limits.com>
if (argc < 2) {
- fprintf (stderr, "usage: ppp-watch [ifcfg-]<logical-name> [boot]\n");
+ fprintf (stderr, "usage: ppp-watch <interface-name> [boot]\n");
exit(30);
}
dying = TRUE;
/* Get the pid of our child pppd. */
- pppLogicalToPhysical(&pppdPid, real_device, NULL);
+ pppLogicalToPhysical(&pppdPid, device, NULL);
/* We don't know what our child pid is. This is very confusing. */
if (!pppdPid) {
ifcfg = shvarfilesGet(device);
/* Get the PID of our child pppd. */
- pppLogicalToPhysical(&pppdPid, real_device, NULL);
+ pppLogicalToPhysical(&pppdPid, device, NULL);
kill(pppdPid, SIGTERM);
/* We'll redial when the SIGCHLD arrives, even if PERSIST is
if (theSigio) {
theSigio = 0;
- pppLogicalToPhysical(NULL, real_device, &physicalDevice);
+ pppLogicalToPhysical(NULL, device, &physicalDevice);
if (physicalDevice) {
if (interfaceIsUp(physicalDevice)) {
/* The interface is up, so report a success to a parent if
break;
}
- /* We default to retrying the connect phase for backward
- * compatibility, unless RETRYCONNECT is false. */
+ /* PGB 08/20/02: We no longer retry connecting MAXFAIL
+ times on a failed connect script unless RETRYCONNECT is
+ true. */
if ((WEXITSTATUS(status) == 8) &&
- !svTrueValue(ifcfg, "RETRYCONNECT", TRUE)) {
+ !svTrueValue(ifcfg, "RETRYCONNECT", FALSE)) {
failureExit(WEXITSTATUS(status));
}
sleep(timeout);
sigprocmask(SIG_BLOCK, &blockedsigs, NULL);
if (!theSigterm &&
+ !theSigint &&
!theSighup &&
!theSigio &&
!theSigchld &&
}
if ( maxfail != 0 ) {
dialCount++;
- if ( dialCount < maxfail ) {
- fork_exec(FALSE, IFUP_PPP, "daemon", device, boot);
- } else {
+ if ( dialCount >= maxfail )
failureExit(WEXITSTATUS(status));
- }
- } else {
- fork_exec(FALSE, IFUP_PPP, "daemon", device, boot);
}
} else {
failureExit(WEXITSTATUS(status));