summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/main.c
diff options
context:
space:
mode:
authornate <nate@FreeBSD.org>1996-12-03 21:38:52 +0000
committernate <nate@FreeBSD.org>1996-12-03 21:38:52 +0000
commit8620fc8544ff62f29a19ab194cb21a092e314a97 (patch)
treebb44448442ea3de595c180ce0d9d0398f57509f7 /usr.sbin/ppp/main.c
parent1aa66460f8fa844a7fec1e9c9cf4bca3e5528b72 (diff)
downloadFreeBSD-src-8620fc8544ff62f29a19ab194cb21a092e314a97.zip
FreeBSD-src-8620fc8544ff62f29a19ab194cb21a092e314a97.tar.gz
Added my 'ddial' patches to user-PPP. The new mode tries it's darndest
to keep the link up, so it re-dials whenever it detects the link go down. This is useful for 'dedicated' links who use PPP. It's been used for over a year w/out problems at different sites.
Diffstat (limited to 'usr.sbin/ppp/main.c')
-rw-r--r--usr.sbin/ppp/main.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c
index 0c9a5cf..af63085 100644
--- a/usr.sbin/ppp/main.c
+++ b/usr.sbin/ppp/main.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: main.c,v 1.21 1996/10/07 04:21:00 jkh Exp $
+ * $Id: main.c,v 1.22 1996/10/12 16:20:32 jkh Exp $
*
* TODO:
* o Add commands for traffic summary, version display, etc.
@@ -213,7 +213,8 @@ int signo;
void
Usage()
{
- fprintf(stderr, "Usage: ppp [-auto | -direct | -dedicated] [system]\n");
+ fprintf(stderr,
+ "Usage: ppp [-auto | -direct | -dedicated | -ddial ] [system]\n");
exit(EX_START);
}
@@ -232,6 +233,8 @@ ProcessArgs(int argc, char **argv)
mode |= MODE_DIRECT;
else if (strcmp(cp, "dedicated") == 0)
mode |= MODE_DEDICATED;
+ else if (strcmp(cp, "ddial") == 0)
+ mode |= MODE_DDIAL|MODE_AUTO;
else
Usage();
optc++;
@@ -303,9 +306,10 @@ char **argv;
printf("Interactive mode\n");
netfd = 0;
} else if (mode & MODE_AUTO) {
- printf("Automatic mode\n");
+ printf("Automatic Dialer mode\n");
if (dstsystem == NULL) {
- fprintf(stderr, "Destination system must be specified in auto mode.\n");
+ fprintf(stderr,
+ "Destination system must be specified in auto or ddial mode.\n");
exit(EX_START);
}
}
@@ -344,7 +348,7 @@ char **argv;
Cleanup(EX_START);
}
if ((mode & MODE_AUTO) && DefHisAddress.ipaddr.s_addr == INADDR_ANY) {
- fprintf(stderr, "Must specify dstaddr with auto mode.\n");
+ fprintf(stderr, "Must specify dstaddr with auto or ddial mode.\n");
Cleanup(EX_START);
}
}
@@ -389,7 +393,7 @@ char **argv;
snprintf(pid_filename, sizeof (pid_filename), "%s/PPP.%s",
_PATH_VARRUN, dstsystem);
unlink(pid_filename);
- sprintf(pid, "%d\n", getpid());
+ sprintf(pid, "%d\n", (int)getpid());
if ((fd = open(pid_filename, O_RDWR|O_CREAT, 0666)) != -1)
{
@@ -664,6 +668,13 @@ DoLoop()
for (;;) {
FD_ZERO(&rfds); FD_ZERO(&wfds); FD_ZERO(&efds);
+ /*
+ * If the link is down and we're in DDIAL mode, bring it back
+ * up.
+ */
+ if (mode & MODE_DDIAL && LcpFsm.state <= ST_CLOSED)
+ dial_up = TRUE;
+
/*
* If Ip packet for output is enqueued and require dial up,
* Just do it!
OpenPOWER on IntegriCloud