Allow the use of a "stopped" timeout via the
"set stopped" directive. If the timeout occurs it will cause a "Down" event, hanging up the line if it's still up. This *isn't* part of the FSM diagram, but I consider it ok as a "higher level implementation specific timeout" as specified in the rfc ;-} Discussed briefly with: joerg
This commit is contained in:
parent
5b9b04192a
commit
71144dc552
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28327
@ -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.66 1997/07/12 19:22:34 brian Exp $
|
||||
* $Id: command.c,v 1.67 1997/07/14 01:41:26 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@ -383,6 +383,17 @@ static int ShowTimeout()
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ShowStopped()
|
||||
{
|
||||
if (!VarTerm)
|
||||
return 0;
|
||||
if (!VarStoppedTimeout)
|
||||
fprintf(VarTerm, " Stopped Timer: Disabled\n");
|
||||
else
|
||||
fprintf(VarTerm, " Stopped Timer: %d secs\n", VarStoppedTimeout);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int ShowAuthKey()
|
||||
{
|
||||
if (!VarTerm)
|
||||
@ -520,6 +531,8 @@ struct cmdtab const ShowCommands[] = {
|
||||
"Show routing table", "show route"},
|
||||
{ "timeout", NULL, ShowTimeout, LOCAL_AUTH,
|
||||
"Show Idle timeout value", "show timeout"},
|
||||
{ "stopped", NULL, ShowStopped, LOCAL_AUTH,
|
||||
"Show STOPPED timeout value", "show stopped"},
|
||||
#ifndef NOMSEXT
|
||||
{ "msext", NULL, ShowMSExt, LOCAL_AUTH,
|
||||
"Show MS PPP extentions", "show msext"},
|
||||
@ -840,6 +853,19 @@ char **argv;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
SetStoppedTimeout(list, argc, argv)
|
||||
struct cmdtab *list;
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
if (argc == 1) {
|
||||
VarStoppedTimeout = atoi(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
SetServer(list, argc, argv)
|
||||
struct cmdtab *list;
|
||||
@ -1290,6 +1316,8 @@ struct cmdtab const SetCommands[] = {
|
||||
"Set Reconnect timeout", "set reconnect value ntries"},
|
||||
{ "redial", NULL, SetRedialTimeout, LOCAL_AUTH,
|
||||
"Set Redial timeout", "set redial value|random[.value|random] [dial_attempts]"},
|
||||
{ "stopped", NULL, SetStoppedTimeout, LOCAL_AUTH,
|
||||
"Set STOPPED timeout", "set stopped value"},
|
||||
{ "server", "socket", SetServer, LOCAL_AUTH,
|
||||
"Set server port", "set server|socket TcpPort|LocalName|none [mask]"},
|
||||
{ "speed", NULL, SetModemSpeed, LOCAL_AUTH,
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: fsm.c,v 1.12 1997/06/02 00:04:40 brian Exp $
|
||||
* $Id: fsm.c,v 1.13 1997/06/09 03:27:21 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
* o Refer loglevel for log output
|
||||
@ -29,6 +29,9 @@
|
||||
#include "lcpproto.h"
|
||||
#include "lcp.h"
|
||||
#include "ccp.h"
|
||||
#include "modem.h"
|
||||
#include "loadalias.h"
|
||||
#include "vars.h"
|
||||
|
||||
void FsmSendConfigReq(struct fsm *fp);
|
||||
void FsmSendTerminateReq(struct fsm *fp);
|
||||
@ -40,6 +43,29 @@ char const *StateNames[] = {
|
||||
"Req-Sent", "Ack-Rcvd", "Ack-Sent", "Opened",
|
||||
};
|
||||
|
||||
/*
|
||||
* This timer times the ST_STOPPED state out after the given value
|
||||
* (specified via "set stopped ..."). Although this isn't
|
||||
* specified in the rfc, the rfc *does* say that "the application
|
||||
* may use higher level timers to avoid deadlock".
|
||||
* The StoppedTimer takes effect when the other side ABENDs rather
|
||||
* than going into ST_ACKSENT (and sending the ACK), causing ppp to
|
||||
* time out and drop into ST_STOPPED. At this point, nothing will
|
||||
* change this state :-(
|
||||
*/
|
||||
struct pppTimer StoppedTimer;
|
||||
|
||||
static void
|
||||
StoppedTimeout(fp)
|
||||
struct fsm *fp;
|
||||
{
|
||||
LogPrintf(LogLCP, "Stopped timer expired\n");
|
||||
if (modem != -1)
|
||||
DownConnection();
|
||||
else
|
||||
FsmDown(fp);
|
||||
}
|
||||
|
||||
void
|
||||
FsmInit(fp)
|
||||
struct fsm *fp;
|
||||
@ -58,9 +84,19 @@ int new;
|
||||
{
|
||||
LogPrintf(LogLCP, "State change %s --> %s\n",
|
||||
StateNames[fp->state], StateNames[new]);
|
||||
if (fp->state == ST_STOPPED && StoppedTimer.state == TIMER_RUNNING)
|
||||
StopTimer(&StoppedTimer);
|
||||
fp->state = new;
|
||||
if ((new >= ST_INITIAL && new <= ST_STOPPED) || (new == ST_OPENED))
|
||||
if ((new >= ST_INITIAL && new <= ST_STOPPED) || (new == ST_OPENED)) {
|
||||
StopTimer(&fp->FsmTimer);
|
||||
if (new == ST_STOPPED && VarStoppedTimeout) {
|
||||
StoppedTimer.state = TIMER_STOPPED;
|
||||
StoppedTimer.func = StoppedTimeout;
|
||||
StoppedTimer.arg = (void *)fp;
|
||||
StoppedTimer.load = VarStoppedTimeout * SECTICKS;
|
||||
StartTimer(&StoppedTimer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.46 1997/08/10 22:03:20 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.47 1997/08/17 20:38:44 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -506,7 +506,7 @@ is the number of times to try to connect for each outgoing packet
|
||||
that is received. The previous value is unchanged if this parameter
|
||||
is omitted. If a value of zero is specified for
|
||||
.Sq dial_attempts ,
|
||||
.Nm ppp
|
||||
.Nm
|
||||
will keep trying until a connection is made.
|
||||
.Bd -literal -offset indent
|
||||
set redial 10.3 4
|
||||
@ -1190,7 +1190,7 @@ add 0 0 HISADDR
|
||||
HISADDR is a macro meaning the "other side"s IP number, and is
|
||||
available once an IP number has been agreed (using LCP).
|
||||
Now, once a connection is established,
|
||||
.Nm ppp
|
||||
.Nm
|
||||
will delete all non-direct interface routes, and add a default route
|
||||
pointing at the peers IP number. You should use the same label as the
|
||||
one used in
|
||||
@ -1670,6 +1670,21 @@ is taken before starting at the first number again. A value of
|
||||
.Dq random
|
||||
may be used here too.
|
||||
|
||||
.It set stopped seconds
|
||||
If this option is set,
|
||||
.Nm
|
||||
will time out after being the the stopped state for the given number of
|
||||
.Dq seconds .
|
||||
This option may be useful if you see ppp failing to respond in the
|
||||
stopped state. Use
|
||||
.Dq set log +lcp
|
||||
to make
|
||||
.Nm
|
||||
log state transitions.
|
||||
.Pp
|
||||
The default value is zero, where ppp doesn't time out in the stopped
|
||||
state.
|
||||
|
||||
.It set server|socket TcpPort|LocalName|none [mask]
|
||||
Normally, when not in interactive mode,
|
||||
.Nm
|
||||
@ -1778,6 +1793,9 @@ Show the current reconnect values.
|
||||
.It show redial
|
||||
Show the current redial values.
|
||||
|
||||
.It show stopped
|
||||
Show the current stopped timeout.
|
||||
|
||||
.It show route
|
||||
Show the current routing tables.
|
||||
|
||||
@ -1874,7 +1892,7 @@ This command gives a summary of available alias commands.
|
||||
|
||||
.It quit|bye [all]
|
||||
Exit
|
||||
.Nm ppp.
|
||||
.Nm ppp .
|
||||
If
|
||||
.Nm
|
||||
is in interactive mode or if the
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.46 1997/08/10 22:03:20 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.47 1997/08/17 20:38:44 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@ -506,7 +506,7 @@ is the number of times to try to connect for each outgoing packet
|
||||
that is received. The previous value is unchanged if this parameter
|
||||
is omitted. If a value of zero is specified for
|
||||
.Sq dial_attempts ,
|
||||
.Nm ppp
|
||||
.Nm
|
||||
will keep trying until a connection is made.
|
||||
.Bd -literal -offset indent
|
||||
set redial 10.3 4
|
||||
@ -1190,7 +1190,7 @@ add 0 0 HISADDR
|
||||
HISADDR is a macro meaning the "other side"s IP number, and is
|
||||
available once an IP number has been agreed (using LCP).
|
||||
Now, once a connection is established,
|
||||
.Nm ppp
|
||||
.Nm
|
||||
will delete all non-direct interface routes, and add a default route
|
||||
pointing at the peers IP number. You should use the same label as the
|
||||
one used in
|
||||
@ -1670,6 +1670,21 @@ is taken before starting at the first number again. A value of
|
||||
.Dq random
|
||||
may be used here too.
|
||||
|
||||
.It set stopped seconds
|
||||
If this option is set,
|
||||
.Nm
|
||||
will time out after being the the stopped state for the given number of
|
||||
.Dq seconds .
|
||||
This option may be useful if you see ppp failing to respond in the
|
||||
stopped state. Use
|
||||
.Dq set log +lcp
|
||||
to make
|
||||
.Nm
|
||||
log state transitions.
|
||||
.Pp
|
||||
The default value is zero, where ppp doesn't time out in the stopped
|
||||
state.
|
||||
|
||||
.It set server|socket TcpPort|LocalName|none [mask]
|
||||
Normally, when not in interactive mode,
|
||||
.Nm
|
||||
@ -1778,6 +1793,9 @@ Show the current reconnect values.
|
||||
.It show redial
|
||||
Show the current redial values.
|
||||
|
||||
.It show stopped
|
||||
Show the current stopped timeout.
|
||||
|
||||
.It show route
|
||||
Show the current routing tables.
|
||||
|
||||
@ -1874,7 +1892,7 @@ This command gives a summary of available alias commands.
|
||||
|
||||
.It quit|bye [all]
|
||||
Exit
|
||||
.Nm ppp.
|
||||
.Nm ppp .
|
||||
If
|
||||
.Nm
|
||||
is in interactive mode or if the
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: vars.c,v 1.19 1997/06/09 03:27:41 brian Exp $
|
||||
* $Id: vars.c,v 1.20 1997/06/09 23:38:38 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include "fsm.h"
|
||||
@ -30,7 +30,7 @@
|
||||
#include "defs.h"
|
||||
|
||||
char VarVersion[] = "PPP Version 1.00";
|
||||
char VarLocalVersion[] = "$Date: 1997/06/09 03:27:41 $";
|
||||
char VarLocalVersion[] = "$Date: 1997/06/09 23:38:38 $";
|
||||
|
||||
/*
|
||||
* Order of conf option is important. See vars.h.
|
||||
@ -52,7 +52,7 @@ struct confdesc pppConfs[] = {
|
||||
struct pppvars pppVars = {
|
||||
DEF_MRU, DEF_MTU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3,
|
||||
RECONNECT_TIMER, RECONNECT_TRIES, REDIAL_PERIOD,
|
||||
NEXT_REDIAL_PERIOD, 1, MODEM_DEV, BASE_MODEM_DEV,
|
||||
NEXT_REDIAL_PERIOD, 1, 0, MODEM_DEV, BASE_MODEM_DEV,
|
||||
OPEN_ACTIVE, LOCAL_NO_AUTH,0
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: vars.h,v 1.20 1997/07/14 01:41:35 brian Exp $
|
||||
* $Id: vars.h,v 1.21 1997/08/17 20:38:45 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -68,6 +68,7 @@ struct pppvars {
|
||||
int redial_timeout; /* Redial timeout value */
|
||||
int redial_next_timeout; /* Redial next timeout value */
|
||||
int dial_tries; /* Dial attempts before giving up, 0 == inf */
|
||||
int stopped_timeout; /* Timeout in ST_STOPPED */
|
||||
char modem_dev[40]; /* Name of device / host:port */
|
||||
char *base_modem_dev; /* Pointer to base of modem_dev */
|
||||
int open_mode; /* LCP open mode */
|
||||
@ -118,6 +119,7 @@ struct pppvars {
|
||||
#define VarRedialTimeout pppVars.redial_timeout
|
||||
#define VarRedialNextTimeout pppVars.redial_next_timeout
|
||||
#define VarDialTries pppVars.dial_tries
|
||||
#define VarStoppedTimeout pppVars.stopped_timeout
|
||||
#define VarTerm pppVars.termfp
|
||||
|
||||
#define VarAliasHandlers pppVars.handler
|
||||
|
Loading…
Reference in New Issue
Block a user