Allow our endpoint discriminator to be enabled, disabled, accepted

and denied.  This is necessary for some MP implementations that
get confused if you accept their endpoint discriminator but reject
their MRRU.
This commit is contained in:
Brian Somers 1999-06-09 16:54:04 +00:00
parent c6f660d19f
commit 7063995c94
6 changed files with 56 additions and 20 deletions

View File

@ -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.199 1999/06/08 20:11:57 brian Exp $
* $Id: command.c,v 1.200 1999/06/09 08:47:32 brian Exp $
*
*/
#include <sys/param.h>
@ -133,17 +133,18 @@
#define NEG_CHAP80 42
#define NEG_CHAP80LM 43
#define NEG_DEFLATE 44
#define NEG_LQR 45
#define NEG_PAP 46
#define NEG_PPPDDEFLATE 47
#define NEG_PRED1 48
#define NEG_PROTOCOMP 49
#define NEG_SHORTSEQ 50
#define NEG_VJCOMP 51
#define NEG_DNS 52
#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
const char Version[] = "2.22";
const char VersionDate[] = "$Date: 1999/06/08 20:11:57 $";
const char VersionDate[] = "$Date: 1999/06/09 08:47:32 $";
static int ShowCommand(struct cmdargs const *);
static int TerminalCommand(struct cmdargs const *);
@ -2221,6 +2222,10 @@ 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_ENDDISC:
arg->bundle->ncp.mp.cfg.negenddisc &= keep;
arg->bundle->ncp.mp.cfg.negenddisc |= add;
break;
case NEG_LQR:
cx->physical->link.lcp.cfg.lqr &= keep;
cx->physical->link.lcp.cfg.lqr |= add;
@ -2317,6 +2322,8 @@ static struct cmdtab const NegotiateCommands[] = {
(const void *)NEG_PPPDDEFLATE},
{"dns", NULL, NegotiateSet, LOCAL_AUTH,
"DNS specification", "accept|deny|disable|enable", (const void *)NEG_DNS},
{"enddisc", NULL, NegotiateSet, LOCAL_AUTH, "ENDDISC negotiation",
"accept|deny|disable|enable", (const void *)NEG_ENDDISC},
{"lqr", NULL, NegotiateSet, LOCAL_AUTH | LOCAL_CX,
"Link Quality Reports", "accept|deny|disable|enable",
(const void *)NEG_LQR},

