From a59964d665ad1cfe452c2c227de97a8af275fec8 Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 4 Feb 2001 22:53:11 +0000 Subject: Add a ``Usable'' function to the ccp switch. The function is called prior to sending a CCP configure request for a given protocol. The default is to send the request, but this is overridden for MPPE which checks to see if the lcp negotiations agreed CHAP81, and if not fails. Use the same function to decide if we should reject peer requests for MPPE. This should get rid of those boring messages about not being able to initialise MPPE when we don't negotiate CHAP81. --- usr.sbin/ppp/ccp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'usr.sbin/ppp/ccp.c') diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 6acfc53..f2b7f19 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -268,7 +268,8 @@ CcpSendConfigReq(struct fsm *fp) ccp->out.algorithm = -1; for (f = 0; f < NALGORITHMS; f++) if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) && - !REJECTED(ccp, algorithm[f]->id)) { + !REJECTED(ccp, algorithm[f]->id) && + (*algorithm[f]->Usable)(fp)) { if (!alloc) for (o = &ccp->out.opt; *o != NULL; o = &(*o)->next) @@ -491,6 +492,7 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, switch (mode_type) { case MODE_REQ: if (IsAccepted(ccp->cfg.neg[algorithm[f]->Neg]) && + (*algorithm[f]->Usable)(fp) && ccp->in.algorithm == -1) { memcpy(&ccp->in.opt, cp, length); switch ((*algorithm[f]->i.Set)(&ccp->in.opt, &ccp->cfg)) { @@ -697,4 +699,10 @@ ccp_SetOpenMode(struct ccp *ccp) return 0; /* No CCP at all */ } +int +ccp_IsUsable(struct fsm *fp) +{ + return 1; +} + struct layer ccplayer = { LAYER_CCP, "ccp", ccp_LayerPush, ccp_LayerPull }; -- cgit v1.1