summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/ppp/command.c56
-rw-r--r--usr.sbin/ppp/ppp/lcp.c5
-rw-r--r--usr.sbin/ppp/ppp/lcp.h3
-rw-r--r--usr.sbin/ppp/ppp/lqr.c30
-rw-r--r--usr.sbin/ppp/ppp/ppp.8.m460
5 files changed, 114 insertions, 40 deletions
diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c
index d98b350927a..7f11da8a6a6 100644
--- a/usr.sbin/ppp/ppp/command.c
+++ b/usr.sbin/ppp/ppp/command.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: command.c,v 1.84 2005/07/12 03:08:12 brad Exp $
+ * $OpenBSD: command.c,v 1.85 2005/07/17 07:33:22 brad Exp $
*/
#include <sys/param.h>
@@ -153,18 +153,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
-
-const char Version[] = "3.1";
+#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.2";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@@ -2324,8 +2325,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",
@@ -2782,6 +2783,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;
@@ -2836,6 +2856,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},
@@ -2870,9 +2892,9 @@ static struct cmdtab const NegotiateCommands[] = {
"disable|enable", (const void *)OPT_UTMP},
#ifndef NOINET6
-#define OPT_MAX 13 /* accept/deny allowed below and not above */
+#define OPT_MAX 14 /* accept/deny allowed below and not above */
#else
-#define OPT_MAX 11
+#define OPT_MAX 12
#endif
{"acfcomp", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX,
diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c
index 7aed02ce4f7..5fe76a38d6c 100644
--- a/usr.sbin/ppp/ppp/lcp.c
+++ b/usr.sbin/ppp/ppp/lcp.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: lcp.c,v 1.39 2004/06/26 20:12:48 claudio Exp $
+ * $OpenBSD: lcp.c,v 1.40 2005/07/17 07:33:22 brad Exp $
*/
#include <sys/param.h>
@@ -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';
diff --git a/usr.sbin/ppp/ppp/lcp.h b/usr.sbin/ppp/ppp/lcp.h
index 19c8037ac42..3c1317687ac 100644
--- a/usr.sbin/ppp/ppp/lcp.h
+++ b/usr.sbin/ppp/ppp/lcp.h
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: lcp.h,v 1.13 2002/05/16 01:13:39 brian Exp $
+ * $OpenBSD: lcp.h,v 1.14 2005/07/17 07:33:22 brad Exp $
*/
/* callback::opmask values */
@@ -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 */
diff --git a/usr.sbin/ppp/ppp/lqr.c b/usr.sbin/ppp/ppp/lqr.c
index 07ee20eb87e..24f653aef53 100644
--- a/usr.sbin/ppp/ppp/lqr.c
+++ b/usr.sbin/ppp/ppp/lqr.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: lqr.c,v 1.15 2004/11/16 14:47:02 brad Exp $
+ * $OpenBSD: lqr.c,v 1.16 2005/07/17 07:33:22 brad Exp $
*/
#include <sys/param.h>
@@ -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, 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);
}
}
diff --git a/usr.sbin/ppp/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp/ppp.8.m4
index dcb34195570..73b043c6172 100644
--- a/usr.sbin/ppp/ppp/ppp.8.m4
+++ b/usr.sbin/ppp/ppp/ppp.8.m4
@@ -25,7 +25,7 @@ changecom(,)dnl
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $OpenBSD: ppp.8.m4,v 1.23 2005/03/29 20:23:48 jmc Exp $
+.\" $OpenBSD: ppp.8.m4,v 1.24 2005/07/17 07:33:22 brad Exp $
.\"
.Dd September 20, 1995
.Dt PPP 8
@@ -2791,14 +2791,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.
@@ -2808,6 +2815,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.
@@ -2909,6 +2922,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,
@@ -5009,18 +5049,24 @@ Escape sequences available in the dial script are also available here.
This specifies the chat script that will be used to log out
before the hangup script is called.
It should not normally be necessary.
-.It Ic set lqrperiod Ar frequency
+.It Ic 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
.Ic 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 Xo
.Ic set mode
.Ar interactive | auto | ddial | background