From 0b3acc6e4823dbdcc483494823f31de288dcb2a5 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Fri, 3 Apr 1998 19:24:23 +0000 Subject: [PATCH] Remove `set loopback' and `show loopback' and add `enable loopback' and `disable loopback'. Re-write the explaination of `enable idcheck'. --- usr.sbin/ppp/command.c | 28 +----------------------- usr.sbin/ppp/main.c | 4 ++-- usr.sbin/ppp/ppp.8 | 49 ++++++++++++++++++++++-------------------- usr.sbin/ppp/vars.c | 7 +++--- usr.sbin/ppp/vars.h | 7 +++--- 5 files changed, 36 insertions(+), 59 deletions(-) diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index fbd64e554da..3fff0e61741 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -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.131.2.44 1998/04/03 19:21:13 brian Exp $ + * $Id: command.c,v 1.131.2.45 1998/04/03 19:23:54 brian Exp $ * */ #include @@ -185,21 +185,6 @@ DialCommand(struct cmdargs const *arg) return 0; } -static int -SetLoopback(struct cmdargs const *arg) -{ - if (arg->argc == 1) - if (!strcasecmp(*arg->argv, "on")) { - VarLoopback = 1; - return 0; - } - else if (!strcasecmp(*arg->argv, "off")) { - VarLoopback = 0; - return 0; - } - return -1; -} - static int ShellCommand(struct cmdargs const *arg, int bg) { @@ -386,13 +371,6 @@ static struct cmdtab const Commands[] = { {NULL, NULL, NULL}, }; -static int -ShowLoopback(struct cmdargs const *arg) -{ - prompt_Printf(&prompt, "Local loopback is %s\n", VarLoopback ? "on" : "off"); - return 0; -} - static int ShowLogLevel(struct cmdargs const *arg) { @@ -575,8 +553,6 @@ static struct cmdtab const ShowCommands[] = { "Show LCP status", "show lcp"}, {"links", "link", bundle_ShowLinks, LOCAL_AUTH, "Show available link names", "show links"}, - {"loopback", NULL, ShowLoopback, LOCAL_AUTH, - "Show loopback setting", "show loopback"}, {"log", NULL, ShowLogLevel, LOCAL_AUTH, "Show log levels", "show log"}, {"mem", NULL, ShowMemMap, LOCAL_AUTH, @@ -1452,8 +1428,6 @@ static struct cmdtab const SetCommands[] = { "set ifaddr [src-addr [dst-addr [netmask [trg-addr]]]]"}, {"filter", NULL, SetFilter, LOCAL_AUTH, "Set packet filters", "set filter in|out|dial|alive ..."}, - {"loopback", NULL, SetLoopback, LOCAL_AUTH, - "Set loopback facility", "set loopback on|off"}, {"log", NULL, SetLogLevel, LOCAL_AUTH, "Set log level", "set log [local] [+|-]value..."}, {"login", NULL, SetVariable, LOCAL_AUTH | LOCAL_CX, diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 43da9ffe806..750f0224d5f 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: main.c,v 1.121.2.39 1998/03/25 18:38:59 brian Exp $ + * $Id: main.c,v 1.121.2.40 1998/04/03 19:21:36 brian Exp $ * * TODO: * o Add commands for traffic summary, version display, etc. @@ -590,7 +590,7 @@ DoLoop(struct bundle *bundle) if (((struct ip *)tun.data)->ip_dst.s_addr == bundle->ncp.ipcp.my_ip.s_addr) { /* we've been asked to send something addressed *to* us :( */ - if (VarLoopback) { + if (Enabled(ConfLoopback)) { pri = PacketCheck(bundle, tun.data, n, &bundle->filter.in); if (pri >= 0) { struct mbuf *bp; diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8 index efcf2b8a074..f641aedc721 100644 --- a/usr.sbin/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.97.2.7 1998/03/20 19:47:03 brian Exp $ +.\" $Id: ppp.8,v 1.97.2.8 1998/04/03 19:24:04 brian Exp $ .Dd 20 September 1995 .Os FreeBSD .Dt PPP 8 @@ -1697,14 +1697,32 @@ not to make any utmp or wtmp entries. This is usually only necessary if you require the user to both login and authenticate themselves. .It idcheck Default: Enabled. When -.Nm Ppp -responds to an LCP packet, it must set the LCP Identifier field to be the -same as the Identifier field of the request. Disabling -.Ar idcheck -makes .Nm -ignore the value of the identifier field so that packets are -processed rather than being dropped. +exchanges low-level LCP, CCP and IPCP configuration traffic, the +.Em Identifier +field of any replies is expected to be the same as that of the request. +By default, +.Nm +drops any reply packets that do not contain the expected identifier +field, reporting the fact at the respective log level. If +.Ar idcheck +is disabled, +.Nm +will ignore the identifier field. +.It loopback +Default: Enabled. When +.Ar loopback +is enabled, +.Nm +will automatically loop back packets being sent +out with a destination address equal to that of the +.Em PPP +interface. If disabled, +.Nm +will send the packet, probably resulting in an ICMP redirect from +the other end. It is convenient to have this option enabled when +the interface is also the default route as it avoids the necessity +of a loopback route. .El .Pp .It add[!] dest mask gateway @@ -2318,19 +2336,6 @@ will wait before resending Finite State Machine (FSM) Request packets. The default .Ar period for all FSMs is 3 seconds (which should suffice in most cases). -.It set loopback on|off -When set to -.Ar on -(the default), -.Nm -will automatically loop back packets being sent -out with a destination address equal to that of the -.Em PPP -interface. If set to -.Ar off , -.Nm -will send the packet, probably resulting in an ICMP redirect from -the other end. .It set log [local] [+|-]value... This command allows the adjustment of the current log level. Refer to the Logging Facility section for further details. @@ -2570,8 +2575,6 @@ Show the current HDLC statistics. Show the current IPCP statistics. .It show lcp Show the current LCP statistics. -.It show loopback -Show the current loopback status. .It show log Show the current log values. .It show mem diff --git a/usr.sbin/ppp/vars.c b/usr.sbin/ppp/vars.c index 263e523f8bc..c4b95a92e62 100644 --- a/usr.sbin/ppp/vars.c +++ b/usr.sbin/ppp/vars.c @@ -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.45.2.18 1998/04/03 19:21:55 brian Exp $ + * $Id: vars.c,v 1.45.2.19 1998/04/03 19:24:06 brian Exp $ * */ #include @@ -48,7 +48,7 @@ #include "prompt.h" char VarVersion[] = "PPP Version 2.0-beta"; -char VarLocalVersion[] = "$Date: 1998/04/03 19:21:55 $"; +char VarLocalVersion[] = "$Date: 1998/04/03 19:24:06 $"; /* * Order of conf option is important. See vars.h. @@ -69,11 +69,12 @@ struct confdesc pppConfs[] = { {"throughput", CONF_DISABLE, CONF_NONE}, {"utmp", CONF_ENABLE, CONF_NONE}, {"idcheck", CONF_ENABLE, CONF_NONE}, + {"loopback", CONF_ENABLE, CONF_NONE}, {NULL}, }; struct pppvars pppVars = { - 1, LOCAL_NO_AUTH + LOCAL_NO_AUTH }; int diff --git a/usr.sbin/ppp/vars.h b/usr.sbin/ppp/vars.h index 6d9d498db59..f95b9ce83a5 100644 --- a/usr.sbin/ppp/vars.h +++ b/usr.sbin/ppp/vars.h @@ -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.42.2.15 1998/03/24 18:47:32 brian Exp $ + * $Id: vars.h,v 1.42.2.16 1998/04/03 19:24:07 brian Exp $ * * TODO: */ @@ -48,7 +48,8 @@ struct confdesc { #define ConfThroughput 12 #define ConfUtmp 13 #define ConfIdCheck 14 -#define MAXCONFS 15 +#define ConfLoopback 15 +#define MAXCONFS 16 #define Enabled(x) (pppConfs[x].myside & CONF_ENABLE) #define Acceptable(x) (pppConfs[x].hisside & CONF_ACCEPT) @@ -56,7 +57,6 @@ struct confdesc { extern struct confdesc pppConfs[MAXCONFS + 1]; struct pppvars { - int loopback; /* Turn around packets addressed to me */ #define LOCAL_AUTH 0x01 #define LOCAL_NO_AUTH 0x02 #define LOCAL_DENY 0x03 @@ -74,7 +74,6 @@ struct pppvars { struct aliasHandlers handler; /* Alias function pointers */ }; -#define VarLoopback pppVars.loopback #define VarLocalAuth pppVars.lauth #define VarAuthKey pppVars.auth_key