Allow an optional ``!'' in the open, dial & call commands.
When used, the redial timer is ignored and the modem is opened immediately.
This commit is contained in:
+10
-5
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.c,v 1.27 1998/06/27 14:18:00 brian Exp $
|
||||
* $Id: bundle.c,v 1.28 1998/07/28 21:54:50 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -214,7 +214,7 @@ bundle_AutoLoadTimeout(void *v)
|
||||
if (bundle->autoload.comingup) {
|
||||
log_Printf(LogPHASE, "autoload: Another link is required\n");
|
||||
/* bundle_Open() stops the timer */
|
||||
bundle_Open(bundle, NULL, PHYS_AUTO);
|
||||
bundle_Open(bundle, NULL, PHYS_AUTO, 0);
|
||||
} else {
|
||||
struct datalink *dl, *last;
|
||||
|
||||
@@ -654,7 +654,7 @@ bundle_DescriptorRead(struct descriptor *d, struct bundle *bundle,
|
||||
* *not* be UP and we can't receive data
|
||||
*/
|
||||
if ((pri = PacketCheck(bundle, tun.data, n, &bundle->filter.dial)) >= 0)
|
||||
bundle_Open(bundle, NULL, PHYS_AUTO);
|
||||
bundle_Open(bundle, NULL, PHYS_AUTO, 0);
|
||||
else
|
||||
/*
|
||||
* Drop the packet. If we were to queue it, we'd just end up with
|
||||
@@ -1100,7 +1100,7 @@ bundle_LinkClosed(struct bundle *bundle, struct datalink *dl)
|
||||
}
|
||||
|
||||
void
|
||||
bundle_Open(struct bundle *bundle, const char *name, int mask)
|
||||
bundle_Open(struct bundle *bundle, const char *name, int mask, int force)
|
||||
{
|
||||
/*
|
||||
* Please open the given datalink, or all if name == NULL
|
||||
@@ -1110,7 +1110,12 @@ bundle_Open(struct bundle *bundle, const char *name, int mask)
|
||||
timer_Stop(&bundle->autoload.timer);
|
||||
for (dl = bundle->links; dl; dl = dl->next)
|
||||
if (name == NULL || !strcasecmp(dl->name, name)) {
|
||||
if (dl->state == DATALINK_CLOSED && (mask & dl->physical->type)) {
|
||||
if ((mask & dl->physical->type) &&
|
||||
(dl->state == DATALINK_CLOSED ||
|
||||
(force && dl->state == DATALINK_OPENING &&
|
||||
dl->dial_timer.state == TIMER_RUNNING))) {
|
||||
if (force)
|
||||
timer_Stop(&dl->dial_timer);
|
||||
datalink_Up(dl, 1, 1);
|
||||
if (mask == PHYS_AUTO)
|
||||
/* Only one AUTO link at a time (see the AutoLoad timer) */
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.h,v 1.9 1998/06/27 14:17:24 brian Exp $
|
||||
* $Id: bundle.h,v 1.10 1998/07/28 21:54:51 brian Exp $
|
||||
*/
|
||||
|
||||
#define PHASE_DEAD 0 /* Link is dead */
|
||||
@@ -142,7 +142,7 @@ extern int bundle_SetRoute(struct bundle *, int, struct in_addr,
|
||||
struct in_addr, struct in_addr, int, int);
|
||||
extern void bundle_Close(struct bundle *, const char *, int);
|
||||
extern void bundle_Down(struct bundle *, int);
|
||||
extern void bundle_Open(struct bundle *, const char *, int);
|
||||
extern void bundle_Open(struct bundle *, const char *, int, int);
|
||||
extern void bundle_LinkClosed(struct bundle *, struct datalink *);
|
||||
|
||||
extern int bundle_FillQueues(struct bundle *);
|
||||
|
||||
+17
-8
@@ -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.155 1998/07/12 00:30:18 brian Exp $
|
||||
* $Id: command.c,v 1.156 1998/07/28 21:54:52 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
@@ -122,7 +122,7 @@
|
||||
#define NEG_DNS 50
|
||||
|
||||
const char Version[] = "2.0";
|
||||
const char VersionDate[] = "$Date: 1998/07/12 00:30:18 $";
|
||||
const char VersionDate[] = "$Date: 1998/07/28 21:54:52 $";
|
||||
|
||||
static int ShowCommand(struct cmdargs const *);
|
||||
static int TerminalCommand(struct cmdargs const *);
|
||||
@@ -306,7 +306,8 @@ DialCommand(struct cmdargs const *arg)
|
||||
if (arg->argc > arg->argn && (res = LoadCommand(arg)) != 0)
|
||||
return res;
|
||||
|
||||
bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL);
|
||||
bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL,
|
||||
arg->cmd->args ? 1 : 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -456,7 +457,11 @@ static struct cmdtab const Commands[] = {
|
||||
{"deny", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Deny option request", "deny option .."},
|
||||
{"dial", "call", DialCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Dial and login", "dial|call [remote]"},
|
||||
"Dial and login", "dial|call [remote]", NULL},
|
||||
{NULL, "dial!", DialCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Dial and login", "dial! [remote]", (void *)1},
|
||||
{NULL, "call!", DialCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Dial and login", "call! [remote]", (void *)1},
|
||||
{"disable", NULL, NegotiateCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Disable option", "disable option .."},
|
||||
{"down", NULL, DownCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
@@ -468,7 +473,9 @@ static struct cmdtab const Commands[] = {
|
||||
{"load", NULL, LoadCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Load settings", "load [remote]"},
|
||||
{"open", NULL, OpenCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Open an FSM", "open [lcp|ccp|ipcp]"},
|
||||
"Open an FSM", "open [lcp|ccp|ipcp]", NULL},
|
||||
{NULL, "open!", OpenCommand, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"Open an FSM", "open! [lcp|ccp|ipcp]", (void *)1},
|
||||
{"passwd", NULL, PasswdCommand, LOCAL_NO_AUTH,
|
||||
"Password for manipulation", "passwd LocalPassword"},
|
||||
{"quit", "bye", QuitCommand, LOCAL_AUTH | LOCAL_NO_AUTH,
|
||||
@@ -834,7 +841,8 @@ static int
|
||||
OpenCommand(struct cmdargs const *arg)
|
||||
{
|
||||
if (arg->argc == arg->argn)
|
||||
bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL);
|
||||
bundle_Open(arg->bundle, arg->cx ? arg->cx->name : NULL, PHYS_ALL,
|
||||
arg->cmd->args ? 1 : 0);
|
||||
else if (arg->argc == arg->argn + 1) {
|
||||
if (!strcasecmp(arg->argv[arg->argn], "lcp")) {
|
||||
struct datalink *cx = arg->cx ?
|
||||
@@ -843,7 +851,8 @@ OpenCommand(struct cmdargs const *arg)
|
||||
if (cx->physical->link.lcp.fsm.state == ST_OPENED)
|
||||
fsm_Reopen(&cx->physical->link.lcp.fsm);
|
||||
else
|
||||
bundle_Open(arg->bundle, cx->name, PHYS_ALL);
|
||||
bundle_Open(arg->bundle, cx->name, PHYS_ALL,
|
||||
arg->cmd->args ? 1 : 0);
|
||||
} else
|
||||
log_Printf(LogWARN, "open lcp: You must specify a link\n");
|
||||
} else if (!strcasecmp(arg->argv[arg->argn], "ccp")) {
|
||||
@@ -870,7 +879,7 @@ OpenCommand(struct cmdargs const *arg)
|
||||
if (arg->bundle->ncp.ipcp.fsm.state == ST_OPENED)
|
||||
fsm_Reopen(&arg->bundle->ncp.ipcp.fsm);
|
||||
else
|
||||
bundle_Open(arg->bundle, NULL, PHYS_ALL);
|
||||
bundle_Open(arg->bundle, NULL, PHYS_ALL, arg->cmd->args ? 1 : 0);
|
||||
} else
|
||||
return -1;
|
||||
} else
|
||||
|
||||
+40
-22
@@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.110 1998/06/25 22:33:31 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.111 1998/06/27 23:48:52 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@@ -2374,17 +2374,14 @@ command is used
|
||||
.Pq note the trailing Dq \&! ,
|
||||
.Nm
|
||||
will not complain if the route does not already exist.
|
||||
.It dial|call Op Ar label
|
||||
If
|
||||
.It dial[!]|call[!] Op Ar label
|
||||
When used with no argument, this command is the same as the
|
||||
.Dq open
|
||||
command. When
|
||||
.Ar label
|
||||
is specified, a connection is established using the
|
||||
.Dq dial
|
||||
and
|
||||
.Dq login
|
||||
scripts for the given
|
||||
.Ar label .
|
||||
Otherwise, the current settings are used to establish
|
||||
the connection, and all closed links are brought up.
|
||||
is specified, a
|
||||
.Dq load
|
||||
will be done first.
|
||||
.It down Op Ar lcp|ccp
|
||||
Bring the relevant layer down ungracefully, as if the underlying layer
|
||||
had become unavailable. It's not considered polite to use this command on
|
||||
@@ -2431,20 +2428,22 @@ file. If
|
||||
is not given, the
|
||||
.Ar default
|
||||
label is used.
|
||||
.It open Op lcp|ccp|ipcp
|
||||
.It open[!] Op lcp|ccp|ipcp
|
||||
This is the opposite of the
|
||||
.Dq close
|
||||
command. Using
|
||||
.Dq open
|
||||
with no arguments is the same as using
|
||||
.Dq dial
|
||||
with no arguments, where all closed links are brought up.
|
||||
with no arguments, where all closed links are brought up (some auto
|
||||
links may not come up based on the
|
||||
.Dq set autoload
|
||||
command) using the current configuration.
|
||||
.Pp
|
||||
If the
|
||||
.Dq lcp
|
||||
option is used, the link will also be brought up. If however the LCP
|
||||
layer is already open, it will be renegotiated. This allows various
|
||||
LCP options to be changed, after which
|
||||
while the LCP layer is already open, LCP will be renegotiated. This
|
||||
allows various LCP options to be changed, after which
|
||||
.Dq open lcp
|
||||
can be used to put them into effect. After renegotiating LCP,
|
||||
any agreed authentication will also take place.
|
||||
@@ -2456,10 +2455,14 @@ if it is already open, it will be renegotiated.
|
||||
.Pp
|
||||
If the
|
||||
.Dq ipcp
|
||||
argument is used, the link will be brought up as with the
|
||||
.Dq lcp
|
||||
argument. If IPCP is already open, it will be renegotiated
|
||||
and the network interface will be reconfigured.
|
||||
argument is used, the link will be brought up as normal, but if
|
||||
IPCP is already open, it will be renegotiated and the network
|
||||
interface will be reconfigured.
|
||||
.Pp
|
||||
If
|
||||
.Dq open!
|
||||
is used, any currently running redial timers are ignored and the open
|
||||
happens immediately.
|
||||
.Pp
|
||||
It is probably not good practice to re-open the PPP state machines
|
||||
like this as it's possible that the peer will not behave correctly.
|
||||
@@ -3056,7 +3059,7 @@ will result in a variable pause, somewhere between 0 and 30 seconds.
|
||||
.Nm Ppp
|
||||
can be instructed to attempt to redial
|
||||
.Ar attempts
|
||||
times. If more than one number is specified (see
|
||||
times. If more than one phone number is specified (see
|
||||
.Dq set phone
|
||||
above), a pause of
|
||||
.Ar nseconds
|
||||
@@ -3064,7 +3067,22 @@ is taken before dialing each number. A pause of
|
||||
.Ar seconds
|
||||
is taken before starting at the first number again. A value of
|
||||
.Ar random
|
||||
may be used here too.
|
||||
may be used here in place of
|
||||
.Ar seconds
|
||||
and
|
||||
.Ar nseconds ,
|
||||
causing a random delay of between 0 and 30 seconds.
|
||||
.Pp
|
||||
Note, this delay will be effective, even after
|
||||
.Ar attempts
|
||||
has been exceeded, so an immediate manual dial may appear to have
|
||||
done nothing. If an immediate dial is required, a
|
||||
.Dq \&!
|
||||
should immediately follow the
|
||||
.Dq open
|
||||
keyword. See the
|
||||
.Dq open
|
||||
description above for further details.
|
||||
.It set server|socket Ar TcpPort|LocalName|none password Op Ar mask
|
||||
This command tells
|
||||
.Nm
|
||||
|
||||
+40
-22
@@ -1,4 +1,4 @@
|
||||
.\" $Id: ppp.8,v 1.110 1998/06/25 22:33:31 brian Exp $
|
||||
.\" $Id: ppp.8,v 1.111 1998/06/27 23:48:52 brian Exp $
|
||||
.Dd 20 September 1995
|
||||
.Os FreeBSD
|
||||
.Dt PPP 8
|
||||
@@ -2374,17 +2374,14 @@ command is used
|
||||
.Pq note the trailing Dq \&! ,
|
||||
.Nm
|
||||
will not complain if the route does not already exist.
|
||||
.It dial|call Op Ar label
|
||||
If
|
||||
.It dial[!]|call[!] Op Ar label
|
||||
When used with no argument, this command is the same as the
|
||||
.Dq open
|
||||
command. When
|
||||
.Ar label
|
||||
is specified, a connection is established using the
|
||||
.Dq dial
|
||||
and
|
||||
.Dq login
|
||||
scripts for the given
|
||||
.Ar label .
|
||||
Otherwise, the current settings are used to establish
|
||||
the connection, and all closed links are brought up.
|
||||
is specified, a
|
||||
.Dq load
|
||||
will be done first.
|
||||
.It down Op Ar lcp|ccp
|
||||
Bring the relevant layer down ungracefully, as if the underlying layer
|
||||
had become unavailable. It's not considered polite to use this command on
|
||||
@@ -2431,20 +2428,22 @@ file. If
|
||||
is not given, the
|
||||
.Ar default
|
||||
label is used.
|
||||
.It open Op lcp|ccp|ipcp
|
||||
.It open[!] Op lcp|ccp|ipcp
|
||||
This is the opposite of the
|
||||
.Dq close
|
||||
command. Using
|
||||
.Dq open
|
||||
with no arguments is the same as using
|
||||
.Dq dial
|
||||
with no arguments, where all closed links are brought up.
|
||||
with no arguments, where all closed links are brought up (some auto
|
||||
links may not come up based on the
|
||||
.Dq set autoload
|
||||
command) using the current configuration.
|
||||
.Pp
|
||||
If the
|
||||
.Dq lcp
|
||||
option is used, the link will also be brought up. If however the LCP
|
||||
layer is already open, it will be renegotiated. This allows various
|
||||
LCP options to be changed, after which
|
||||
while the LCP layer is already open, LCP will be renegotiated. This
|
||||
allows various LCP options to be changed, after which
|
||||
.Dq open lcp
|
||||
can be used to put them into effect. After renegotiating LCP,
|
||||
any agreed authentication will also take place.
|
||||
@@ -2456,10 +2455,14 @@ if it is already open, it will be renegotiated.
|
||||
.Pp
|
||||
If the
|
||||
.Dq ipcp
|
||||
argument is used, the link will be brought up as with the
|
||||
.Dq lcp
|
||||
argument. If IPCP is already open, it will be renegotiated
|
||||
and the network interface will be reconfigured.
|
||||
argument is used, the link will be brought up as normal, but if
|
||||
IPCP is already open, it will be renegotiated and the network
|
||||
interface will be reconfigured.
|
||||
.Pp
|
||||
If
|
||||
.Dq open!
|
||||
is used, any currently running redial timers are ignored and the open
|
||||
happens immediately.
|
||||
.Pp
|
||||
It is probably not good practice to re-open the PPP state machines
|
||||
like this as it's possible that the peer will not behave correctly.
|
||||
@@ -3056,7 +3059,7 @@ will result in a variable pause, somewhere between 0 and 30 seconds.
|
||||
.Nm Ppp
|
||||
can be instructed to attempt to redial
|
||||
.Ar attempts
|
||||
times. If more than one number is specified (see
|
||||
times. If more than one phone number is specified (see
|
||||
.Dq set phone
|
||||
above), a pause of
|
||||
.Ar nseconds
|
||||
@@ -3064,7 +3067,22 @@ is taken before dialing each number. A pause of
|
||||
.Ar seconds
|
||||
is taken before starting at the first number again. A value of
|
||||
.Ar random
|
||||
may be used here too.
|
||||
may be used here in place of
|
||||
.Ar seconds
|
||||
and
|
||||
.Ar nseconds ,
|
||||
causing a random delay of between 0 and 30 seconds.
|
||||
.Pp
|
||||
Note, this delay will be effective, even after
|
||||
.Ar attempts
|
||||
has been exceeded, so an immediate manual dial may appear to have
|
||||
done nothing. If an immediate dial is required, a
|
||||
.Dq \&!
|
||||
should immediately follow the
|
||||
.Dq open
|
||||
keyword. See the
|
||||
.Dq open
|
||||
description above for further details.
|
||||
.It set server|socket Ar TcpPort|LocalName|none password Op Ar mask
|
||||
This command tells
|
||||
.Nm
|
||||
|
||||
Reference in New Issue
Block a user