View File

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: lcp.c,v 1.74 1999/05/09 20:02:21 brian Exp $
* $Id: lcp.c,v 1.75 1999/06/02 15:59:02 brian Exp $
*
*/
@ -424,7 +424,8 @@ LcpSendConfigReq(struct fsm *fp)
}
mp = &lcp->fsm.bundle->ncp.mp;
if (mp->cfg.enddisc.class != 0 && !REJECTED(lcp, TY_ENDDISC)) {
if (mp->cfg.enddisc.class != 0 && IsEnabled(mp->cfg.negenddisc) &&
!REJECTED(lcp, TY_ENDDISC)) {
*o->data = mp->cfg.enddisc.class;
memcpy(o->data+1, mp->cfg.enddisc.address, mp->cfg.enddisc.len);
INC_LCP_OPT(TY_ENDDISC, mp->cfg.enddisc.len + 3, o);
@ -1059,7 +1060,9 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
if (!p) {
log_Printf(LogLCP, " ENDDISC rejected - not a physical link\n");
goto reqreject;
} else if (length-3 < sizeof p->dl->peer.enddisc.address &&
} else if (!IsAccepted(mp->cfg.negenddisc))
goto reqreject;
else if (length-3 < sizeof p->dl->peer.enddisc.address &&
cp[2] <= MAX_ENDDISC_CLASS) {
p->dl->peer.enddisc.class = cp[2];
p->dl->peer.enddisc.len = length-3;
@ -1079,7 +1082,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
}
break;
case MODE_NAK: /* Treat this as a REJ, we don't vary our disc */
case MODE_NAK: /* Treat this as a REJ, we don't vary our disc (yet) */
case MODE_REJ:
lcp->his_reject |= (1 << type);
break;

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp.c,v 1.23 1999/06/02 23:06:21 brian Exp $
* $Id: mp.c,v 1.24 1999/06/03 13:29:32 brian Exp $
*/
#include <sys/param.h>
@ -217,6 +217,7 @@ mp_Init(struct mp *mp, struct bundle *bundle)
mp->cfg.mrru = 0;
mp->cfg.shortseq = NEG_ENABLED|NEG_ACCEPTED;
mp->cfg.negenddisc = NEG_ENABLED|NEG_ACCEPTED;
mp->cfg.enddisc.class = 0;
*mp->cfg.enddisc.address = '\0';
mp->cfg.enddisc.len = 0;
@ -751,6 +752,8 @@ mp_ShowStatus(struct cmdargs const *arg)
prompt_Printf(arg->prompt, "disabled\n");
prompt_Printf(arg->prompt, " Short Seq: %s\n",
command_ShowNegval(mp->cfg.shortseq));
prompt_Printf(arg->prompt, " Discriminator: %s\n",
command_ShowNegval(mp->cfg.negenddisc));
return 0;
}

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: mp.h,v 1.4 1998/08/25 17:48:43 brian Exp $
* $Id: mp.h,v 1.5 1999/05/08 11:07:19 brian Exp $
*/
struct mbuf;
@ -94,6 +94,7 @@ struct mp {
struct {
u_short mrru; /* Max Reconstructed Receive Unit */
unsigned shortseq : 2; /* I want short Sequence Numbers */
unsigned negenddisc : 2; /* I want an endpoint discriminator */
struct enddisc enddisc; /* endpoint discriminator */
} cfg;

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.171 1999/06/02 00:46:55 brian Exp $
.\" $Id: ppp.8,v 1.172 1999/06/08 11:57:59 brian Exp $
.Dd 20 September 1995
.nr XX \w'\fC00'
.Os FreeBSD
@ -2355,6 +2355,15 @@ them. The answer is taken from
unless the
.Dq set dns
command is used as an override.
.It enddisc
Default: Enabled and Accepted. This option allows control over whether we
negotiate an endpoint discriminator. We only send our discriminator if
.Dq set enddisc
is used and
.Ar enddisc
is enabled. We reject the peers discriminator if
.Ar enddisc
is denied.
.It LANMan|chap80lm
Default: Disabled and Accepted. The use of this authentication protocol
is discouraged as it partially violates the authentication protocol by
@ -3751,7 +3760,9 @@ word expansions as the
command.
.It set enddisc Op label|IP|MAC|magic|psn value
This command sets our local endpoint discriminator. If set prior to
LCP negotiation,
LCP negotiation, and if no
.Dq disable enddisc
command has been used,
.Nm
will send the information to the peer using the LCP endpoint discriminator
option. The following discriminators may be set:

View File

@ -1,4 +1,4 @@
.\" $Id: ppp.8,v 1.171 1999/06/02 00:46:55 brian Exp $
.\" $Id: ppp.8,v 1.172 1999/06/08 11:57:59 brian Exp $
.Dd 20 September 1995
.nr XX \w'\fC00'
.Os FreeBSD
@ -2355,6 +2355,15 @@ them. The answer is taken from
unless the
.Dq set dns
command is used as an override.
.It enddisc
Default: Enabled and Accepted. This option allows control over whether we
negotiate an endpoint discriminator. We only send our discriminator if
.Dq set enddisc
is used and
.Ar enddisc
is enabled. We reject the peers discriminator if
.Ar enddisc
is denied.
.It LANMan|chap80lm
Default: Disabled and Accepted. The use of this authentication protocol
is discouraged as it partially violates the authentication protocol by
@ -3751,7 +3760,9 @@ word expansions as the
command.
.It set enddisc Op label|IP|MAC|magic|psn value
This command sets our local endpoint discriminator. If set prior to
LCP negotiation,
LCP negotiation, and if no
.Dq disable enddisc
command has been used,
.Nm
will send the information to the peer using the LCP endpoint discriminator
option. The following discriminators may be set: