From b4b280abef52085eac060c2fef6ba845f630cb98 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Wed, 6 May 1998 23:49:48 +0000 Subject: [PATCH] o Behave correctly when short sequence numbers are denied. o Determine if one seq is less than the other correctly, given the point at which they wrap (again). --- usr.sbin/ppp/lcp.c | 3 ++- usr.sbin/ppp/mp.c | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index 2cb9a546a373..91cde27fda3c 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.55.2.51 1998/04/30 23:53:42 brian Exp $ + * $Id: lcp.c,v 1.55.2.52 1998/05/01 19:24:55 brian Exp $ * * TODO: * o Limit data field length by MRU @@ -797,6 +797,7 @@ LcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, break; case MODE_REJ: lcp->his_reject |= (1 << type); + lcp->want_shortseq = 0; /* For when we hit MP */ break; } break; diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c index 234380674575..a873ed75c27c 100644 --- a/usr.sbin/ppp/mp.c +++ b/usr.sbin/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.1.2.23 1998/05/04 21:42:41 brian Exp $ + * $Id: mp.c,v 1.1.2.24 1998/05/06 18:50:12 brian Exp $ */ #include @@ -108,8 +108,15 @@ inc_seq(unsigned is12bit, u_int32_t seq) static int isbefore(unsigned is12bit, u_int32_t seq1, u_int32_t seq2) { - u_int32_t max = is12bit ? 0xfff : 0xffffff; - return seq1 < seq2 || (seq1 > max - 0x200 && seq2 <= 0x200); + u_int32_t max = (is12bit ? 0xfff : 0xffffff) - 0x200; + + if (seq1 > max) { + if (seq2 < 0x200 || seq2 > seq1) + return 1; + } else if ((seq1 > 0x200 || seq2 <= max) && seq1 < seq2) + return 1; + + return 0; } static int @@ -493,7 +500,8 @@ mp_Input(struct mp *mp, struct mbuf *m, struct physical *p) } static void -mp_Output(struct mp *mp, struct link *l, struct mbuf *m, int begin, int end) +mp_Output(struct mp *mp, struct link *l, struct mbuf *m, u_int32_t begin, + u_int32_t end) { struct mbuf *mo; @@ -526,7 +534,8 @@ mp_FillQueues(struct bundle *bundle) { struct mp *mp = &bundle->ncp.mp; struct datalink *dl, *fdl; - int total, add, len, begin, end, thislink, nlinks; + int total, add, len, thislink, nlinks; + u_int32_t begin, end; struct mbuf *m, *mo; thislink = nlinks = 0;