diff options
author | brian <brian@cvs.openbsd.org> | 1999-03-01 13:47:59 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1999-03-01 13:47:59 +0000 |
commit | 42cf9830f5ddc4e894a435be5dcce033398364e1 (patch) | |
tree | fbf9544cd6f624d00f2acda5febd19163e1465a0 /usr.sbin | |
parent | b49f418ba660f4a5e53a938510851a21454f0335 (diff) |
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')
-rw-r--r-- | usr.sbin/ppp/ppp/lcp.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/usr.sbin/ppp/ppp/lcp.c b/usr.sbin/ppp/ppp/lcp.c index 4e52feeaa33..055ef8bf470 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.8 1999/02/26 21:28:23 brian Exp $ + * $Id: lcp.c,v 1.9 1999/03/01 13:47:58 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; |