mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
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.
This commit is contained in:
parent
2be5d4cba8
commit
680026d67a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20120
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: command.c,v 1.23 1996/10/12 16:20:28 jkh Exp $
|
||||
* $Id: command.c,v 1.24 1996/10/13 15:05:14 sos Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@ -102,7 +102,9 @@ IsInteractive()
|
||||
{
|
||||
char *mes = NULL;
|
||||
|
||||
if (mode & MODE_AUTO)
|
||||
if (mode & MODE_DDIAL)
|
||||
mes = "Working in dedicated dial mode.";
|
||||
else if (mode & MODE_AUTO)
|
||||
mes = "Working in auto mode.";
|
||||
else if (mode & MODE_DIRECT)
|
||||
mes = "Working in direct mode.";
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: defs.h,v 1.3 1995/09/02 17:20:51 amurai Exp $
|
||||
* $Id: defs.h,v 1.4 1995/10/08 14:57:28 amurai Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -59,6 +59,7 @@
|
||||
#define MODE_AUTO 2 /* Auto calling mode */
|
||||
#define MODE_DIRECT 4 /* Direct connection mode */
|
||||
#define MODE_DEDICATED 8 /* Dedicated line mode */
|
||||
#define MODE_DDIAL 16 /* Dedicated dialing line mode */
|
||||
|
||||
#define EX_NORMAL 0
|
||||
#define EX_START 1
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: ip.c,v 1.8 1996/01/30 11:08:33 dfr Exp $
|
||||
* $Id: ip.c,v 1.9 1996/05/11 20:48:25 phk Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Return ICMP message for filterd packet
|
||||
@ -53,7 +53,7 @@ static void IdleTimeout()
|
||||
void
|
||||
StartIdleTimer()
|
||||
{
|
||||
if (!(mode & MODE_DEDICATED)) {
|
||||
if (!(mode & (MODE_DEDICATED|MODE_DDIAL))) {
|
||||
StopTimer(&IdleTimer);
|
||||
IdleTimer.func = IdleTimeout;
|
||||
IdleTimer.load = VarIdleTimeout * SECTICKS;
|
||||
@ -74,7 +74,7 @@ StopIdleTimer()
|
||||
static void
|
||||
RestartIdleTimer()
|
||||
{
|
||||
if (!(mode & MODE_DEDICATED) && ipKeepAlive ) {
|
||||
if (!(mode & (MODE_DEDICATED|MODE_DDIAL)) && ipKeepAlive ) {
|
||||
StartTimer(&IdleTimer);
|
||||
ipIdleSecs = 0;
|
||||
}
|
||||
|
@ -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!
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" manual page [] for ppp 0.94 beta2 + alpha
|
||||
.\" $Id: ppp.8,v 1.18 1996/10/06 13:32:33 jkh Exp $
|
||||
.\" $Id: ppp.8,v 1.19 1996/10/31 19:55:05 joerg Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -9,7 +9,7 @@
|
||||
Point to Point Protocol (aka iijppp)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl auto | Fl direct | Fl dedicated
|
||||
.Op Fl auto | ddial | dedicated | direct
|
||||
.Op Ar system
|
||||
.Sh DESCRIPTION
|
||||
This is a user process
|
||||
@ -53,6 +53,13 @@ will act as a daemon and wait for a packet to be sent over the
|
||||
link. When this happens, the daemon automatically dials and establishes the
|
||||
connection.
|
||||
|
||||
In almost the same manner ddial mode (dedicated dialing or demon dialing)
|
||||
also automatically dials and establishes the connection. However, it
|
||||
differs in that it will dial the remote site any time it detects the
|
||||
link is down, even if there are no packets to be sent. This mode is
|
||||
useful for full-time connections who worry less about line charges
|
||||
and more about being connected full time.
|
||||
|
||||
.It Supports server-side PPP connections.
|
||||
Can act as server which accepts incoming
|
||||
.Em PPP
|
||||
@ -280,6 +287,8 @@ remote peer.
|
||||
|
||||
To play with demand dialing, you must use the
|
||||
.Fl auto
|
||||
or
|
||||
.Fl ddial
|
||||
option. You must also specify the destination label in
|
||||
.Pa /etc/ppp/ppp.conf
|
||||
to use. It should contain the
|
||||
@ -293,6 +302,8 @@ command to define the remote peer's IP address. (refer to
|
||||
|
||||
When
|
||||
.Fl auto
|
||||
or
|
||||
.Fl ddial
|
||||
is specified,
|
||||
.Nm
|
||||
runs as a daemon but you can still configure or examine its
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" manual page [] for ppp 0.94 beta2 + alpha
|
||||
.\" $Id: ppp.8,v 1.18 1996/10/06 13:32:33 jkh Exp $
|
||||
.\" $Id: ppp.8,v 1.19 1996/10/31 19:55:05 joerg Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -9,7 +9,7 @@
|
||||
Point to Point Protocol (aka iijppp)
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl auto | Fl direct | Fl dedicated
|
||||
.Op Fl auto | ddial | dedicated | direct
|
||||
.Op Ar system
|
||||
.Sh DESCRIPTION
|
||||
This is a user process
|
||||
@ -53,6 +53,13 @@ will act as a daemon and wait for a packet to be sent over the
|
||||
link. When this happens, the daemon automatically dials and establishes the
|
||||
connection.
|
||||
|
||||
In almost the same manner ddial mode (dedicated dialing or demon dialing)
|
||||
also automatically dials and establishes the connection. However, it
|
||||
differs in that it will dial the remote site any time it detects the
|
||||
link is down, even if there are no packets to be sent. This mode is
|
||||
useful for full-time connections who worry less about line charges
|
||||
and more about being connected full time.
|
||||
|
||||
.It Supports server-side PPP connections.
|
||||
Can act as server which accepts incoming
|
||||
.Em PPP
|
||||
@ -280,6 +287,8 @@ remote peer.
|
||||
|
||||
To play with demand dialing, you must use the
|
||||
.Fl auto
|
||||
or
|
||||
.Fl ddial
|
||||
option. You must also specify the destination label in
|
||||
.Pa /etc/ppp/ppp.conf
|
||||
to use. It should contain the
|
||||
@ -293,6 +302,8 @@ command to define the remote peer's IP address. (refer to
|
||||
|
||||
When
|
||||
.Fl auto
|
||||
or
|
||||
.Fl ddial
|
||||
is specified,
|
||||
.Nm
|
||||
runs as a daemon but you can still configure or examine its
|
||||
|
Loading…
Reference in New Issue
Block a user