Support ``set cd off'' to tell ppp not to even look for carrier on the
device.
This commit is contained in:
parent
a534126855
commit
ccd587f00f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51699
@ -1757,14 +1757,18 @@ SetVariable(struct cmdargs const *arg)
|
||||
|
||||
case VAR_CD:
|
||||
if (*argp) {
|
||||
long_val = atol(argp);
|
||||
if (long_val < 0)
|
||||
long_val = 0;
|
||||
cx->physical->cfg.cd.delay = long_val;
|
||||
cx->physical->cfg.cd.required = argp[strlen(argp)-1] == '!';
|
||||
if (strcasecmp(argp, "off")) {
|
||||
long_val = atol(argp);
|
||||
if (long_val < 0)
|
||||
long_val = 0;
|
||||
cx->physical->cfg.cd.delay = long_val;
|
||||
cx->physical->cfg.cd.necessity = argp[strlen(argp)-1] == '!' ?
|
||||
CD_REQUIRED : CD_VARIABLE;
|
||||
} else
|
||||
cx->physical->cfg.cd.necessity = CD_NOTREQUIRED;
|
||||
} else {
|
||||
cx->physical->cfg.cd.delay = DEF_CDDELAY;
|
||||
cx->physical->cfg.cd.required = 0;
|
||||
cx->physical->cfg.cd.necessity = CD_VARIABLE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -175,7 +175,7 @@ physical_Create(struct datalink *dl, int type)
|
||||
p->cfg.parity = CS8;
|
||||
memcpy(p->cfg.devlist, MODEM_LIST, sizeof MODEM_LIST);
|
||||
p->cfg.ndev = NMODEMS;
|
||||
p->cfg.cd.required = 0;
|
||||
p->cfg.cd.necessity = CD_VARIABLE;
|
||||
p->cfg.cd.delay = DEF_CDDELAY;
|
||||
|
||||
lcp_Init(&p->link.lcp, dl->bundle, &p->link, &dl->fsmp);
|
||||
@ -457,12 +457,16 @@ physical_ShowStatus(struct cmdargs const *arg)
|
||||
|
||||
prompt_Printf(arg->prompt, ", CTS/RTS %s\n", (p->cfg.rts_cts ? "on" : "off"));
|
||||
|
||||
prompt_Printf(arg->prompt, " CD check delay: %d second%s",
|
||||
p->cfg.cd.delay, p->cfg.cd.delay == 1 ? "" : "s");
|
||||
if (p->cfg.cd.required)
|
||||
prompt_Printf(arg->prompt, " (required!)\n\n");
|
||||
else
|
||||
prompt_Printf(arg->prompt, "\n\n");
|
||||
prompt_Printf(arg->prompt, " CD check delay: ");
|
||||
if (p->cfg.cd.necessity == CD_NOTREQUIRED)
|
||||
prompt_Printf(arg->prompt, "no cd");
|
||||
else {
|
||||
prompt_Printf(arg->prompt, "%d second%s", p->cfg.cd.delay,
|
||||
p->cfg.cd.delay == 1 ? "" : "s");
|
||||
if (p->cfg.cd.necessity == CD_REQUIRED)
|
||||
prompt_Printf(arg->prompt, " (required!)");
|
||||
}
|
||||
prompt_Printf(arg->prompt, "\n\n");
|
||||
|
||||
throughput_disp(&p->link.throughput, arg->prompt);
|
||||
|
||||
|
@ -40,6 +40,11 @@ struct cmdargs;
|
||||
#define CARRIER_OK 2
|
||||
#define CARRIER_LOST 3
|
||||
|
||||
/* A cd ``necessity'' value */
|
||||
#define CD_VARIABLE 1
|
||||
#define CD_REQUIRED 2
|
||||
#define CD_NOTREQUIRED 3
|
||||
|
||||
struct device {
|
||||
int type;
|
||||
const char *name;
|
||||
@ -91,7 +96,7 @@ struct physical {
|
||||
char devlist[LINE_LEN]; /* NUL separated list of devices */
|
||||
int ndev; /* number of devices in list */
|
||||
struct {
|
||||
unsigned required : 1; /* Is cd *REQUIRED* on this device */
|
||||
unsigned necessity : 2; /* A CD_ value */
|
||||
int delay; /* Wait this many seconds after login script */
|
||||
} cd;
|
||||
} cfg;
|
||||
|
@ -3561,7 +3561,7 @@ be agreeable with the peer), or if
|
||||
is specified,
|
||||
.Nm
|
||||
will expect the peer to specify the number.
|
||||
.It set cd Ar seconds Ns Op \&!
|
||||
.It "set cd off|" Ns Ar seconds Ns Op \&!
|
||||
Normally,
|
||||
.Nm
|
||||
checks for the existence of carrier one second after the login script is
|
||||
@ -3581,6 +3581,11 @@ specifies the number of seconds that
|
||||
should wait after the dial script has finished before deciding if
|
||||
carrier is available or not.
|
||||
.Pp
|
||||
If
|
||||
.Dq off
|
||||
is specified,
|
||||
.Nm
|
||||
will not check for carrier on the device, otherwise
|
||||
.Nm
|
||||
will not proceed to the login script until either carrier is detected
|
||||
or until
|
||||
@ -3600,15 +3605,18 @@ seconds, the link will be disconnected.
|
||||
.Pp
|
||||
For ISDN devices,
|
||||
.Nm
|
||||
will always insist on carrier. Carrier is raised by the i4brbchX device
|
||||
driver only after the call has connected. It is therefore wise to set
|
||||
a reasonable value such as
|
||||
will always insist on carrier (the value
|
||||
.Dq off
|
||||
is invalid). Carrier is raised by the i4brbchX device driver only after
|
||||
the call has connected. It is therefore wise to set a reasonable value
|
||||
such as
|
||||
.Ar 6
|
||||
seconds.
|
||||
.Pp
|
||||
Carrier
|
||||
.Em require Ns No ment
|
||||
is ignored for all other device types.
|
||||
is ignored for all other device types - as if set to
|
||||
.Dq off .
|
||||
.It set choked Op Ar timeout
|
||||
This sets the number of seconds that
|
||||
.Nm
|
||||
|
@ -3561,7 +3561,7 @@ be agreeable with the peer), or if
|
||||
is specified,
|
||||
.Nm
|
||||
will expect the peer to specify the number.
|
||||
.It set cd Ar seconds Ns Op \&!
|
||||
.It "set cd off|" Ns Ar seconds Ns Op \&!
|
||||
Normally,
|
||||
.Nm
|
||||
checks for the existence of carrier one second after the login script is
|
||||
@ -3581,6 +3581,11 @@ specifies the number of seconds that
|
||||
should wait after the dial script has finished before deciding if
|
||||
carrier is available or not.
|
||||
.Pp
|
||||
If
|
||||
.Dq off
|
||||
is specified,
|
||||
.Nm
|
||||
will not check for carrier on the device, otherwise
|
||||
.Nm
|
||||
will not proceed to the login script until either carrier is detected
|
||||
or until
|
||||
@ -3600,15 +3605,18 @@ seconds, the link will be disconnected.
|
||||
.Pp
|
||||
For ISDN devices,
|
||||
.Nm
|
||||
will always insist on carrier. Carrier is raised by the i4brbchX device
|
||||
driver only after the call has connected. It is therefore wise to set
|
||||
a reasonable value such as
|
||||
will always insist on carrier (the value
|
||||
.Dq off
|
||||
is invalid). Carrier is raised by the i4brbchX device driver only after
|
||||
the call has connected. It is therefore wise to set a reasonable value
|
||||
such as
|
||||
.Ar 6
|
||||
seconds.
|
||||
.Pp
|
||||
Carrier
|
||||
.Em require Ns No ment
|
||||
is ignored for all other device types.
|
||||
is ignored for all other device types - as if set to
|
||||
.Dq off .
|
||||
.It set choked Op Ar timeout
|
||||
This sets the number of seconds that
|
||||
.Nm
|
||||
|
@ -115,7 +115,7 @@ tty_Timeout(void *data)
|
||||
if (Online(dev))
|
||||
log_Printf(LogPHASE, "%s: %s: CD detected\n", p->link.name, p->name.full);
|
||||
else if (++dev->carrier_seconds >= p->cfg.cd.delay) {
|
||||
if (p->cfg.cd.required)
|
||||
if (p->cfg.cd.necessity == CD_REQUIRED)
|
||||
log_Printf(LogPHASE, "%s: %s: Required CD not detected\n",
|
||||
p->link.name, p->name.full);
|
||||
else {
|
||||
@ -169,7 +169,7 @@ tty_AwaitCarrier(struct physical *p)
|
||||
{
|
||||
struct ttydevice *dev = device2tty(p->handler);
|
||||
|
||||
if (physical_IsSync(p))
|
||||
if (p->cfg.cd.necessity == CD_NOTREQUIRED || physical_IsSync(p))
|
||||
return CARRIER_OK;
|
||||
|
||||
if (dev->mbits == -1) {
|
||||
@ -180,7 +180,8 @@ tty_AwaitCarrier(struct physical *p)
|
||||
return CARRIER_PENDING; /* Not yet ! */
|
||||
}
|
||||
|
||||
return Online(dev) || !p->cfg.cd.required ? CARRIER_OK : CARRIER_LOST;
|
||||
return Online(dev) || !p->cfg.cd.necessity == CD_REQUIRED ?
|
||||
CARRIER_OK : CARRIER_LOST;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user