From b14ec5d89c960001f3c7e3481ede6a215af590f6 Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 9 Jun 1999 16:55:27 +0000 Subject: 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. --- usr.sbin/ppp/ppp/command.c | 27 +++++++++++++++++---------- usr.sbin/ppp/ppp/lcp.c | 11 +++++++---- usr.sbin/ppp/ppp/mp.c | 5 ++++- usr.sbin/ppp/ppp/mp.h | 3 ++- usr.sbin/ppp/ppp/ppp.8 | 15 +++++++++++++-- 5 files changed, 43 insertions(+), 18 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index 0bdc184b734..6357d44f419 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/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.27 1999/06/09 08:47:23 brian Exp $ + * $Id: command.c,v 1.28 1999/06/09 16:55:25 brian Exp $ * */ #include @@ -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/09 08:47:23 $"; +const char VersionDate[] = "$Date: 1999/06/09 16:55:25 $"; 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}, diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c index 457c30d0bc9..e1bab115473 100644 --- a/usr.sbin/ppp/ppp/lcp.c +++ b/usr.sbin/ppp/ppp/lcp.c @@ -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.14 1999/06/02 15:58:40 brian Exp $ + * $Id: lcp.c,v 1.15 1999/06/09 16:55:25 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; diff --git a/usr.sbin/ppp/ppp/mp.c b/usr.sbin/ppp/ppp/mp.c index a87e03715f9..0ae804bcb5a 100644 --- a/usr.sbin/ppp/ppp/mp.c +++ b/usr.sbin/ppp/ppp/mp.c @@ -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.10 1999/06/03 13:50:53 brian Exp $ + * $Id: mp.c,v 1.11 1999/06/09 16:55:25 brian Exp $ */ #include @@ -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; } diff --git a/usr.sbin/ppp/ppp/mp.h b/usr.sbin/ppp/ppp/mp.h index 1b006bb583b..d125d9145f2 100644 --- a/usr.sbin/ppp/ppp/mp.h +++ b/usr.sbin/ppp/ppp/mp.h @@ -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.3 1999/05/08 11:06:38 brian Exp $ + * $Id: mp.h,v 1.4 1999/06/09 16:55:26 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; diff --git a/usr.sbin/ppp/ppp/ppp.8 b/usr.sbin/ppp/ppp/ppp.8 index f42d9b642ee..304d9cdfe9c 100644 --- a/usr.sbin/ppp/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $Id: ppp.8,v 1.48 1999/06/08 11:58:46 brian Exp $ +.\" $Id: ppp.8,v 1.49 1999/06/09 16:55:26 brian Exp $ .Dd 20 September 1995 .nr XX \w'\fC00' .Os @@ -2354,6 +2354,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 @@ -3750,7 +3759,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: -- cgit v1.2.3