Implement an ``enable/disable echo'' option, defaults to off.
This allows LCP ECHOs to be enabled independently of LQR reports. Note: This introduces a change in the default behaviour (search for lqr and echo in the man page). I'll update UPDATING to reflect this. PR: 74821
This commit is contained in:
parent
8a7a5b487d
commit
125eb366ea
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138799
@ -156,18 +156,19 @@
|
||||
#define NEG_CHAP80LM 43
|
||||
#define NEG_DEFLATE 44
|
||||
#define NEG_DNS 45
|
||||
#define NEG_ENDDISC 46
|
||||
#define NEG_LQR 47
|
||||
#define NEG_PAP 48
|
||||
#define NEG_PPPDDEFLATE 49
|
||||
#define NEG_PRED1 50
|
||||
#define NEG_PROTOCOMP 51
|
||||
#define NEG_SHORTSEQ 52
|
||||
#define NEG_VJCOMP 53
|
||||
#define NEG_MPPE 54
|
||||
#define NEG_CHAP81 55
|
||||
#define NEG_ECHO 46
|
||||
#define NEG_ENDDISC 47
|
||||
#define NEG_LQR 48
|
||||
#define NEG_PAP 49
|
||||
#define NEG_PPPDDEFLATE 50
|
||||
#define NEG_PRED1 51
|
||||
#define NEG_PROTOCOMP 52
|
||||
#define NEG_SHORTSEQ 53
|
||||
#define NEG_VJCOMP 54
|
||||
#define NEG_MPPE 55
|
||||
#define NEG_CHAP81 56
|
||||
|
||||
const char Version[] = "3.4.1";
|
||||
const char Version[] = "3.4.2";
|
||||
|
||||
static int ShowCommand(struct cmdargs const *);
|
||||
static int TerminalCommand(struct cmdargs const *);
|
||||
@ -2388,8 +2389,8 @@ static struct cmdtab const SetCommands[] = {
|
||||
"login script", "set login chat-script", (const void *) VAR_LOGIN},
|
||||
{"logout", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX,
|
||||
"logout script", "set logout chat-script", (const void *) VAR_LOGOUT},
|
||||
{"lqrperiod", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"LQR period", "set lqrperiod value", (const void *)VAR_LQRPERIOD},
|
||||
{"lqrperiod", "echoperiod", SetVariable, LOCAL_AUTH | LOCAL_CX_OPT,
|
||||
"LQR period", "set lqr/echo period value", (const void *)VAR_LQRPERIOD},
|
||||
{"mode", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, "mode value",
|
||||
"set mode interactive|auto|ddial|background", (const void *)VAR_MODE},
|
||||
{"mrru", NULL, SetVariable, LOCAL_AUTH, "MRRU value",
|
||||
@ -2861,6 +2862,25 @@ NegotiateSet(struct cmdargs const *arg)
|
||||
arg->bundle->ncp.ipcp.cfg.ns.dns_neg &= keep;
|
||||
arg->bundle->ncp.ipcp.cfg.ns.dns_neg |= add;
|
||||
break;
|
||||
case NEG_ECHO: /* probably misplaced in this function ! */
|
||||
if (cx->physical->link.lcp.cfg.echo && !add) {
|
||||
cx->physical->link.lcp.cfg.echo = 0;
|
||||
cx->physical->hdlc.lqm.method &= ~LQM_ECHO;
|
||||
if (cx->physical->hdlc.lqm.method & LQM_ECHO &&
|
||||
!cx->physical->link.lcp.want_lqrperiod &&
|
||||
cx->physical->hdlc.lqm.timer.load) {
|
||||
cx->physical->hdlc.lqm.timer.load = 0;
|
||||
lqr_StopTimer(cx->physical);
|
||||
}
|
||||
} else if (!cx->physical->link.lcp.cfg.echo && add) {
|
||||
cx->physical->link.lcp.cfg.echo = 1;
|
||||
cx->physical->hdlc.lqm.method |= LQM_ECHO;
|
||||
cx->physical->hdlc.lqm.timer.load =
|
||||
cx->physical->link.lcp.cfg.lqrperiod * SECTICKS;
|
||||
if (cx->physical->link.lcp.fsm.state == ST_OPENED)
|
||||
(*cx->physical->hdlc.lqm.timer.func)(&cx->physical->link.lcp);
|
||||
}
|
||||
break;
|
||||
case NEG_ENDDISC:
|
||||
arg->bundle->ncp.mp.cfg.negenddisc &= keep;
|
||||
arg->bundle->ncp.mp.cfg.negenddisc |= add;
|
||||
@ -2915,6 +2935,8 @@ NegotiateSet(struct cmdargs const *arg)
|
||||
}
|
||||
|
||||
static struct cmdtab const NegotiateCommands[] = {
|
||||
{"echo", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX, "Send echo requests",
|
||||
"disable|enable", (const void *)NEG_ECHO},
|
||||
{"filter-decapsulation", NULL, OptSet, LOCAL_AUTH,
|
||||
"filter on PPPoUDP payloads", "disable|enable",
|
||||
(const void *)OPT_FILTERDECAP},
|
||||
@ -2956,9 +2978,9 @@ static struct cmdtab const NegotiateCommands[] = {
|
||||
"disable|enable", (const void *)OPT_UTMP},
|
||||
|
||||
#ifndef NOINET6
|
||||
#define NEG_OPT_MAX 16 /* accept/deny allowed below and not above */
|
||||
#define NEG_OPT_MAX 17 /* accept/deny allowed below and not above */
|
||||
#else
|
||||
#define NEG_OPT_MAX 14
|
||||
#define NEG_OPT_MAX 15
|
||||
#endif
|
||||
|
||||
{"acfcomp", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX,
|
||||
|
@ -218,6 +218,8 @@ lcp_ReportStatus(struct cmdargs const *arg)
|
||||
#endif
|
||||
prompt_Printf(arg->prompt, " LQR = %s\n",
|
||||
command_ShowNegval(lcp->cfg.lqr));
|
||||
prompt_Printf(arg->prompt, " LCP ECHO = %s\n",
|
||||
lcp->cfg.echo ? "enabled" : "disabled");
|
||||
prompt_Printf(arg->prompt, " PAP = %s\n",
|
||||
command_ShowNegval(lcp->cfg.pap));
|
||||
prompt_Printf(arg->prompt, " PROTOCOMP = %s\n",
|
||||
@ -272,6 +274,7 @@ lcp_Init(struct lcp *lcp, struct bundle *bundle, struct link *l,
|
||||
lcp->cfg.chap81 = NEG_ACCEPTED;
|
||||
#endif
|
||||
lcp->cfg.lqr = NEG_ACCEPTED;
|
||||
lcp->cfg.echo = 0;
|
||||
lcp->cfg.pap = NEG_ACCEPTED;
|
||||
lcp->cfg.protocomp = NEG_ENABLED|NEG_ACCEPTED;
|
||||
*lcp->cfg.ident = '\0';
|
||||
|
@ -98,6 +98,7 @@ struct lcp {
|
||||
unsigned chap81 : 2; /* Microsoft CHAP v2 */
|
||||
#endif
|
||||
unsigned lqr : 2; /* Link Quality Report */
|
||||
unsigned echo : 1; /* Send echo Requests */
|
||||
unsigned pap : 2; /* Password Authentication protocol */
|
||||
unsigned protocomp : 2; /* Protocol field compression */
|
||||
char ident[DEF_MRU - 7]; /* SendIdentification() data */
|
||||
|
@ -184,9 +184,9 @@ SendLqrReport(void *v)
|
||||
p->hdlc.lqm.echo.seq_sent - 5 > p->hdlc.lqm.echo.seq_recv) ||
|
||||
(p->hdlc.lqm.echo.seq_sent <= 5 &&
|
||||
p->hdlc.lqm.echo.seq_sent > p->hdlc.lqm.echo.seq_recv + 5)) {
|
||||
log_Printf(LogPHASE, "%s: ** Too many ECHO LQR packets lost **\n",
|
||||
log_Printf(LogPHASE, "%s: ** Too many LCP ECHO packets lost **\n",
|
||||
lcp->fsm.link->name);
|
||||
log_Printf(LogLQM, "%s: Too many ECHO LQR packets lost\n",
|
||||
log_Printf(LogLQM, "%s: Too many LCP ECHO packets lost\n",
|
||||
lcp->fsm.link->name);
|
||||
p->hdlc.lqm.method = 0;
|
||||
datalink_Down(p->dl, CLOSE_NORMAL);
|
||||
@ -263,11 +263,11 @@ lqr_Input(struct bundle *bundle __unused, struct link *l, struct mbuf *bp)
|
||||
/*
|
||||
* When LCP is reached to opened state, We'll start LQM activity.
|
||||
*/
|
||||
|
||||
static void
|
||||
lqr_Setup(struct lcp *lcp)
|
||||
{
|
||||
struct physical *physical = link2physical(lcp->fsm.link);
|
||||
int period;
|
||||
|
||||
physical->hdlc.lqm.lqr.resent = 0;
|
||||
physical->hdlc.lqm.echo.seq_sent = 0;
|
||||
@ -275,7 +275,7 @@ lqr_Setup(struct lcp *lcp)
|
||||
memset(&physical->hdlc.lqm.lqr.peer, '\0',
|
||||
sizeof physical->hdlc.lqm.lqr.peer);
|
||||
|
||||
physical->hdlc.lqm.method = LQM_ECHO;
|
||||
physical->hdlc.lqm.method = lcp->cfg.echo ? LQM_ECHO : 0;
|
||||
if (IsEnabled(lcp->cfg.lqr) && !REJECTED(lcp, TY_QUALPROTO))
|
||||
physical->hdlc.lqm.method |= LQM_LQR;
|
||||
timer_Stop(&physical->hdlc.lqm.timer);
|
||||
@ -286,19 +286,21 @@ lqr_Setup(struct lcp *lcp)
|
||||
physical->link.name, lcp->his_lqrperiod / 100,
|
||||
lcp->his_lqrperiod % 100);
|
||||
|
||||
if (lcp->want_lqrperiod) {
|
||||
period = lcp->want_lqrperiod ?
|
||||
lcp->want_lqrperiod : lcp->cfg.lqrperiod * 100;
|
||||
physical->hdlc.lqm.timer.func = SendLqrReport;
|
||||
physical->hdlc.lqm.timer.name = "lqm";
|
||||
physical->hdlc.lqm.timer.arg = lcp;
|
||||
|
||||
if (lcp->want_lqrperiod || physical->hdlc.lqm.method & LQM_ECHO) {
|
||||
log_Printf(LogLQM, "%s: Will send %s every %d.%02d secs\n",
|
||||
physical->link.name,
|
||||
physical->hdlc.lqm.method & LQM_LQR ? "LQR" : "ECHO LQR",
|
||||
lcp->want_lqrperiod / 100, lcp->want_lqrperiod % 100);
|
||||
physical->hdlc.lqm.timer.load = lcp->want_lqrperiod * SECTICKS / 100;
|
||||
physical->hdlc.lqm.timer.func = SendLqrReport;
|
||||
physical->hdlc.lqm.timer.name = "lqm";
|
||||
physical->hdlc.lqm.timer.arg = lcp;
|
||||
physical->link.name, lcp->want_lqrperiod ? "LQR" : "LCP ECHO",
|
||||
period / 100, period % 100);
|
||||
physical->hdlc.lqm.timer.load = period * SECTICKS / 100;
|
||||
} else {
|
||||
physical->hdlc.lqm.timer.load = 0;
|
||||
if (!lcp->his_lqrperiod)
|
||||
log_Printf(LogLQM, "%s: LQR/ECHO LQR not negotiated\n",
|
||||
log_Printf(LogLQM, "%s: LQR/LCP ECHO not negotiated\n",
|
||||
physical->link.name);
|
||||
}
|
||||
}
|
||||
|
@ -2807,14 +2807,21 @@ below) as part of the LCP request.
|
||||
If the peer agrees, both sides will
|
||||
exchange LQR packets at the agreed frequency, allowing detailed link
|
||||
quality monitoring by enabling LQM logging.
|
||||
If the peer doesn't agree,
|
||||
If the peer doesn't agree, and if the
|
||||
.Dq echo
|
||||
option is enabled,
|
||||
.Nm
|
||||
will send ECHO LQR requests instead.
|
||||
will send
|
||||
.Em LCP ECHO
|
||||
requests instead.
|
||||
These packets pass no information of interest, but they
|
||||
.Em MUST
|
||||
be replied to by the peer.
|
||||
.Pp
|
||||
Whether using LQR or ECHO LQR,
|
||||
Whether using
|
||||
.Em LQR
|
||||
or
|
||||
.Em LCP ECHO ,
|
||||
.Nm
|
||||
will abruptly drop the connection if 5 unacknowledged packets have been
|
||||
sent rather than sending a 6th.
|
||||
@ -2824,6 +2831,12 @@ level, and any appropriate
|
||||
.Dq reconnect
|
||||
values are honoured as if the peer were responsible for dropping the
|
||||
connection.
|
||||
.Pp
|
||||
Refer to the
|
||||
.Dq enable echo
|
||||
command description for differences in behaviour prior to
|
||||
.Nm
|
||||
version 3.4.2.
|
||||
.It mppe
|
||||
Default: Enabled and Accepted.
|
||||
This is Microsoft Point to Point Encryption scheme.
|
||||
@ -2927,6 +2940,33 @@ This option determines if Van Jacobson header compression will be used.
|
||||
The following options are not actually negotiated with the peer.
|
||||
Therefore, accepting or denying them makes no sense.
|
||||
.Bl -tag -width 2n
|
||||
.It echo
|
||||
Default: Disabled.
|
||||
When this option is enabled,
|
||||
.Nm
|
||||
will send
|
||||
.Em LCP ECHO
|
||||
requests to the peer at the frequency defined by
|
||||
.Dq echoperiod .
|
||||
Note,
|
||||
.Em LQR
|
||||
requests will supersede
|
||||
.Em LCP ECHO
|
||||
requests if enabled and negotiated.
|
||||
See
|
||||
.Dq set lqrperiod
|
||||
below for details.
|
||||
.Pp
|
||||
Prior to
|
||||
.Nm
|
||||
version 3.4.2,
|
||||
.Dq echo
|
||||
was considered enabled if lqr was enabled and negotiated, otherwise it was
|
||||
considered disabled.
|
||||
For the same behaviour, it is now necessary to
|
||||
.Dq enable lqr echo
|
||||
rather than just
|
||||
.Dq enable lqr .
|
||||
.It filter-decapsulation
|
||||
Default: Disabled.
|
||||
When this option is enabled,
|
||||
@ -5110,18 +5150,24 @@ Escape sequences available in the dial script are also available here.
|
||||
This specifies the chat script that will be used to logout
|
||||
before the hangup script is called.
|
||||
It should not normally be necessary.
|
||||
.It set lqrperiod Ar frequency
|
||||
.It set lqrperiod|echoperiod Ar frequency
|
||||
This command sets the
|
||||
.Ar frequency
|
||||
in seconds at which
|
||||
.Em LQR
|
||||
or
|
||||
.Em ECHO LQR
|
||||
.Em LCP ECHO
|
||||
packets are sent.
|
||||
The default is 30 seconds.
|
||||
You must also use the
|
||||
.Dq enable lqr
|
||||
command if you wish to send LQR requests to the peer.
|
||||
and/or
|
||||
.Dq enable echo
|
||||
commands if you wish to send
|
||||
.Em LQR
|
||||
or
|
||||
.Em LCP ECHO
|
||||
requests to the peer.
|
||||
.It set mode Ar interactive|auto|ddial|background
|
||||
This command allows you to change the
|
||||
.Sq mode
|
||||
|
Loading…
Reference in New Issue
Block a user