summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/lcp.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-03-01 13:46:45 +0000
committerbrian <brian@FreeBSD.org>1999-03-01 13:46:45 +0000
commit275998efb0f985be307406fadbccdb777d1164d7 (patch)
treee5bd7b847c1d54b51550039216bc3a72430fff66 /usr.sbin/ppp/lcp.c
parent941fc329cf32e2a4addeadd51b4275112afbe0e1 (diff)
downloadFreeBSD-src-275998efb0f985be307406fadbccdb777d1164d7.zip
FreeBSD-src-275998efb0f985be307406fadbccdb777d1164d7.tar.gz
When negotiating ACCMAPs, sync our ACCMAP with the
peers by ORing the two together and NAKing or REQing the result rather than allowing seperate local/peer values. If the peer REJs our ACCMAP and our ACCMAP isn't 0, warn about it and ignore the rejection.
Diffstat (limited to 'usr.sbin/ppp/lcp.c')
-rw-r--r--usr.sbin/ppp/lcp.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c
index 009cc06..52b0dbf 100644
--- a/usr.sbin/ppp/lcp.c
+++ b/usr.sbin/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.68 1999/02/18 00:52:14 brian Exp $
+ * $Id: lcp.c,v 1.69 1999/02/26 21:28:12 brian Exp $
*
* TODO:
* o Limit data field length by MRU
@@ -645,14 +645,26 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type,
switch (mode_type) {
case MODE_REQ:
lcp->his_accmap = accmap;
- memcpy(dec->ackend, cp, 6);
- dec->ackend += 6;
+ lcp->want_accmap |= accmap; /* restrict our requested map */
+ if (lcp->want_accmap == accmap) {
+ memcpy(dec->ackend, cp, 6);
+ dec->ackend += 6;
+ } else {
+ /* NAK with what we now want */
+ *dec->nakend++ = *cp;
+ *dec->nakend++ = 6;
+ ua_htonl(&lcp->want_accmap, dec->nakend);
+ dec->nakend += 4;
+ }
break;
case MODE_NAK:
- lcp->want_accmap = accmap;
+ lcp->want_accmap |= accmap;
break;
case MODE_REJ:
- lcp->his_reject |= (1 << type);
+ if (lcp->want_accmap)
+ log_Printf(LogWARN, "Peer is rejecting our ACCMAP.... bad news !\n");
+ else
+ lcp->his_reject |= (1 << type);
break;
}
break;
OpenPOWER on IntegriCloud